Drivetrain Software

This page is meant to document the main components used for the rover drivetrain using ros2 control. The drivetrain software is the one that runs ros2 on the jetson. For documentation on the motor controllers, refer to the odrive motor controller page.

Below is a system diagram of the rover software. A brief explanation is given below. Refer to the child pages for more in depth information on each section.

 

Here is a high level, system diagram of the rover software structure. Not all of the components were created by UWRT, some are just being used from ros2 control.

The rover will start moving based on a velocity command published to /differential_drive_controller/cmd_vel. Since this is a planar robot, it can only take an “x” argument for linear velocity (moving forward/back) and a “z” argument for angular velocity (turning). This is given as the desired velocity value to the drivetrain controller.

The controller is configured in the launch file by the drivetrain_controllers.yaml file which tells the controller manager, ros2_control_node which controller to launch (the differential drivetrain controller) and specific parameters for the controller (ros2 control joint names, wheels radius, wheel separation, etc).

The resource manager is in charge of serving the state/command interfaces to the controller, which are the ways that the controller can interact with the actual hardware. The state interface is for reading values from hardware (feedback), while the command interface is for changing hardware behaviour (setting).

A ros2 control hardware interface was the written with explicit methods that define setting up the actual communication links on the rover through a lifecycle node approach (explained in more detail in the child page). Here, the CANWrapper is set up, which is capable of sending messages over CAN.

Finally, the motors controllers recieve commands over CAN (to either set a specific velocity value to the wheels or read from the encoders) which moves the rover.

 

The differential drive controller created in ros2 control is responsible for getting a desired velocity value, sending specific velocity values to each individual motor, getting feedback from the encoders, and adjusting the velocity values in each motor in order to get the rover to move with the desired velocity.