69 float stick_current = 0.0f;
70 float vel_sp_current = 0.0f;
71 float vel_sp_previous = 5.0f;
72 float vel = vel_sp_previous;
73 float acc_max_up = 5.0f;
74 float acc_max_down = 2.0f;
88 for (
int i = 0; i < 100; i++) {
108 vel_sp_previous = vel_sp_current;
109 vel_sp_current = 0.0f;
110 vel = vel_sp_previous;
121 float stick_current = 0.0f;
122 float vel_sp_current = 0.0f;
123 float vel_sp_previous = -5.0f;
124 float vel = vel_sp_previous;
125 float acc_max_up = 5.0f;
126 float acc_max_down = 2.0f;
140 for (
int i = 0; i < 100; i++) {
165 vel_sp_previous = vel_sp_current;
166 vel_sp_current = 0.0f;
167 vel = vel_sp_previous;
177 float stick_current = -1.0f;
178 float vel_sp_target = -5.0f;
179 float vel_sp_current = vel_sp_target;
180 float vel_sp_previous = 0.0f;
181 float vel = vel_sp_previous;
182 float acc_max_up = 5.0f;
183 float acc_max_down = 2.0f;
194 for (
int i = 0; i < 100; i++) {
214 vel_sp_previous = vel_sp_current;
215 vel_sp_current = vel_sp_target;
216 vel = vel_sp_previous;
226 float stick_current = 1.0f;
227 float vel_sp_target = 5.0f;
228 float vel_sp_current = vel_sp_target;
229 float vel_sp_previous = 0.0f;
230 float vel = vel_sp_previous;
231 float acc_max_up = 5.0f;
232 float acc_max_down = 2.0f;
243 for (
int i = 0; i < 100; i++) {
251 if (fabsf(vel_sp_current - vel_sp_target) <
FLT_EPSILON) {
268 vel_sp_previous = vel_sp_current;
269 vel_sp_current = vel_sp_target;
270 vel = vel_sp_previous;
bool accelerateDownwardFromBrake()
#define ut_declare_test_c(test_function, test_class)
int test_smooth_z(int argc, char *argv[])
void smoothVelFromSticks(float &vel_sp, const float dt)
Smooth velocity setpoint based on flight direction.
Base class to be used for unit tests.
int _tests_failed
The number of unit tests which failed.
virtual bool run_tests()
Override to run your unit tests.
void overwriteAccelerationDown(float acc_max_down)
void overwriteAccelerationUp(float acc_max_up)
Vector< float, 6 > f(float t, const Matrix< float, 6, 1 > &, const Matrix< float, 3, 1 > &)
#define ut_assert_true(test)
To assert specifically to true.
void overwriteJerkMax(float jerk_max)
ManualIntentionZ getIntention()
Get user intention.
float getMaxAcceleration()
Get max accleration.
bool accelerateUpwardFromBrake()
#define ut_run_test(test)
Runs a single unit test.