BenBenBotKernal/Software/ROS_Driver/ROS2-driver
詹力 94b2281895 上传ROS驱动 2024-07-03 17:19:25 +08:00
..
bringup 上传ROS驱动 2024-07-03 17:19:25 +08:00
description 上传ROS驱动 2024-07-03 17:19:25 +08:00
doc 上传ROS驱动 2024-07-03 17:19:25 +08:00
hardware 上传ROS驱动 2024-07-03 17:19:25 +08:00
CMakeLists.txt 上传ROS驱动 2024-07-03 17:19:25 +08:00
README.md 上传ROS驱动 2024-07-03 17:19:25 +08:00
hoverboard_driver.xml 上传ROS驱动 2024-07-03 17:19:25 +08:00
package.xml 上传ROS驱动 2024-07-03 17:19:25 +08:00

README.md

Hints

Connect Hoverboard PCB (USART3, GND, TX, RX, no VCC!!) to USB-TTL converter (or UART interface of your SBC). Set the serial port according to your setup in hoverboard_driver.ros2_control.xacro file

Launch

ros2 launch hoverboard_driver diffbot.launch.py

Classes

The entire package consists of three main classes:

  1. hoverboard_driver_node
  2. hoverboard_driver
  3. pid

whereas the first two are implemented in the same file named hoverboard_driver.cpp (blame on me)

hoverboard_driver

This is the main class and implements the hardare interface for diff_drove_controller itself. This class is responsible for read/write to hardware.

hoverboard_driver_node

This class is a member/attribute of hoverboard_driver class and acts as a helper class. As hoverboard_driver itselfs derives from hardware_interface::SystemInterface class, hoverboard_driver class is not able to define publishers or settable parameters. To overcome this, hoverboard_driver_node has been introduced. This class derives from rclcpp::Node and can therefore publish topics and also can define reconfigurable parameters.

This class publishes state of Hoverboard PCB like velocity, pose, command, voltage, temperature, battery level,current consumption of each motor and the state of serial interface(connected, not connected).

Also this class provides dynamic parameters for PID controller

pid

The PID class is defined as /attribute of overboard_Driver class (array, of PIDs, one per wheel). It works in general but it's not active now as I idn't find proper PID settings so far. To activate, change this code section in hoverboard_driver.cpp

    //double set_speed[2] = {
     //   pid_outputs[0] / 0.10472,
      //  pid_outputs[1] / 0.10472};

     double set_speed[2] = {
           hw_commands_[left_wheel] / 0.10472,
           hw_commands_[right_wheel] / 0.10472
     };
     ```