rbonghi / ros_jetson_stats

🐢 The ROS jetson-stats wrapper. The status of your NVIDIA jetson in diagnostic messages
MIT License
67 stars 25 forks source link

out of sync with jetson_stats? #10

Closed pseyfert closed 1 year ago

pseyfert commented 1 year ago

I had stumbled over a few crashes when trying to get this running. Nothing too hard to fix, but the changes I hacked together

diff --git a/scripts/jetson_stats.py b/scripts/jetson_stats.py
index 10052d7..574461a 100755
--- a/scripts/jetson_stats.py
+++ b/scripts/jetson_stats.py
@@ -75,7 +75,7 @@ class ROSJtop:
         # Extract board information
         board = self.jetson.board
         # Define hardware name
-        self.hardware = board["info"]["machine"]
+        self.hardware = board["platform"]["Machine"]
         # Board status message
         self.board_status = board_status(self.hardware, board, 'board')
         # Set callback
@@ -124,7 +124,7 @@ class ROSJtop:
         # Make diagnostic message for each cpu
         self.arr.status += [cpu_status(self.hardware, name, jetson.cpu[name]) for name in jetson.cpu]
         # Merge all other diagnostics
-        self.arr.status += [gpu_status(self.hardware, jetson.gpu)]
+        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')]
diff --git a/src/ros_jetson_stats/utils.py b/src/ros_jetson_stats/utils.py
index d72c00a..5a41d45 100644
--- a/src/ros_jetson_stats/utils.py
+++ b/src/ros_jetson_stats/utils.py
@@ -105,7 +105,7 @@ def board_status(hardware, board, dgtype):
     # Make board diagnostic status
     d_board = DiagnosticStatus(
         name='jetson_stats {type} config'.format(type=dgtype),
-        message='Jetpack {jetpack}'.format(jetpack=board['info']['jetpack']),
+        message='Jetpack {jetpack}'.format(jetpack=board['hardware']['Jetpack']),
         hardware_id=hardware,
         values=values)
     return d_board

(not entirely sure if everything works as intended across platforms, but at least what I'm interested in seems to work).

These changes make me wonder though if there was some api break in jetson_stats that needs to be followed up here?

rbonghi commented 1 year ago

Hi @pseyfert ,

You are right! I didn't update this package. From jetson-stats, I made a few changes to the jtop API. I add your fixes! :-)

just for curiosity are you working on Noetic?

pseyfert commented 1 year ago

yes that was running noetic.

rbonghi commented 1 year ago

Thx! I'm trying to make a Docker to test with noetic (I completely switched to ROS2, and I don't have nothing to test this package)

I will keep you posted. Meanwhile I open a branch with your fixes

rbonghi commented 1 year ago

You can test on this branch hotfix/jetson-stats-4.1

pseyfert commented 1 year ago

works fine for me. thanks.

rbonghi commented 1 year ago

I will merge on the main soon! Thank you