|
@@ -281,9 +281,9 @@ class Planner {
|
281
|
281
|
* Calculate the distance (not time) it takes to accelerate
|
282
|
282
|
* from initial_rate to target_rate using the given acceleration:
|
283
|
283
|
*/
|
284
|
|
- static float estimate_acceleration_distance(float initial_rate, float target_rate, float acceleration) {
|
285
|
|
- if (acceleration == 0) return 0; // acceleration was 0, set acceleration distance to 0
|
286
|
|
- return (target_rate * target_rate - initial_rate * initial_rate) / (acceleration * 2);
|
|
284
|
+ static float estimate_acceleration_distance(float initial_rate, float target_rate, float accel) {
|
|
285
|
+ if (accel == 0) return 0; // accel was 0, set acceleration distance to 0
|
|
286
|
+ return (target_rate * target_rate - initial_rate * initial_rate) / (accel * 2);
|
287
|
287
|
}
|
288
|
288
|
|
289
|
289
|
/**
|
|
@@ -294,9 +294,9 @@ class Planner {
|
294
|
294
|
* This is used to compute the intersection point between acceleration and deceleration
|
295
|
295
|
* in cases where the "trapezoid" has no plateau (i.e., never reaches maximum speed)
|
296
|
296
|
*/
|
297
|
|
- static float intersection_distance(float initial_rate, float final_rate, float acceleration, float distance) {
|
298
|
|
- if (acceleration == 0) return 0; // acceleration was 0, set intersection distance to 0
|
299
|
|
- return (acceleration * 2 * distance - initial_rate * initial_rate + final_rate * final_rate) / (acceleration * 4);
|
|
297
|
+ static float intersection_distance(float initial_rate, float final_rate, float accel, float distance) {
|
|
298
|
+ if (accel == 0) return 0; // accel was 0, set intersection distance to 0
|
|
299
|
+ return (accel * 2 * distance - initial_rate * initial_rate + final_rate * final_rate) / (accel * 4);
|
300
|
300
|
}
|
301
|
301
|
|
302
|
302
|
/**
|
|
@@ -304,8 +304,8 @@ class Planner {
|
304
|
304
|
* to reach 'target_velocity' using 'acceleration' within a given
|
305
|
305
|
* 'distance'.
|
306
|
306
|
*/
|
307
|
|
- static float max_allowable_speed(float acceleration, float target_velocity, float distance) {
|
308
|
|
- return sqrt(target_velocity * target_velocity - 2 * acceleration * distance);
|
|
307
|
+ static float max_allowable_speed(float accel, float target_velocity, float distance) {
|
|
308
|
+ return sqrt(target_velocity * target_velocity - 2 * accel * distance);
|
309
|
309
|
}
|
310
|
310
|
|
311
|
311
|
static void calculate_trapezoid_for_block(block_t* block, float entry_factor, float exit_factor);
|