Skip to content

3-DOF Manipulator Kinematics, Trajectory Planning, and Simulation Optimization

GitHub: 3 Axis Robot

Project Overview

In this project, I developed the kinematic analysis, trajectory planning algorithms, and high-resolution simulation integration for a 3-axis (3-DOF) robotic manipulator with revolute joints that can autonomously follow trajectories and draw letters in Cartesian space.

To meet the project’s main objectives, I designed the system’s mathematical and algorithmic foundations entirely around three-axis spatial geometry. The end effector can move only along the translational coordinates XX, YY, and ZZ. To use an industrial-standard model and enrich the visuals, I used the 6-axis UR5 in the simulation interface. The simulation shows 6-axis hardware, but I locked the orientation matrices in software to constrain it to three-axis operation and calculated all iterative solutions using error functions restricted to these three degrees of freedom.

Kinematic Model and Reduction Strategy

1. Forward Kinematics

To calculate the end effector’s position in three-dimensional space, I used Denavit–Hartenberg (DH) homogeneous transformation matrices (AiA_i). I defined the general DH matrix for the transformation between successive axes as follows:

Ai=[cos⁡θi−sin⁡θicos⁡αisin⁡θisin⁡αiaicos⁡θisin⁡θicos⁡θicos⁡αi−cos⁡θisin⁡αiaisin⁡θi0sin⁡αicos⁡αidi0001] A_i = \begin{bmatrix} \cos\theta_i & -\sin\theta_i\cos\alpha_i & \sin\theta_i\sin\alpha_i & a_i\cos\theta_i \\ \sin\theta_i & \cos\theta_i\cos\alpha_i & -\cos\theta_i\sin\alpha_i & a_i\sin\theta_i \\ 0 & \sin\alpha_i & \cos\alpha_i & d_i \\ 0 & 0 & 0 & 1 \end{bmatrix}

The forward kinematics equation is the product of successive matrices from the base coordinate frame to the end effector. Because I constrained the system mathematically to three axes, the basic translation equation took the following form:

T03(q)=A1(q1)⋅A2(q2)⋅A3(q3) T_0^3(q) = A_1(q_1) \cdot A_2(q_2) \cdot A_3(q_3)

2. Inverse Kinematics

I used the Levenberg–Marquardt (LM) numerical solver to calculate the joint angles (qq) needed to reach the trajectory points specified in Cartesian space. The LM algorithm minimizes the error in the objective function using the following damped, Jacobian-based iteration:

qk+1=qk+(JTJ+λdiag(JTJ))−1JTe q_{k+1} = q_k + (J^T J + \lambda \text{diag}(J^T J))^{-1} J^T e

Compared with the traditional Newton–Raphson method, this approach prevented the solver from getting stuck near singularities and provided much more stable convergence. I also adjusted the joint limits to prevent physically invalid configurations.

Robot Arm Simulation

Trajectory Planning Challenges and Optimizations

1. Null-Space Issues and Three-Axis Reduction

Problem: When I passed only position data (X,Y,ZX, Y, Z) as a target to the UR5 model in the simulation, I noticed that the inverse kinematics solver changed the orientation to eliminate the position error. This null-space issue caused the robot’s wrist axes to rotate suddenly by 180 degrees and its elbow to flip unexpectedly, producing dangerous jumps.

Solution: To keep the system at 3 DOF and prevent jumps, I applied a task-space constraint. I read the rotation matrix (RfixedR_{fixed}) at the robot’s safe home position and locked it. I then added this fixed orientation to the target coordinates. This let me mathematically reduce the 6-axis hardware to a three-axis mechanism.

2. Trajectory Jumps and Hybrid Planning

Problem: After the robot finished drawing a letter, moving it directly to a different, nonconsecutive starting coordinate produced undefined accelerations and sudden velocity jumps in joint space.

Solution: To smooth these accelerations, I developed a hybrid trajectory planning strategy. I used Cartesian-space interpolation (ctraj) for the end effector’s active drawing strokes, and joint-space interpolation (jtraj) for transitions between letters and moves to the starting point. This kept the angular velocities linear and controlled.

3. Singularities and Self-Collision

Problem: When I placed the center of trajectories requiring a large workspace, such as the infinity symbol, near the workspace boundary (the maximum reach radius), the arm fully extended and reached a kinematic singularity. As the solver tried to reach solutions of the kinematic equations and escape this configuration, the solid models intersected in a physically impossible way (self-collision).

Solution: I used manipulability ellipsoid analysis to find the point where the robot’s elbow had the greatest flexibility. I moved all trajectory centers to X=0.35mX=0.35m and Z=0.20mZ=0.20m, mathematically restricting the arm’s workspace to keep it within safe bending limits.

Simulation Dynamics and Object Pooling Architecture

In the high-resolution Swift simulation environment, creating thousands of spherical points on the fly to leave a trajectory trace led to memory leaks and CPU bottlenecks.

To minimize this overhead, I used a technique called object pooling:

  • When the simulation started, I allocated all 800 objects in memory at once and moved them out of the scene (below ground, at Z=−5mZ=-5m).
  • While drawing, I read the end effector’s current position from the forward kinematics matrix and moved the objects to the corresponding coordinates.
  • By eliminating the garbage collector’s workload, I achieved a smooth simulation with a high frame rate.

Visual Simulation

Conclusion

This project demonstrates how a basic three-degree-of-freedom kinematic model can be simulated on a professional 6-axis industrial manipulator such as the UR5 using suitable limiting algorithms and task-space constraints. I resolved the null-space lockups and singularity problems in inverse kinematics by fixing the orientation and optimizing the workspace. The result was a trajectory planning system that met the theoretical requirements and used a software architecture aligned with industry standards.

In this project, I demonstrated in practice how a basic three-degree-of-freedom kinematic model can be simulated stably on a professional 6-axis industrial manipulator using suitable limiting algorithms and task-space constraints. By overcoming the null-space lockups, singularities, and optimization problems I encountered, I developed a trajectory planning system that met my theoretical objectives.