This project focuses on controlling a 7-DOF redundant manipulator (KUKA LBR iiwa) to track Cartesian trajectories while avoiding obstacles in real time.
The main idea is simple but powerful:
- Use CLIK (Closed-Loop Inverse Kinematics) for tracking
- Exploit redundancy to handle obstacle avoidance in the null space
The system is implemented in MATLAB and simulated in CoppeliaSim via the ZeroMQ Remote API.
Check the diagram above 👆
Pipeline:
- A Cartesian trajectory is defined
- A PI controller generates desired velocity
- CLIK maps it to joint velocities
- A secondary objective handles obstacle avoidance
👉 Key idea:
Obstacle avoidance is handled in the null space, so it does not interfere with the main tracking task.
[ \dot{q} = J^\dagger v + (I - J^\dagger J) z ]
- First term → tracking
- Second term → null-space action (avoidance)
- Cartesian PI controller
- Waypoint tracking
- Velocity saturation
- Repulsive action from obstacles
- Adds tangential motion
- Prevents local minima
- Damped Least Squares → stable near singularities
- Task relaxation → reduces tracking priority near obstacles
- Anti-stall mechanism → helps escape stuck situations
- Stable tracking
- No collisions
- Smooth motion
Metrics:
- Cartesian error
- Minimum distance
- Joint velocities
addpath('src')Load:
sim/kuka_scene.ttt
run('src/main_avoidance.m')KUKA-iiwa-Obstacle-Avoidance/
├── src/ # MATLAB source code (core logic)
│ ├── main_avoidance.m # Main script: runs simulation and control loop
│ ├── controller_nullspace.m # Implements CLIK + null-space control law
│ ├── RemoteAPIClient.m # Interface with CoppeliaSim (ZeroMQ)
│ └── cbor.m # Serialization utility for communication
│
├── model/ # Robot model definition
│ ├── kukanomesh.urdf # URDF used in MATLAB
│ └── meshes/ # STL mesh files for visualization
│
├── sim/ # Simulation environment
│ └── kuka_scene.ttt # CoppeliaSim scene (robot + obstacles)
│
├── control_scheme.png # Controller block diagram (this README)
├── kuka_avoidance.gif # Demo of the robot behavior
├── README.md # Documentation
└── LICENSE # MIT License
Giorgio De Santis
MSc AI & Robotics
MIT License

