Ferdinando Dionisio, Vittorio Lisi, Giovanni Gabriele Imbimbo, Emanuele Cifelli
This homework involves developing a ROS package to dynamically control a 7-degrees-of-freedom robotic manipulator in the Gazebo simulation environment.
-
Clone the repository from GitHub:
cd src git clone -b REV_3 https://github.com/ferd-bot/RL_24_Homework_2_Robotics.git .
Warning:
The abovegit clonecommand (with the dot) works only if the target directory is empty.- If not, you can remove extra files using:
rm -rf * - Alternatively, download the repository normally (without the dot) and manually move the files out of the
RL_24_Homework_2_Roboticsfolder while remaining inside thesrcdirectory.
- If not, you can remove extra files using:
-
Configure and build all packages in the workspace:
cd ~/ros2_ws rm -rf build/ install/ log/ colcon build source install/setup.bash
The new code supports controlling the manipulator in three modes:
-
Position Mode:
Launch theiiwa_arm_controller(with RViz):ros2 launch iiwa_bringup iiwa.launch.py command_interface:="position" robot_controller:="iiwa_arm_controller"
-
Velocity Mode:
Launch thevelocity_controller(with RViz):ros2 launch iiwa_bringup iiwa.launch.py command_interface:="velocity" robot_controller:="velocity_controller"
-
Effort Mode:
Launch theeffort_controller(with Gazebo simulation):ros2 launch iiwa_bringup iiwa.launch.py command_interface:="effort" robot_controller:="effort_controller" use_sim:="true"
To execute trajectories, open a new terminal and run the following commands depending on the desired control mode:
-
Position Mode:
ros2 run ros2_kdl_package ros2_kdl_node 0 --ros-args -p cmd_interface:=position
-
Velocity Mode:
ros2 run ros2_kdl_package ros2_kdl_node 0 --ros-args -p cmd_interface:=velocity
-
Effort Mode with Operational Space:
ros2 run ros2_kdl_package ros2_kdl_node 0 --ros-args -p cmd_interface:=effort -p control_space:=operational_space
-
Effort Mode with Joint Space:
ros2 run ros2_kdl_package ros2_kdl_node 0 --ros-args -p cmd_interface:=effort -p control_space:=joint_space
The following trajectories are supported, all with effort-based control in Operational Space.
Trajectories are numbered from 0 to 3:
-
Linear with Trapezoidal Velocity Profile:
ros2 run ros2_kdl_package ros2_kdl_node 0 --ros-args -p cmd_interface:=effort -p control_space:=operational_space
-
Linear with Cubic Velocity Profile:
ros2 run ros2_kdl_package ros2_kdl_node 1 --ros-args -p cmd_interface:=effort -p control_space:=operational_space
-
Circular with Trapezoidal Velocity Profile:
ros2 run ros2_kdl_package ros2_kdl_node 2 --ros-args -p cmd_interface:=effort -p control_space:=operational_space
-
Circular with Cubic Velocity Profile:
ros2 run ros2_kdl_package ros2_kdl_node 3 --ros-args -p cmd_interface:=effort -p control_space:=operational_space
To execute trajectories in Joint Space, simply set control_space:=joint_space.
For Position or Velocity Control, modify the cmd_interface parameter as explained above.
A new topic called /torque_plot has been defined in the code.
This topic allows you to visualize the torques sent to the manipulator's joints.
You can monitor this topic in the terminal:
ros2 topic echo /torque_plotAlternatively, use rqt_plot for graphical visualization:
rqtWithin rqt, set up the plugin for plotting and insert the data corresponding to the joints:
/torque_plot/data[0]
/torque_plot/data[1]
/torque_plot/data[2]
/torque_plot/data[3]
/torque_plot/data[4]
/torque_plot/data[5]
/torque_plot/data[6]
Note:
The /torque_plot topic is activated within the ros2_kdl node.
To visualize it, you must run the KDL node in Effort Mode at least once.
For simplicity, only videos demonstrating Effort-Based Control in Operational Space with Gazebo are attached: