This project contains code and outputs for the ENPM662 final, including DH forward kinematics derivations, numeric validation, and an IK camera-tracking simulation with visualizations.
- Install uv (choose one)
brew install uv
# or
pipx install uv- Create/sync the environment
uv sync- Run
# Symbolic FK derivation + LaTeX output
uv run python src/q1_3.py
# DH vs geometric composition validation
uv run python src/q1_4.py
# IK camera-tracking simulation + plots
uv run python src/q1_sim.pysrc/q1_3.py: builds DH parameters with Sympy, computes A1~A6, T0_6, T0_EE, and prints LaTeX.src/q1_4.py: computes FK via DH and via geometric composition, then validates them numerically.src/q1_sim.py: IK solver, camera tracking path generation, error metrics, and visualization outputs.outputs/fig_layout_actor_path.png: XY layout of actor and camera paths.outputs/fig_joint_trajectories.png: joint trajectories for d0 and q2~q6 over time.outputs/fig_camera_path_with_arrows.png: 3D camera path with optical axis arrows.
- Use the standard DH form A = Rz(theta) * Tz(d) * Tx(a) * Rx(alpha).
- Build A1~A6 from the given DH table.
- Add the fixed camera offset
T6_EE = Tx(Lc) * Ty(-hc)to obtainT0_EE. - Print all intermediate matrices and LaTeX strings for reporting.
- Multiply the DH chain to get
T_dh. - Build
T_geofrom the equivalent geometric sequence of transforms. - Compare numeric test cases to confirm FK consistency and rotation orthonormality.
- Generate the actor's staircase arc path, then derive desired camera positions and view directions along the path.
- IK is solved in two stages:
- Position IK: damped least-squares to reach the desired camera position.
- Pointing IK: refine with optical-axis direction error.
- Solve joints at each timestep, then wrap/unwrap angles for continuity.
- Generate path and joint trajectory plots, and print summary error metrics.