The hardware-software-ros interaction in the andino
project is developed using ROS 2 Control.
This package:
- Implements
andino
's hardware interface. - Provides a communication with microcontroller:
andino_base::MotorDriver
class is in charge of the Serial communication for commanding the motors.- An application is provided for evaluating the communication: Check
applications/motor_driver_demo.cpp
. To use this application simply executemotor_driver_demo --help
to see the options.
- An application is provided for evaluating the communication: Check
- This communication module is used by the hardware interface implementation.
In ros2_control
hardware system components are libraries, dynamically loaded by the controller manager using the pluginlib interface.
For extra information about the hardware components see Hardware Components.
The hardware interface accepts some parameters that are passed via the urdf description within the ros2_control
tag (Check andino_description
)
Params | Description |
---|---|
left_wheel_name | Name of the left wheel joint. |
right_wheel_name | Name of the right wheel joint. |
serial_device | Path to the serial device. |
baud_rate | Baud rate of the serial communication. |
timeout | Timeout for the communication. |
enc_ticks_per_rev | Encoder ticks per revolution of the wheel. |
This hardware interface implements the following state interfaces per joint (for left and right joint):
- Position: The position is obtained via encoder information from the microcontroller.
- Velocity: Velocity is calculated via encoder information from the microcontroller.
This hardware interface uses the following command interfaces per joint (for left and right joint):
- Velocity: The velocity received (rad/s) is traduced to microcontroller's velocity nomenclature for the motors.
An application for testing the connection with the microcontroller is provided.
After installing this package the application called motor_driver_demo
can be used.
motor_driver_demo --help
This application allows verifying the communication with the microcontroller for controlling the motors. Commands for reading the encoders or individually setting a velocity for the motors is some of the possibilities.
- Serial communication: In case the serial port is denied to be open, probably the user should be added to the
plugdev
anddialout
groups:sudo usermod -a -G dialout $USER sudo usermod -a -G plugdev $USER