Speed Profile Generation: The Constraint-Driven Approach
In this guide, we delve into the creation of speed profiles that scrupulously adhere to predefined physical limits. The conventional approach often involves formulating this as an optimization problem. Given a set of waypoints and a constant sampling distance , the problem can be stated as:
Where:
- is the speed at point
- is the total number of points
- is the maximum speed
- is the maximum lateral acceleration
- is the curvature at point
- is the maximum forward acceleration
- is the maximum braking deceleration
- is the constant sampling distance
Instead of using iterative optimization algorithms, like gradient descent or nonlinear programming, this article introduces a streamlined procedural method to solve this problem.
Speed Profile Simulator
Lateral-limited and Speed-limited
Forward and Backward Pass
Final Speed Profile
Why Speed Profiles Matter
In autonomous systems ranging from self-driving cars to warehouse robots, generating velocity plans that respect physical limits is crucial for safety and efficiency. This guide reveals a battle-tested method that enforces three critical constraints in just 3 computational passes.
1. Lateral Constraint Pass
The first step ensures that the vehicle's speed is limited by the maximum lateral acceleration it can handle while following a curved path. This is based on the relationship between speed, curvature, and lateral acceleration.
Mathematical Explanation:
The lateral acceleration of a vehicle moving along a curved path is given by:
Where:
- = speed of the vehicle (m/s)
- = radius of curvature (m)
Since curvature is the inverse of the radius (), we can rewrite the equation as:
To ensure the lateral acceleration does not exceed the maximum allowable lateral acceleration , the speed must satisfy:
If the curvature (straight path), the speed is limited only by the maximum speed .
Implementation:
- For each point along the path, calculate the speed limit based on the curvature:
2. Forward Pass (Acceleration Constraint)
The second step ensures that the vehicle does not exceed its maximum forward acceleration while speeding up. This is done by propagating the speed forward along the path, ensuring that the acceleration constraint is satisfied.
Mathematical Explanation:
The relationship between speed, acceleration, and distance is given by the kinematic equation:
Where:
- = final speed (m/s)
- = initial speed (m/s)
- = acceleration (m/s²)
- = distance traveled (m)
To ensure the vehicle does not exceed the maximum forward acceleration , the speed at each point must satisfy:
Implementation:
- Start with the initial speed .
- For each subsequent point , calculate the speed:
3. Backward Pass (Deceleration Constraint)
The third step ensures that the vehicle can safely decelerate to a stop or lower speed without exceeding its maximum braking deceleration. This is done by propagating the speed backward along the path.
Mathematical Explanation:
Using the same kinematic equation as above, but solving for the initial speed :
To ensure the vehicle does not exceed the maximum braking deceleration , the speed at each point must satisfy:
Implementation:
- Start with the final speed , where is the total number of points.
- For each preceding point , calculate the speed:
Why Avoid Traditional Optimization? The Procedural Advantage
Traditional optimization methods often rely on iterative solvers that can be computationally expensive and time-consuming. Usually there are not guarantees of convergence. By contrast, the constraint-driven approach outlined here offers a fast and efficient alternative that guarantees adherence to physical constraints.
Conventional Approach: Most speed profile methods formulate this as an optimization problem:
- Objective Function: Typically a cost function that balances speed, acceleration, and jerk
- Constraints: Physical constraints such as maximum speed, acceleration, and jerk
- Solver: Iterative optimization algorithms like gradient descent or nonlinear programming
Constraint-Driven Approach: The proposed method enforces constraints directly, avoiding the need for iterative optimization:
- O(N): The algorithm complexity is linear with the number of points along the path
- Guaranteed Convergence: The algorithm guarantees adherence to physical constraints
Additional Considerations
While this guide covers the fundamental constraints of lateral acceleration, forward acceleration, and braking deceleration, additional factors can be incorporated to refine the speed profile further:
-
Maximum Jerk: Jerk, the rate of change of acceleration, can be limited to improve ride comfort and reduce wear on mechanical components. This can be implemented by constraining the difference in acceleration between consecutive points.
-
Power Constraints: The power capabilities of the vehicle can impose additional constraints on the speed profile. These constraints can be translated into acceleration limits (as function of actual accelration and speed), ensuring that the vehicle operates within its power limits.
-
Dynamic Acceleration Limits: In real-world scenarios, acceleration limits can vary based on factors such as road conditions, payload, speed, and battery charge. By incorporating these dynamic constraints, the speed profile can be optimized for specific operating conditions.