Implementing a new controller
The ros2_control
framework supports various controllers beyond the basic forward_command_controller
, such as diff_drive_controller
for mobile robots. For custom needs, you can create specialized controllers that directly implement control laws and interact with hardware without using ROS 2 communication. These controllers are dynamic libraries loaded by the Controller Manager via pluginlib
, allowing modular and on-demand loading. For instance, we’ll create a controller that generates sinusoidal motion for the robot’s joints, using ROS 2 topics for signal specifications. This setup is useful for testing motor performance and involves specific creation steps.
Step 1 – Creating the ros2 package
The first step is to set up the ros2 package continuing our controller. Let’s create it with the following command to include all the dependencies:
ros2 pkg create sine_ctrl --dependencies rclcpp std_msgs controller_interface...