Make your own Joint Trajectory Controller - Trapezoidal Planner in ROS2
- Karan Bhakuni
- Dec 8, 2024
- 3 min read
Updated: Mar 7
1 Introduction
Trajectory planning is a fundamental concept in robotics that involves determining a path for a robot to follow from an initial state to a desired end state over time. This typically involves specifying the position, velocity, and acceleration of the robot’s joint or end effector at each moment of the motion.
2 Types of Trajectory Planning
2.1. Based on Space
• Joint Space Trajectory Planning:
– The trajectory is planned for each joint of the robot independently.
– The motion is defined in terms of joint angles, velocities, and accelerations.
– Advantage: Easier to compute because it directly controls joint movements.
– Example: A robotic arm moves from one set of joint angles to another.
• Cartesian Space Trajectory Planning:
– The trajectory is defined in the Cartesian (workspace) coordinates, such as position (x, y, z) and orientation (roll, pitch, yaw).
– Useful for controlling the end effector of a robot to follow a specific path.
– Advantage: Direct control over the robot’s end-effector path in the workspace.
– Example: A robotic hand moves in a straight line from one point to another in 3D space.
2.2. Based on Velocity Profiles
• Trapezoidal Velocity Profile:
– The velocity follows a trapezoidal profile with three phases: acceleration, constant velocity, and deceleration.
– Advantage: Smooth acceleration and deceleration, avoids jerky motion.
– Example: A robot moves from one point to another with linear acceleration, constant speed, and deceleration.
• S-Curve Velocity Profile:
– The velocity profile has an S-shape, with smooth transitions in acceleration and deceleration to avoid sudden changes (jerk).
– Advantage: Reduces mechanical stress by minimizing sudden forces.
– Example: Robots used in surgery or precision assembly tasks.
2.3. Based on Time Optimization
• Time-Optimal Trajectory Planning:
– The goal is to complete the trajectory in the minimum time possible, subject to the robot’s limits on velocity and acceleration.
– Advantage: Fast execution while adhering to physical constraints.
– Example: Industrial robots picking and placing objects in rapid succession.
• Minimum-Jerk Trajectory Planning:
– Focuses on minimizing the “jerk” (the rate of change of acceleration), leading to smoother and more natural motion.
– Advantage: Produces smoother paths, especially useful in human-robot interactions.
– Example: Humanoid robots that mimic human movement.
3 Trajectory Planning with Trapezoidal Velocity Profile in Joint Space
A trapezoidal velocity profile is a common method in trajectory planning that provides smooth motion by ensuring that the robot accelerates, maintains constant velocity, and decelerates as it moves between two points. In joint space, trajectory planning defines the motion in terms of the joint angles q(t), joint velocities ˙q(t), and joint accelerations ¨q(t) over time.
3.1 Key Phases of the Trapezoidal Velocity Profile
The trapezoidal velocity profile has three distinct phases:
1. Acceleration Phase: The robot’s joints accelerate from rest to a maximum velocity (vmax).
2. Constant Velocity Phase: The robot moves with constant velocity (vmax).
3. Deceleration Phase: The robot decelerates to stop at the target position.
3.2 Mathematical Representation of the Three Phases
4 Mathematical Implementation In Code
4.1 Initializing Trajectory
4.2 Generating Trajectory Points
5 Conclusion
Trapezoidal velocity profiles in joint space provide a balance between computational simplicity and smooth motion, making them a widely used method in robotic trajectory planning.
6 References
2. ROS2 Wiki
3. Robotics and Control by RK Mittal and IJ Nagrath
Comments