Skip to content

About

ROS 2 pick-and-place for the TIAGo robot in Gazebo: ArUco object localisation, inverse-kinematics motion planning and learning from demonstration with DMPs

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

TIAGo Pick-and-Place in ROS 2 and Gazebo

Group project for the Fondamenti di Robotica (Fundamentals of Robotics) course of the MSc in Intelligent Systems Engineering at Università Campus Bio-Medico di Roma (2025).

The TIAGo robot, simulated in Gazebo with ROS 2 Humble, scans a table with its head camera, localises the objects and their destinations through ArUco markers, and moves two objects from their pick positions to their place positions. The arm motion is generated in two ways:

  • Task 2: task-space interpolation and inverse kinematics;
  • Task 3: dynamic movement primitives (DMPs) learned from demonstrations recorded on the real robot and adapted to the target poses.

Team: Gianluca Barnaba, Federico Bini, Beatrice Bussone, Federico Principi, Luca Scorza. The work was not split by task: all members contributed to every part.

The slides of the final presentation (in Italian) are in docs/presentation.pdf.

Pipeline

Task 1: scan and marker localisation (task_1)

  • action_server and action_client move the head from left to right through the custom MoveHead action, which publishes the current angle as feedback and can be cancelled.
  • aruco_handler reads the RGB camera stream and calibration, detects the ArUco markers with OpenCV (DICT_6X6_250, 6 cm markers) and estimates their poses in the camera optical frame. It transforms each pose into base_footprint with TF2 and publishes it on /aruco_pose_<id>. It also rebroadcasts the last pose of each marker as the TF frame aruco_marker_<id>, so the targets remain available after the scan.
  • grasp_publisher applies position and orientation offsets to the marker frames and publishes the grasp poses of the two objects (/grasp_pose_1, /grasp_pose_2) and their place poses (/grasp_pose_3, /grasp_pose_4), also as TF frames for RViz.

Task 2: planning and inverse kinematics (task_2)

  • state_machine waits for a message on /start_sm, then sends the pick-and-place sequence to the planner as PlanAndExecute goals, one at a time: open the gripper, move above the object, descend, close the gripper, lift, move above the destination, descend, open the gripper, and back to the home configuration before the second object.

  • planner_ik loads the TIAGo URDF with the Robotics Toolbox for Python and executes each task:

    • move: interpolates between the current end-effector pose and a pose 15 cm above the target, then solves the inverse kinematics of the torso and the 7 arm joints (Newton–Raphson) for each waypoint;
    • lift / place: vertical motion of ±15 cm;
    • open_gripper / close_gripper and back_to_home: planned directly in joint space.

    The joint trajectories are sent to the torso, arm and gripper controllers through FollowJointTrajectory actions.

Task 3: learning from demonstration (task_3)

The course provided a dataset of joint-space trajectories recorded on a real TIAGo, with pick and place motions between several positions on a table. The dataset is not included in this repository.

  • planner_DMP replaces the planner of task 2 for the move task. For each target marker it selects one recorded demonstration, computes the end-effector trajectory with forward kinematics and fits a Cartesian DMP (movement_primitives). It then sets the current end-effector pose as the start and the pose above the marker as the goal, samples the generated trajectory and converts it to joint space with inverse kinematics.
  • state_DMP runs the same sequence as task 2 and also passes the marker id to the planner.
  • LbD.py is an offline script that fits a DMP to a single demonstration and plots the original and the generalised trajectories.

Repository structure

.
├── docs/
│   └── presentation.pdf          # final presentation (Italian)
├── my_bring_up/launch/
│   ├── action_app.launch.py      # tasks 1-2: scan, start configuration, trigger on /start_sm
│   └── task_3.launch.py          # task 3: scan and start configuration
├── personal_interfaces/          # MoveHead.action, PlanAndExecute.action, Attach.srv
├── task_1/task_1/                # head scan, ArUco localisation, grasp and place poses
├── task_2/task_2/                # state machine and IK planner, TIAGo URDF
└── task_3/task_3/                # DMP planner, state machine, offline LbD script, TIAGo URDF

Requirements

  • Ubuntu 22.04 with ROS 2 Humble.
  • The TIAGo simulation from pal-robotics/tiago_simulation (branch humble-devel) in a workspace such as ~/tiago_public_ws.
  • The course scene: a Gazebo world with a table, ArUco markers and the two objects, plus a modified tiago_gazebo.launch.py. Both were provided by the course and are not included here.
  • Python packages: roboticstoolbox-python, spatialmath-python, movement_primitives, pytransform3d, scipy, matplotlib, and OpenCV with the ArUco module. The code uses the ArUco API of OpenCV before 4.7, as shipped with Ubuntu 22.04.

Build

cd ~/tiago_public_ws/src
git clone https://github.com/Lebroms/Tiago_programming.git
cd ~/tiago_public_ws
colcon build --packages-select personal_interfaces task_1 task_2 task_3 my_bring_up
source install/setup.bash

Run

Start the simulation with the course scene:

ros2 launch tiago_gazebo tiago_gazebo.launch.py is_public_sim:=True

Tasks 1 and 2, each command in its own terminal. Start the planner and the state machine first: the launch file publishes the start trigger once, when the arm reaches the start configuration.

ros2 run task_2 planner_ik
ros2 run task_2 state_machine
ros2 launch my_bring_up action_app.launch.py

Task 3: the launch file does not publish the trigger, so it is sent by hand once the arm has stopped.

ros2 run task_3 planner_DMP --ros-args -p dataset_dir:=/path/to/tiago_traiettorie_SG
ros2 run task_3 state_DMP
ros2 launch my_bring_up task_3.launch.py
ros2 topic pub --once /start_sm std_msgs/msg/Empty "{}"

Notes

  • The system was tested only in simulation. Offsets, joint configurations and the demonstration used for each marker are tuned for the course scene.
  • In task 2, the interpolation in task space uses only a few waypoints, and obstacles are avoided through the order of the operations in the state machine rather than by the planner.
  • Code comments and log messages are in Italian.

About

ROS 2 pick-and-place for the TIAGo robot in Gazebo: ArUco object localisation, inverse-kinematics motion planning and learning from demonstration with DMPs

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages