Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mc_pos_control: pass on parameter metadata #21729

Merged
merged 5 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/modules/mc_pos_control/PositionControl/ControlMath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ void bodyzToAttitude(Vector3f body_z, const float yaw_sp, vehicle_attitude_setpo
Vector3f body_x = y_C % body_z;

// keep nose to front while inverted upside down
if (body_z(2) < 0.0f) {
if (body_z(2) < 0.f) {
body_x = -body_x;
}

if (fabsf(body_z(2)) < 0.000001f) {
// desired thrust is in XY plane, set X downside to construct correct matrix,
// but yaw component will not be used actually
body_x.zero();
body_x(2) = 1.0f;
body_x(2) = 1.f;
}

body_x.normalize();
Expand Down Expand Up @@ -201,7 +201,7 @@ bool cross_sphere_line(const Vector3f &sphere_c, const float sphere_r,
// we have triangle CDX with known CD and CX = R, find DX
float dx_len = sqrtf(sphere_r * sphere_r - cd_len * cd_len);

if ((sphere_c - line_b) * ab_norm > 0.0f) {
if ((sphere_c - line_b) * ab_norm > 0.f) {
// target waypoint is already behind us
res = line_b;

Expand All @@ -218,12 +218,12 @@ bool cross_sphere_line(const Vector3f &sphere_c, const float sphere_r,
res = d; // go directly to line

// previous waypoint is still in front of us
if ((sphere_c - line_a) * ab_norm < 0.0f) {
if ((sphere_c - line_a) * ab_norm < 0.f) {
res = line_a;
}

// target waypoint is already behind us
if ((sphere_c - line_b) * ab_norm > 0.0f) {
if ((sphere_c - line_b) * ab_norm > 0.f) {
res = line_b;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ void PositionControl::_velocityControl(const float dt)
_accelerationControl();

// Integrator anti-windup in vertical direction
if ((_thr_sp(2) >= -_lim_thr_min && vel_error(2) >= 0.0f) ||
(_thr_sp(2) <= -_lim_thr_max && vel_error(2) <= 0.0f)) {
if ((_thr_sp(2) >= -_lim_thr_min && vel_error(2) >= 0.f) ||
(_thr_sp(2) <= -_lim_thr_max && vel_error(2) <= 0.f)) {
vel_error(2) = 0.f;
}

Expand Down
2 changes: 1 addition & 1 deletion src/modules/mc_pos_control/Takeoff/TakeoffTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ TEST(TakeoffTest, RegularTakeoffRamp)
{
TakeoffHandling takeoff;
takeoff.setSpoolupTime(1.f);
takeoff.setTakeoffRampTime(2.0);
takeoff.setTakeoffRampTime(2.f);
takeoff.generateInitialRampValue(CONSTANTS_ONE_G / 0.5f);

// disarmed, landed, don't want takeoff
Expand Down
Loading
Loading