2-DOF Manipulator — Model-Based Real-Time Control
MATLAB/Simulink and TI C2000 control stack: computed-torque, PD with gravity compensation, and joint/task-space transforms for millimetre-level trajectory tracking on a 5-link planar robot in real time.
1 · Overview & Motivation
This project—completed for ME403 — Introduction to Robotics (Spring 2024, Sabancı University)—developed a model-based real-time controller for a planar 2-DOF, 5-link manipulator.
Key goals:
- Achieve sub-millimetre end-effector accuracy on dynamic paths
- Bridge simulation (SIL) and embedded deployment (HIL) seamlessly
- Provide a re-usable MATLAB/Simulink template for undergraduate robotics labs
2 · Control Architecture
The stack follows a computed-torque framework augmented with a PD + gravity compensator.
Software is split into three Simulink model hierarchies that map 1-to-1 onto TI C2000 peripherals.
| Layer | Role | Runs On |
|---|---|---|
| Task-Space Planner | Generates x-y trajectories | Host PC (SIL/HIL) |
| Controller Core | Inverse kinematics + computed-torque PD | TI C2000 (HIL) |
| Motor Interface | PWM output + encoder decoding | TI C2000 (HIL) |
Control Loop (1 kHz)
- Trajectory Sample – desired end-effector pose
- Inverse Kinematics – joint targets (θdes, ẋdes)
- Computed-Torque Law – τ = M(q)[*]α + V + G
- PD + G Compensation – fine-tunes stiffness & damping
- PWM Generation – duty cycles to H-bridges
- Encoder Feedback – closes joint-space loop
% Simulink MATLAB Function: Computed-Torque PD
tau = M(q)*(qdd_des + Kd*(qd_des - qd) + Kp*(q_des - q)) ...
+ V(q, qd) + G(q);
3 · Simulation & Real-Time Testing
| Stage | Environment | Purpose |
|---|---|---|
| SIL | Simscape Multibody + MATLAB ODE45 | Verify kinematics, dynamics, and controller logic without I/O latency |
| Processor-in-the-Loop | TI C2000 F28379D + external mode | Measure computation time (< 180 µs / step) |
| HIL | Full manipulator with DC motors & optical encoders | Validate closed-loop tracking and load tolerance |
Total transition time from SIL to validated HIL: < 3 hours thanks to code-gen-friendly model structure.
Completed for ME403 — Introduction to Robotics (Spring 2024, Sabancı University).