Skip to content

4. Features via ROS2 Topics

Kartik Soni edited this page Sep 23, 2024 · 6 revisions

The list of topics is crucial for low-level control and diagnostic purposes. Here is a comprehensive list:

Low-Level ROS Topics Subcriber

/motor_control/enable

  • Type: std_msgs/Bool
  • Description: Enables or disables individual motor control. Ensure this is set to true to control the motors individually.

Warning

Enabling this mode will allow you to control the motors of the robot individually. Make sure you have lifted the robot to a higher level before using this feature to prevent an accidents

/motor_control/right_front

  • Type: std_msgs/Int32
  • Description: Controls the right front motor of the robot. Make sure /motor_control/enable is set to true for this to take effect.

/motor_control/left_front

  • Type: std_msgs/Int32
  • Description: Controls the left front motor of the robot. Make sure /motor_control/enable is set to true for this to take effect.

/motor_control/right_back

  • Type: std_msgs/Int32
  • Description: Controls the right back motor of the robot. Make sure /motor_control/enable is set to true for this to take effect.

/motor_control/left_back

  • Type: std_msgs/Int32
  • Description: Controls the left back motor of the robot. Make sure /motor_control/enable is set to true for this to take effect.

To control a motor:

ros2 topic pub -1 /motor_control/right_front std_msgs/msg/Int32 "{data: 100}" 

Note

The values range from -255 to 255 with 255 being the highest speed in forward direction and -255 being the highest speed in backward direction.

/robot/nav_status

  • Type: std_msgs/Int32
  • Description: Provides navigation status information of the robot.

/robot/network_status

  • Type: std_msgs/String
  • Description: Provides network connectivity status of the robot.

/pid/mode

  • Type: std_msgs/Int32
  • Description: This topic is of type int and is used to control the Proportional-Integral-Derivative (PID) controller.
    • 0 - Stop PID control
    • 1 - Fast PID control
    • 2 - Smooth PID control
    • 3 - Supersmooth PID control

Here's an example:

ros2 topic pub -1 /pid/control std_msgs/msg/Int32 "{data: 1}" 

/pid/custom/enable

  • Type: std_msgs/Bool
  • Description: Controls the enabling/disabling of custom PID modes.

/pid/constants

  • Type: std_msgs/Float32MultiArray
  • Description: Updates the PID constants.

/pid/custom/save

  • Type: std_msgs/Float32MultiArray
  • Description: Saves custom PID configurations.

/diagnostics/test

  • Type: std_msgs/Int32
  • Description: Runs diagnostics tests on the robot. It serves the purpose of identifying and addressing any issues that may arise during the robot's operation. For detailed diagnostics procedures, refer to the documentation.

/cmd_vel

  • Type: geometry_msgs/Twist
  • Description: Provides velocity commands in linear and angular dimensions.The /cmd_vel topic is responsible for receiving velocity commands for the robot. These commands can be generated by teleoperation or the move_base module, instructing the robot on how fast to move in different directions.

/ecu/restart

Warning

Use with caution. The ECU (ESP32) will reset, and pins may enter a floating state.

  • Type: std_msgs/Bool
  • Description: Handles ECU restart commands.

/buzzer/functions/enable

  • Type: std_msgs/Bool
  • Description: Controls the enabling/disabling of buzzer functions.

/buzzer/battery_low/enable

  • Type: std_msgs/Bool
  • Description: Controls the enabling/disabling of battery low warnings through the buzzer.

/hill_hold_control

  • Type: std_msgs/Bool
  • Description: The /hill_hold_control topic when enabled (It can be enabled by publishing true on /hill_hold_control topic) holds the robot on slope without any user input.

/microros_domain_id

  • Type: std_msgs/Int32
  • Description: The /microros_domain_id enables you to change your firmware's domain id permanently. Once changed, the firmware remembers your last set value and always boots up with the same domain id. (Currently set on domain-id 169)

To change the domain id, make sure microros agent is active, Open a new terminal and publish your custom domain id:

ros2 topic pub -1 /microros_domain_id std_msgs/msg/Int32 "{data: 169}" 

The robot will change the domain ID and reset the ECU automatically to make the necessary changes. You will able to see the topics on your custom domain id now.

Low-Level ROS Topics Publisher

/battery/percentage

This topic provides information about the remaining battery percentage of the robot.

Battery Percentage Beeping Sounds
100 - 20 No beeping
20 - 15 Beep every 2 minutes
15 - 10 Beep every 1 minute
Below 10 Very frequent beeping
0 (Complete Discharge) Continuous beep

Tip

To ensure you are aware of the robot's battery status, pay attention to the beeping sounds, especially as the battery percentage decreases.

Caution

Do not drain the battery below 10 %, doing so can damage the battery permanently.

/battery/voltage

This topic reports the current battery voltage, ranging from 29.4V at maximum charge to 22.4V at minimum charge.

/wheel/ticks

This topic provides an array of ticks for all four wheels of the robot, in the format [lf, lb, rf, rb]. These values represent the encoder readings of the wheel ticks.

/wheel/vel

The /wheel/vel topic sends an array of calculated current velocities for each wheel on the robot, received via encoders. The format of the array is [lf, lb, rf, rb], representing the actual velocity at which each wheel is moving.

/wheel/rpm

  • Type: std_msgs/Int32MultiArray
  • Description: Provides the RPM (Revolutions Per Minute) of the wheels in the format [lf, lb, rf, rb].

/cmd_vel

  • Type: geometry_msgs/Twist
  • Description: Publishes the robot's velocity commands.

/imu/data

  • Type: sensor_msgs/Imu
  • Description: Provides IMU (Inertial Measurement Unit) data including orientation, angular velocity, and linear acceleration.

estop/status

  • Type: std_msgs/Bool
  • Description: Publishes the status of the Emergency Stop button.

pixhawk/control

  • Type: std_msgs/Bool
  • Description: Publishes feedback on the Pixhawk control status.