- To run the code with the controller run the following :
ros2 launch arm_sim arm_gz.launch.py
ros2 control load_controller --set-state start joint_state_broadcaster
ros2 control load_controller --set-state start joint_trajectory_controller
ros2 run arm_sim controller
You can either give the end-effector position or the joint angles directly using the following commands:
ros2 topic pub --once /target_angles std_msgs/msg/Float64MultiArray "{data: [0.0, 0.0, 1.57, 0.0, 1.57, 1.57]}"
ros2 topic pub --once /target_position geometry_msgs/msg/Vector3 "{x: 0.0, y: 0.0, z: 0.5}"
- Install gazebo ros interface
sudo apt install ros-$ROS_DISTRO-gazebo-ros-pkgs ros-$ROS_DISTRO-control-msgs ros-$ROS_DISTRO-ros2-control ros-$ROS_DISTRO-gazebo-ros2-control
(http://classic.gazebosim.org/tutorials?tut=ros2_installing&cat=connect_ros)
- To use xacro files with gazebo on ros2
sudo apt install ros-$ROS_DISTRO-xacro
(https://www.theconstructsim.com/how-to-use-xacro-in-ros2-gazebo/)
- Trajectory & State controller
sudo apt-get install ros-$ROS_DISTRO-joint-state-controller ros-$ROS_DISTRO-joint-trajectory-controller