Authors: Ferdinando Dionisio, Vittorio Lisi, Giovanni Gabriele Imbimbo, Emanuele Cifelli
This is Homework 3, where the objective is to implement a vision-based controller for a 7-degrees-of-freedom robotic manipulator arm within the Gazebo simulation environment.
-
Clone the repository from GitHub:
cd src git clone -b REV_3 https://github.com/ferd-bot/RL_24_Homework_3_Robotics.git .
Important:
Thegit clonecommand with the dot (.) works only if the target directory is empty.- If not, you can remove extra files using:
rm -rf * - Alternatively, clone the repository normally (without the dot) and manually move the files from the
RL_24_Homework_3_Roboticsfolder to thesrcdirectory.
- If not, you can remove extra files using:
-
Configure and build all packages in the ROS2 workspace:
cd ~/ros2_ws rm -rf build/ install/ log/ colcon build source install/setup.bash
To launch the Gazebo simulation with the Position controller and enable the camera:
ros2 launch iiwa_bringup iiwa.launch.py use_sim:="true" use_vision:="true"- Note: If the camera is not required, set
use_vision:=false:ros2 launch iiwa_bringup iiwa.launch.py use_sim:="true" use_vision:="false"
To launch the Gazebo simulation with the Position controller, camera, and spherical object:
ros2 launch iiwa_bringup iiwa.launch.py use_sim:="true" use_vision:="true" spherical_object:="true"To move the manipulator toward the sphere (position control), open a new terminal and run:
ros2 topic pub /iiwa_arm_controller/commands std_msgs/msg/Float64MultiArray "data: [1.7, 2.0, 0.0, 2.0, 0.0, -1.5, 0.0]"To use OpenCV functionalities, run the following command in a new terminal:
ros2 run ros2_opencv ros2_opencv_nodeTo visualize the image processed by OpenCV, open rqt in another terminal and subscribe to the topic /processed_image:
rqtTo launch Gazebo in velocity mode with ArUco tags enabled:
ros2 launch iiwa_bringup iiwa.launch.py command_interface:="velocity" robot_controller:="velocity_controller" use_sim:="true" use_vision:="true" aruco_tag:="true"This command also opens RViz with a pre-configured setup for the aruco_single node to detect the marker.
-
To perform the Positioning Task in velocity mode, open another terminal and run:
ros2 run ros2_kdl_package ros2_kdl_node --ros-args -p cmd_interface:=velocity -p task:=positioning
-
To perform the Look-at-Point Task in velocity mode, open another terminal and run:
ros2 run ros2_kdl_package ros2_kdl_node --ros-args -p cmd_interface:=velocity -p task:=look-at-point
To visualize the image of Aruco, open rqt in another terminal and subscribe to the topic /aruco_detect/result:
rqtYou can execute the four trajectories defined in the previous homework using effort mode.
To start Gazebo in effort mode:
ros2 launch iiwa_bringup iiwa.launch.py command_interface:="effort" robot_controller:="effort_controller" use_sim:="true" use_vision:="true" aruco_tag:="true"To execute the trajectories, open a new terminal and run one of the following commands depending on the desired control mode:
-
Effort Mode in Joint Space:
ros2 run ros2_kdl_package ros2_kdl_node 0 --ros-args -p cmd_interface:=effort -p control_space:=joint_space
-
Effort Mode in Operational Space:
ros2 run ros2_kdl_package ros2_kdl_node 0 --ros-args -p cmd_interface:=effort -p control_space:=operational_space
To visualize the image of Aruco, open rqt in another terminal and subscribe to the topic /aruco_detect/result:
rqtThe following trajectories are supported, all controlled in Effort Mode with Joint Space as the default.
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:=joint_space
-
Linear with Cubic Velocity Profile:
ros2 run ros2_kdl_package ros2_kdl_node 1 --ros-args -p cmd_interface:=effort -p control_space:=joint_space
-
Circular with Trapezoidal Velocity Profile:
ros2 run ros2_kdl_package ros2_kdl_node 2 --ros-args -p cmd_interface:=effort -p control_space:=joint_space
-
Circular with Cubic Velocity Profile:
ros2 run ros2_kdl_package ros2_kdl_node 3 --ros-args -p cmd_interface:=effort -p control_space:=joint_space
To execute trajectories in Operational Space, simply set control_space:=operational_space.
A new topic /torque_plot has been added.
This topic allows you to visualize the torques applied to the manipulator's joints.
To monitor the topic in the terminal:
ros2 topic echo /torque_plotAlternatively, use rqt_plot for graphical visualization:
rqtIn rqt, set up the plotting plugin and add the following data points for each joint:
/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]
Additional Topics:
- Visualize the detected ArUco pose:
ros2 topic echo /aruco_detect/pose
For simplicity, only videos demonstrating Effort-Based Control in Operational Space with Gazebo are included: