This project simulates a UR3 robot performing a pick-and-place task using inverse kinematics (IK) and seven-segment motion planning. The key focus areas are:
-
Kinematic Definitions: Using transformation matrices
$(SE(3))$ for defining the robot’s task-space targets. - Inverse Kinematics: Calculation of joint angles for the end-effector at key positions.
- Seven-Segment Motion Planning: Smooth trajectory generation using a kinematic planning model that optimizes acceleration and deceleration phases.
- PyBullet Simulation: Visualizing the robot's motion using a physics engine.
- Python 3.x
- Required libraries: Install the necessary Python packages by running:
pip install roboticstoolbox-python spatialmath matplotlib numpy pybullet
Clone this repository and navigate into the project directory:
git clone https://github.com/Aminsaffar/Arm-Robot-Pick-and-Place.git
cd Arm-Robot-Pick-and-Place
To run the project, follow these steps:
- Ensure that all necessary dependencies are installed.
- Run the script by executing:
python Arm-Robot-Pick-and-Place.py
- The program will simulate the UR3 robot's pick-and-place task with a smooth seven-segment trajectory in PyBullet. It will also plot various kinematic properties (e.g., joint angles, velocities, accelerations, and jerks).
.
├── README.md # This file
├── Arm-Robot-Pick-and-Place.py # Main Python script for the project
├── plots/ # Folder where generated plots are saved
├── results/ # Folder to store simulation logs or output data
└── URDFs/ # URDF files for the UR3 robot and other objects (table, block)
Goal: Calculate joint angles that position the end-effector at specific task-space locations.
-
Transformation Matrices
$(SE(3))$ : Define the key positions using homogeneous transformation matrices$(SE(3))$ , which include translation and rotation information for the UR3's end-effector in 3D space.For each key point
$\mathbf{T}$ :
T = | R t |
| 0 1 |
Where:
-
$\mathbf{R}$ is the$3 \times 3$ rotation matrix. -
$\mathbf{t}$ is the$3 \times 1$ translation vector.
-
Key Points: Define transformation matrices for the following key points:
- Start (home position):
$\mathbf{T}_{home}$ - Pick position:
$\mathbf{T}_{pick}$ - Place position:
$\mathbf{T}_{place}$
- Start (home position):
-
Inverse Kinematics: Using the Levenberg-Marquardt method (IK_LM), solve the joint angles
$\mathbf{q}$ for each target pose:$\mathbf{q} = IK(\mathbf{T})$ where$\mathbf{q}$ is the vector of joint angles$\left[q_1, q_2, \dots, q_6\right]$ .
Goal: Generate a smooth trajectory for each joint that consists of acceleration, constant velocity, and deceleration phases.
-
Motion Phases: The trajectory is divided into seven segments for each joint.
- Segment 1–3: Acceleration phase.
- Segment 4: Constant velocity phase.
- Segment 5–7: Deceleration phase.
-
Velocity, Acceleration, and Time:
-
Maximum Velocity:
$V_{\text{max}}$ -
Maximum Acceleration:
$A_{\text{max}}$ -
Distance between joint positions:
$\Delta q$
-
Maximum Velocity:
-
Phase Calculations:
- Total time for the motion:
$T = \frac{\Delta q}{V_{\text{max}}}$ - Time for the acceleration phase
$T_{a}$ and deceleration phase$T_{d}$ (assuming symmetric motion):$T_a = T_d = \frac{V_{\text{max}}}{A_{\text{max}}}$ - Time for the constant velocity phase
$T_{c}$ :$T_c = T - 2T_a$
- Total time for the motion:
-
Trajectory Generation:
- For each phase, position, velocity, and acceleration are computed using these formulas:
-
Acceleration phase
$(0 \leq t \leq T_a)$ :$q(t) = \frac{1}{2}A_{\text{max}}t^2$ -
Constant velocity phase
$(T_a \leq t \leq T_c)$ :$q(t) = V_{\text{max}}t + q(T_a)$ -
Deceleration phase
$(T_c \leq t \leq T)$ :$q(t) = q(T_c) - \frac{1}{2}A_{\text{max}}(t - T_c)^2$
-
- For each phase, position, velocity, and acceleration are computed using these formulas:
-
Interpolation: After calculating the trajectory for each joint, the positions are interpolated to ensure synchronization between all joints, ensuring that no joint exceeds its maximum velocity or acceleration limits.
Goal: Simulate the robot performing the task and visualize its motion.
-
Load URDF Models: Load the UR3 robot's URDF file and other objects (such as the table and block) into the PyBullet environment.
-
Apply Joint Trajectories: For each time step, apply the computed joint angles from the seven-segment trajectory to the robot.
-
Real-time Visualization: The simulation shows the robot moving smoothly according to the generated trajectory.
After running the simulation, the following data is plotted:
-
Joint Angles
$q_i(t)$ over time for all six joints. -
Joint Velocities
$\dot{q}_i(t)$ , Accelerations$\ddot{q}_i(t)$ , and Jerks$\dddot{q}_i(t)$ showing smooth transitions. - End-Effector Trajectory: 3D path followed by the robot’s end-effector in Cartesian space.
The following graphs are generated by the program and saved in the plots/
folder:
- Joint Angles during the pick-and-place task.
- Joint Velocities, Accelerations, and Jerks showing smooth transitions between phases.
- End-Effector Trajectory visualized in 3D space.
A real-time simulation of the robot’s motion using PyBullet, visualizing the UR3 robot's interaction with the environment.
This project is licensed under the MIT License - see the LICENSE file for details.
- Robotics Toolbox for Python by Peter Corke, used for kinematic modeling.
- PyBullet for providing the physics-based simulation environment.