Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backported changes from isaac_ros_jetson to work wih jetson_stats 4.2.12 #13

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM ros:noetic-ros-core-focal

# install pip3
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-pip \
ros-noetic-diagnostic-aggregator \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

#upgrade pip
RUN python3 -m pip install --upgrade pip
#install jetson-stats
RUN python3 -m pip install -U jetson-stats

#source ros env
RUN echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
18 changes: 14 additions & 4 deletions param/jtop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,34 @@ analyzers:
type: diagnostic_aggregator/GenericAnalyzer
path: GPU
contains: 'gpu'
remove_prefix: jetson_stats
remove_prefix: jetson_stats gpu
memory:
type: diagnostic_aggregator/GenericAnalyzer
path: Memory
contains: 'mem'
remove_prefix: jetson_stats mem
engine:
type: diagnostic_aggregator/GenericAnalyzer
path: Engine
contains: 'engine'
remove_prefix: jetson_stats engine
temperatures:
type: diagnostic_aggregator/GenericAnalyzer
path: Temperatures
contains: 'temp'
remove_prefix: jetson_stats
remove_prefix: jetson_stats temp
power:
type: diagnostic_aggregator/GenericAnalyzer
path: Power
contains: 'power'
remove_prefix: jetson_stats
remove_prefix: jetson_stats power
board:
type: diagnostic_aggregator/GenericAnalyzer
path: board
contains: 'board'
remove_prefix: jetson_stats board
remove_prefix: jetson_stats board
fan:
type: diagnostic_aggregator/GenericAnalyzer
path: Board
contains: 'fan'
remove_prefix: jetson_stats fan
55 changes: 35 additions & 20 deletions scripts/jetson_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
other_status,
board_status,
disk_status,
engine_status,
cpu_status,
fan_status,
gpu_status,
Expand Down Expand Up @@ -87,18 +88,18 @@ def stop(self):
self.jetson.close()

def fan_service(self, req):
# Try to set new nvpmodel
fan_mode = req.mode
# Update fan_service to use fan.profile instead of fan.mode
fan_profile = req.mode
fan_speed = req.fanSpeed
try:
self.jetson.fan.mode = fan_mode
if fan_mode == "manual":
self.jetson.fan.profile = fan_profile
if fan_profile == "manual":
self.jetson.fan.speed = fan_speed
except jtop.JtopException as e:
rospy.logerr(e)
# Return same nvp model
fan_mode = str(self.jetson.fan.mode)
return fanResponse(fan_mode)
# Return current fan profile
fan_profile = str(self.jetson.fan.profile)
return fanResponse(fan_profile)

def jetson_clocks_service(self, req):
# Set new jetson_clocks
Expand All @@ -122,21 +123,35 @@ def jetson_callback(self, jetson):
# Status board and board info
self.arr.status = [other_status(self.hardware, jetson, jtop.__version__)]
# Make diagnostic message for each cpu
self.arr.status += [cpu_status(self.hardware, name, jetson.cpu[name]) for name in jetson.cpu]
self.arr.status += [cpu_status(self.hardware, name, cpu)
for name, cpu in enumerate(jetson.cpu['cpu'])]
# Merge all other diagnostics
self.arr.status += [gpu_status(self.hardware, jetson.gpu[1])]
self.arr.status += [ram_status(self.hardware, jetson.ram, 'mem')]
self.arr.status += [swap_status(self.hardware, jetson.swap, 'mem')]
self.arr.status += [emc_status(self.hardware, jetson.emc, 'mem')]
# Temperature
self.arr.status += [temp_status(self.hardware, jetson.temperature, self.level_options)]
# Read power
total, power = jetson.power
if power:
self.arr.status += [power_status(self.hardware, total, power)]
# Fan controller
self.arr.status += [gpu_status(self.hardware, name, jetson.gpu[name])
for name in self.jetson.gpu]
# Make diagnostic message for each engine
self.arr.status += [engine_status(self.hardware, name, engine)
for name, engine in jetson.engine.items()]
# Update access to jetson.memory
self.arr.status += [ram_status(self.hardware, jetson.memory['RAM'], 'mem')]
self.arr.status += [swap_status(self.hardware, jetson.memory['SWAP'], 'mem')]
if 'EMC' in jetson.memory:
self.arr.status += [emc_status(self.hardware, jetson.memory['EMC'], 'mem')]
# Make diagnostic message for each Temperature
self.arr.status += [temp_status(self.hardware, name, sensor)
for name, sensor in jetson.temperature.items()]
# Make diagnostic message for each power rail
self.arr.status += [power_status(self.hardware, name, rail)
for name, rail in self.jetson.power['rail'].items()]
if 'name' in self.jetson.power['tot']:
name_total = self.jetson.power['tot']['name']
else:
name_total = 'ALL'
self.arr.status += [power_status(self.hardware,
name_total, jetson.power['tot'])]
# Update fan_status usage
if jetson.fan:
self.arr.status += [fan_status(self.hardware, jetson.fan, 'board')]
self.arr.status += [fan_status(self.hardware, name, fan)
for name, fan in jetson.fan.items()]
# Status board and board info
self.arr.status += [self.board_status]
# Add disk status
Expand Down
Loading