Skip to content

Latest commit

 

History

History
65 lines (54 loc) · 2.41 KB

ROS_API.md

File metadata and controls

65 lines (54 loc) · 2.41 KB

Use micro_ros_agent to communicate with all firmware functionalities.

ros2 run micro_ros_agent micro_ros_agent serial -D $SERIAL_PORT serial -b 576000
  • rosbot_ros2_firmware it is a micro-ROS node on CORE2 inside ROSbot 2R, 2 PRO, 2. It is used to publish all the sensor data such as wheels positions, IMU measurements, battery level and buttons states from firmware to ROS2 and also to subscribe command values such as motors speeds, servos periods, servos parameters and LEDs states. Subscribes

    • /cmd_ser (std_msgs/msg/UInt32MultiArray[6])
    • /led/left (std_msgs/msg/Bool)
    • /led/right (std_msgs/msg/Bool)
    • /_motors_cmd (std_msgs/msg/Float32MultiArray[4])

    Publishes

    • /_motors_response (*sensor_msgs/msg/JointState)
    • /_imu/data_raw (sensor_msgs/msg/Imu)
    • /battery (sensor_msgs/BatteryState)
    • /range/fr (sensor_msgs/msg/Range)
    • /range/fl (sensor_msgs/msg/Range)
    • /range/rr (sensor_msgs/msg/Range)
    • /range/rl (sensor_msgs/msg/Range)
    • /button/left (std_msgs/msg/Bool)
    • /button/right (std_msgs/msg/Bool)

    Parameters

    • servo_enable_power (Bool)
    • servo_voltage (Double):
      • 5.0V
      • 6.0V
      • 7.4V
      • 8.6V
    • servo[0...5]_enable (*Bool_) e.g. servo2_enable
    • servo[0...5]_period (*UInt32_) e.g. servo2_period

Command line examples

  • Motors driving (e.g. go forward)

    ros2 topic pub /_motors_cmd std_msgs/msg/Float32MultiArray "data: [1.0, 1.0, 1.0, 1.0]"
  • Servos steering

    # Choose power supply voltage for the servos e.g. 5.0V
    ros2 param set /rosbot_ros2_firmware servo_voltage 5.0
    
    # Enable power for the servos
    ros2 param set /rosbot_ros2_firmware servo_enable_power true
    
    # Set the control period in microseconds e.g. 20 000us for the servo5
    ros2 param set /rosbot_ros2_firmware servo5_period 20000
    
    # Enable PWM output for the servo e.g. for the servo5
    ros2 param set /rosbot_ros2_firmware servo5_enable true
    
    # Send duty cycle to the servos
    ros2 topic  pub /cmd_ser std_msgs/msg/UInt32MultiArray "data: [0, 0, 0, 0, 0, 2000]"
    
  • LED blinking

    # Turn on the left LED
    ros2 topic pub /led/left std_msgs/msg/Bool "data: true"
    
    # Turn off the left LED
    ros2 topic pub /led/left std_msgs/msg/Bool "data: false"