mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
msg landing_gear: change type to int8
This commit is contained in:
parent
ee41e3181f
commit
aac9221d95
@ -3,4 +3,4 @@ uint64 timestamp # time since system start (microseconds)
|
||||
int8 LANDING_GEAR_UP = 1 # landing gear up
|
||||
int8 LANDING_GEAR_DOWN = -1 # landing gear down
|
||||
|
||||
float32 landing_gear
|
||||
int8 landing_gear
|
||||
|
||||
@ -773,7 +773,7 @@ MulticopterAttitudeControl::publish_actuator_controls()
|
||||
_actuators.control[1] = (PX4_ISFINITE(_att_control(1))) ? _att_control(1) : 0.0f;
|
||||
_actuators.control[2] = (PX4_ISFINITE(_att_control(2))) ? _att_control(2) : 0.0f;
|
||||
_actuators.control[3] = (PX4_ISFINITE(_thrust_sp)) ? _thrust_sp : 0.0f;
|
||||
_actuators.control[7] = _landing_gear_state.landing_gear;
|
||||
_actuators.control[7] = (float)_landing_gear_state.landing_gear;
|
||||
_actuators.timestamp = hrt_absolute_time();
|
||||
_actuators.timestamp_sample = _sensor_gyro.timestamp;
|
||||
|
||||
|
||||
@ -812,12 +812,11 @@ MulticopterPositionControl::run()
|
||||
// they might conflict with each other such as in offboard attitude control.
|
||||
publish_attitude();
|
||||
|
||||
if (_old_landing_gear_position != constraints.landing_gear) {
|
||||
_landing_gear_state.landing_gear =
|
||||
(constraints.landing_gear == vehicle_constraints_s::GEAR_UP) ?
|
||||
landing_gear_s::LANDING_GEAR_UP :
|
||||
landing_gear_s::LANDING_GEAR_DOWN;
|
||||
// if theres any change in landing gear setpoint publish it
|
||||
if (_old_landing_gear_position != constraints.landing_gear
|
||||
&& constraints.landing_gear != vehicle_constraints_s::GEAR_KEEP) {
|
||||
|
||||
_landing_gear_state.landing_gear = constraints.landing_gear;
|
||||
_landing_gear_state.timestamp = hrt_absolute_time();
|
||||
|
||||
if (_landing_gear_pub != nullptr) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user