mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-09 11:10:35 +08:00
Refactor: Name manual_control_setpoint the same way everywhere
This commit is contained in:
committed by
Daniel Agar
parent
c6dd8bfcd6
commit
e9eae1bd76
@@ -52,17 +52,17 @@
|
||||
|
||||
int do_trim_calibration(orb_advert_t *mavlink_log_pub)
|
||||
{
|
||||
uORB::Subscription sub_man{ORB_ID(manual_control_setpoint)};
|
||||
uORB::Subscription manual_control_setpoint_sub{ORB_ID(manual_control_setpoint)};
|
||||
px4_usleep(400000);
|
||||
manual_control_setpoint_s sp{};
|
||||
bool changed = sub_man.updated();
|
||||
manual_control_setpoint_s manual_control_setpoint{};
|
||||
bool changed = manual_control_setpoint_sub.updated();
|
||||
|
||||
if (!changed) {
|
||||
mavlink_log_critical(mavlink_log_pub, "no inputs, aborting");
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
sub_man.copy(&sp);
|
||||
manual_control_setpoint_sub.copy(&manual_control_setpoint);
|
||||
|
||||
/* load trim values which are active */
|
||||
float roll_trim_active;
|
||||
@@ -83,15 +83,15 @@ int do_trim_calibration(orb_advert_t *mavlink_log_pub)
|
||||
/* set parameters: the new trim values are the combination of active trim values
|
||||
and the values coming from the remote control of the user
|
||||
*/
|
||||
float p = sp.y * roll_scale + roll_trim_active;
|
||||
float p = manual_control_setpoint.y * roll_scale + roll_trim_active;
|
||||
int p1r = param_set(param_find("TRIM_ROLL"), &p);
|
||||
/*
|
||||
we explicitly swap sign here because the trim is added to the actuator controls
|
||||
which are moving in an inverse sense to manual pitch inputs
|
||||
*/
|
||||
p = -sp.x * pitch_scale + pitch_trim_active;
|
||||
p = -manual_control_setpoint.x * pitch_scale + pitch_trim_active;
|
||||
int p2r = param_set(param_find("TRIM_PITCH"), &p);
|
||||
p = sp.r * yaw_scale + yaw_trim_active;
|
||||
p = manual_control_setpoint.r * yaw_scale + yaw_trim_active;
|
||||
int p3r = param_set(param_find("TRIM_YAW"), &p);
|
||||
|
||||
if (p1r != 0 || p2r != 0 || p3r != 0) {
|
||||
|
||||
Reference in New Issue
Block a user