Interacting with the ros2_control framework using the CLI
It is now time to start the simulation to interact with the controllers. Let’s start by installing the dependencies:
sudo apt-get install ros-jazzy-xacro ros-jazzy-ros-gz-sim ros-jazzy-gz-ros2-control-demos
Assuming you already initialized and sourced the workspace, run the following commands:
- To start the simulation, use the following command:
ros2 launch two_joints_robot start_simu.launch.py
With this command, along with the simulation, we launch the controllers of the robot.
- For example, if you want to move a joint, you can directly publish the
position
command using theros2 topic pub
command:ros2 topic pub /position_control/commands std_msgs/msg/Float64MultiArray "{data: [3, 0]}"
- In this way, you request to move the first joint of the robot to
3
radians, while bringing the second joint to0
radians. The result of this motion...