# Architecture & Mathematical Reference

## 1. 6-DOF Puma 560 Kinematics (`src/kinematics_app/ManipulatorApp.m`)

The interactive App Designer application models a 6-DOF Puma 560 manipulator using MathWorks Robotics System Toolbox (`loadrobot('puma560')`) and a planar 2-link + vertical prismatic helper:

- **Planar Pose Helper:**
  $$x = L_1 \cos\theta_1 + L_2 \cos(\theta_1 + \theta_2), \quad y = L_1 \sin\theta_1 + L_2 \sin(\theta_1 + \theta_2), \quad z = \theta_3$$
- **Forward Kinematics & Singularity Check:** Evaluates `getTransform(robot, q, 'link4')` and probes near-singular configurations using `abs(det(geometricJacobian(robot, q, 'link6'))) < 1e-6`.
- **Inverse Kinematics & Workspace Gate:** Validates targets against $0.5 \le r \le 1.0\text{ m}$, $-90^\circ \le \theta \le 90^\circ$, and $z \ge 0\text{ m}$ before solving `inverseKinematics` on `link6`.

## 2. Quintic Trajectory Planning (`src/trajectory_planning/quintic_trajectory.m`)

Solves the 6×6 boundary-value linear system $A\mathbf{a} = \mathbf{b}$ for a 5th-order polynomial:

$$q(t) = a_5 t^5 + a_4 t^4 + a_3 t^3 + a_2 t^2 + a_1 t + a_0$$

enforcing position, velocity, and acceleration at $t_0 = 3\text{ s}$ and $t_f = 8\text{ s}$ for smooth rest-to-rest motion from $0$ to $\pi/2\text{ rad}$.

## 3. Workshop Manipulators (`src/workshops/`)

- **`nao_seriallink_demo.m`**: 2-DOF Prismatic–Revolute (`NAO_ROB`) arm with $d_1 \in [0, 5]\text{ m}$, $\alpha_1 = \pi/2$, and $a_2 = 3\text{ m}$.
- **`puma560_ik_demo.m`**: Closed-form `ikine6s` solution for $T = \mathrm{transl}(0.6, 0.1, 0)\,\mathrm{rpy2tr}(0, 180^\circ, 0)$ with `trplot` frame overlay and FK verification.
