This repository takes inspiration from ROS-jtop and creates package for ros2 (currently tested on eloquent)
ROS2 Eloquent Install Guide
sudo -H pip install -U jetson-stats
cd dev_ws/src
git clone https://github.com/NVIDIA-AI-IOT/ros2_jetson_stats.git
sudo rosdep install --from-paths ros2_jtop --ignore-src --rosdistro eloquent -y
colcon build
. install/setup.bash
The basic usage consists of creating diagnostics_msgs
and services for control fan mode/speed, setting up jetson_clocks
, and power mode.
Run JTOP node:
ros2 run ros2_jetson_stats ros2_jtop
If you want to change frequency of JTOP messages, do following:
ros2 run ros2_jetson_stats ros2_jtop --ros-args -p interval:=0.2
Note: JTOP frequency is from 0 - 1 range
You can see diagnostic messages using following command:
sudo . install/setup.bash
sudo . install/local_setup.bash
ros2 run rqt_topic rqt_topic
Note: for default interval you will see message frequency ~2Hz if you change interval to 0.2 the message frequency will change to 6Hz
To run JTOP services:
You will need to keep running ros2_jetson_stats
; as shown in step 1.
A. Change Power Model:
Open new terminal
sudo . install/local_setup.bash
ros2 service call /jtop/nvpmodel jtop_services/srv/NVPModel "{nvpmodel: 0}"
This will change power mode to 15 W 2 Core
on Jetson Xavier NX
Following Message will appear on the terminal:
requester: making request: jtop_services.srv.NVPModel_Request(nvpmodel=2)
response:
jtop_services.srv.NVPModel_Response(power_mode='MODE_15W_2CORE')
B. Change Fan mode and Fan Speed:
Open new terminal
sudo . install/local_setup.bash
ros2 service call /jtop/fan jtop_services/srv/Fan "{mode: system, speed: 100}"
This will change fan speed to 100; you can see Jetson Fan being turned on.
requester: making request: jtop_services.srv.Fan_Request(mode='system', speed=100)
response:
jtop_services.srv.Fan_Response(set_fan_mode='system', set_fan_speed=100)
C. Start Jetson Clocks:
Open new terminal
sudo . install/local_setup.bash
ros2 service call /jtop/jetson_clocks jtop_services/srv/JetsonClocks "{status: True}"