mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
VelocitySmoothing - Get rid of math.h, math.cpp and px4_defines dependencies
This commit is contained in:
parent
ddab0ccdf1
commit
b9cf4dfb6c
@ -35,8 +35,6 @@
|
||||
|
||||
#include <cstdio>
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include <px4_defines.h>
|
||||
|
||||
#include <mathlib/mathlib.h>
|
||||
|
||||
@ -210,22 +208,22 @@ void VelocitySmoothing::updateDurations(float T123)
|
||||
_max_jerk_T1 = (_vel_sp - _vel > 0.f) ? _max_jerk : -_max_jerk;
|
||||
|
||||
// compute increasing acceleration time
|
||||
if (PX4_ISFINITE(T123)) {
|
||||
T1 = computeT1(T123, _accel, _vel, _vel_sp, _max_jerk_T1);
|
||||
if (T123 < 0.f) {
|
||||
T1 = computeT1(_accel, _vel, _vel_sp, _max_jerk_T1);
|
||||
|
||||
} else {
|
||||
T1 = computeT1(_accel, _vel, _vel_sp, _max_jerk_T1);
|
||||
T1 = computeT1(T123, _accel, _vel, _vel_sp, _max_jerk_T1);
|
||||
}
|
||||
|
||||
// compute decreasing acceleration time
|
||||
T3 = computeT3(T1, _accel, _max_jerk_T1);
|
||||
|
||||
// compute constant acceleration time
|
||||
if (PX4_ISFINITE(T123)) {
|
||||
T2 = computeT2(T123, T1, T3);
|
||||
if (T123 < 0.f) {
|
||||
T2 = computeT2(T1, T3, _accel, _vel, _vel_sp, _max_jerk_T1);
|
||||
|
||||
} else {
|
||||
T2 = computeT2(T1, T3, _accel, _vel, _vel_sp, _max_jerk_T1);
|
||||
T2 = computeT2(T123, T1, T3);
|
||||
}
|
||||
|
||||
_T1 = T1;
|
||||
|
||||
@ -33,8 +33,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <matrix/matrix/math.hpp>
|
||||
|
||||
/**
|
||||
* @class VelocitySmoothing
|
||||
*
|
||||
@ -115,6 +113,9 @@ public:
|
||||
static void timeSynchronization(VelocitySmoothing *traj, int n_traj);
|
||||
|
||||
float getTotalTime() const { return _T1 + _T2 + _T3; }
|
||||
float getT1() const { return _T1; }
|
||||
float getT2() const { return _T2; }
|
||||
float getT3() const { return _T3; }
|
||||
float getVelSp() const { return _vel_sp; }
|
||||
|
||||
private:
|
||||
@ -124,7 +125,7 @@ private:
|
||||
* @param T123 optional parameter. If set, the total trajectory time will be T123, if not,
|
||||
* the algorithm optimizes for time.
|
||||
*/
|
||||
void updateDurations(float T123 = NAN);
|
||||
void updateDurations(float T123 = -1.f);
|
||||
/**
|
||||
* Compute increasing acceleration time
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user