ROS 2 Humble workspace for the TE3001B Fundamentacion de Robotica laboratory series. This repository contains two independent ROS 2 packages that implement and compare different control strategies on the UFACTORY xArm Lite 6 six-degree-of-freedom manipulator, using MoveIt Servo as the hardware interface.
Course: TE3001B.101 — Fundamentacion de Robotica (Gpo 101) Institution: Tecnologico de Monterrey Team: Team Funcionaba Ayer
- David Alejandro Soni Cuevas (A01571777)
- Abraham de Jesus Maldonado Mata (A00838581)
- David Gilberto Lomeli Leal (A01571193)
- Irvin David Ornelas Garcia (A00839065)
Professor: Nezih Nieto Gutierrez
- Repository Overview
- Hardware
- Prerequisites and Dependencies
- Repository Structure
- Build Instructions
- Packages
- Common Launch Sequence
- Data and Results
- Documentation
- Known Issues and Workarounds
This repository implements and evaluates two control paradigms on the xArm Lite 6:
| Package | Lab / Challenge | Control Strategy | Task |
|---|---|---|---|
xarm_ctc_challenge |
Challenge 4.1 | CTC (model-based) vs Cartesian PD (model-free) | PCB component placement — 2x2 grid, quintic spline trajectory |
xarm_perturbations |
Lab 4.2 | Cartesian PD/PID | Lissajous / inspection trajectory under baseline, sinusoidal, and Gaussian perturbations |
Both packages interface with the robot through MoveIt Servo's velocity command
interface, publishing TwistStamped or JointJog messages at 100 Hz.
- Robot: UFACTORY xArm Lite 6 (6-DOF collaborative manipulator)
- Connection: Ethernet, static IP
192.168.1.154 - Control PC: Ubuntu 22.04, ROS 2 Humble
- Robot mode before running: Mode 1, State 0 (velocity servo mode)
Verify connectivity before any experiment:
ping 192.168.1.154System:
- Ubuntu 22.04 LTS
- ROS 2 Humble Hawksbill (full desktop install)
- Python 3.10+
Python packages (inside your environment):
pip install numpy pandas matplotlib scipyROS 2 packages (sourced from workspace):
moveit_ros_planning_interfacemoveit_servotf2_ros,tf2_geometry_msgscontrol_msgs,sensor_msgs,geometry_msgsxarm_ros2(included as a git submodule atros2_ws/src/xarm_ros2/)
TE3001B_Control/
|-- README.md This file
|-- LICENSE
|-- .gitmodules Submodule: xarm_ros2
|
|-- docs/
| |-- Robotics_Control_Challenge_4.1/
| | |-- Instructions/
| | |-- Robotics Control Challenge 4.1-1.pdf
| | |-- CTCvsPID.ipynb
| | `-- TE300XB-5.pdf
| |-- Robotics_Control_Lab_4.1/
| | `-- code_documentation/ Auto-generated per-module docs
| `-- Robotics_Control_Lab_4.2/
| |-- code_documentation/ Auto-generated per-module docs
| `-- Report/
| `-- Robotics Control Lab 4.2.pdf
|
|-- data/ Trial results (CSV, PNG, JSON)
| |-- trial_ctc_nopert_*.csv
| |-- trial_ctc_pert_*.csv
| |-- trial_pdpid_nopert_*.csv
| |-- trial_pdpid_pert_*.csv
| |-- *_metadata.json
| |-- joints_*.png
| |-- taskspace_*.png
| |-- phase_*.png
| |-- comparison_*.png
| |-- summary_table.png
| `-- metrics_summary.csv
|
`-- ros2_ws/ ROS 2 Humble colcon workspace
|-- README.md Workspace build notes
`-- src/
|-- xarm_ctc_challenge/ Challenge 4.1 — see package README
|-- xarm_perturbations/ Lab 4.2 — see package README
|-- xarm_ros2/ xArm driver (git submodule)
`-- gazebo_mujoco_bridge/ Simulation bridge (skip in build)
If cloning for the first time, initialize the xarm_ros2 submodule:
git submodule update --init --recursivecd ros2_ws
colcon build --packages-skip gazebo_mujoco_bridge mbot_demoIf the build fails with ModuleNotFoundError: No module named 'catkin_pkg', conda
is intercepting CMake's Python lookup. Fix by installing catkin_pkg in the active
conda environment:
pip install catkin_pkgAlternatively, deactivate conda before building and reactivate afterwards:
conda deactivate
colcon build --packages-skip gazebo_mujoco_bridge mbot_demo
conda activate <your_env>Run this in every terminal that needs to use the ROS 2 packages:
source ros2_ws/install/setup.bashFull documentation: ros2_ws/src/xarm_ctc_challenge/README.md
Implements and compares two joint-space controllers for a PCB component-placement task:
- CTC (Computed Torque Control): Model-based feedforward (M, C, G, F) with PD error correction and a robust sliding-mode term. Nominal link dynamics are derived from xArm Lite 6 URDF parameters.
- Cartesian PD: Model-free proportional-derivative control on TF2 end-effector position error. Simple, stable, and used as the reference baseline.
Both controllers use an online weighted resolved-rate IK solver (DLS pseudoinverse with null-space posture control) to convert Cartesian waypoints to joint references.
Four required trials:
- CTC, no perturbation
- CTC, Gaussian perturbation (sigma = 0.5 m/s on x-axis)
- PD, no perturbation
- PD, Gaussian perturbation
Full documentation: ros2_ws/src/xarm_perturbations/README.md
Implements Cartesian PD/PID control on Lissajous and inspection trajectories. Evaluates controller robustness under three perturbation conditions:
- Baseline (no perturbation)
- Sinusoidal (8 Hz deterministic disturbance)
- Gaussian white noise (sigma = 0.01 m/s)
Includes a perturbation injector node, a grid-search auto-tuner for Kp/Kd gains, and offline analysis scripts for RMSE computation and plot generation.
Every experiment requires MoveIt Servo to be running first. Open terminals in order:
Terminal 1 — MoveIt Servo (keep running for all experiments):
ros2 launch xarm_moveit_servo lite6_moveit_servo_realmove.launch.py \
robot_ip:=192.168.1.154Wait for the servo server to print Ready to accept commands. Then proceed with
the package-specific launch commands documented in each package's README.
Emergency stop (any terminal):
ros2 topic pub /challenge_stop std_msgs/Bool "data: true" --onceExperimental data from Challenge 4.1 is stored in data/ and archived in data.zip.
Summary of results (Challenge 4.1):
| Trial | RMSE EE | Max EE Error | Waypoint Success Rate |
|---|---|---|---|
| CTC, no perturbation | 29.4 mm | — | — |
| CTC, with perturbation | ~35.3 mm | — | — |
| PD, no perturbation | 29.2 mm | — | — |
| PD, with perturbation | ~38.9 mm | — | — |
CTC shows approximately 20% error increase under perturbation versus approximately 33% for Cartesian PD, demonstrating the robustness advantage of the model-based approach.
Phase portrait analysis shows asymptotically stable spiral convergence in joint error space, with estimated damping ratio of approximately 0.89 for both controllers under nominal conditions.
Additional documentation is available under docs/:
| Path | Contents |
|---|---|
docs/Robotics_Control_Challenge_4.1/Instructions/ |
Challenge specification PDF and reference notebook |
docs/Robotics_Control_Lab_4.1/code_documentation/ |
Auto-generated per-module documentation for Lab 4.1 |
docs/Robotics_Control_Lab_4.2/code_documentation/ |
Auto-generated per-module documentation for Lab 4.2 |
docs/Robotics_Control_Lab_4.2/Report/ |
Final lab report PDF |
catkin_pkg not found during colcon build:
Conda environments intercept CMake's Python executable, causing catkin_pkg import
failures. Fix: pip install catkin_pkg inside the active conda environment.
Joint state updates at ~10 Hz instead of 100 Hz:
The xArm hardware driver publishes /joint_states at approximately 10 Hz. The CTC
controller node uses a first-order state predictor to extrapolate joint positions
between updates, maintaining smooth 100 Hz control output.
MoveIt Servo velocity scaling (~22% effective): MoveIt Servo internally publishes joint commands at 2 ms intervals, while the control loop runs at 10 ms. Effective Cartesian velocity is approximately 22% of the commanded value. IK task-space gains (K_TASK = 20) and velocity limits are set to compensate for this scaling.
Wrist singularity (joint 5 near 0 rad):
The position Jacobian becomes near-singular when joint 5 approaches zero. The
controller scales Cartesian velocity commands by clip(|q5| / 0.20, 0.05, 1.0)
to prevent command blow-up, reaching minimum 5% velocity at the singular configuration.
Analysis script Python environment: The analysis script requires numpy/pandas/matplotlib. If the ROS 2 Python environment has version conflicts, run with miniconda Python directly:
PYTHONPATH=ros2_ws/src/xarm_ctc_challenge \
~/miniconda3/bin/python3 \
ros2_ws/src/xarm_ctc_challenge/xarm_ctc_challenge/analysis.py \
data/