forked from Archive/PX4-Autopilot
Remove exception of actuator scaling for airships (#16011)
This removes the exception handling of airship type vehicles when scaling actuators for the simulator
This commit is contained in:
parent
d91d7e3282
commit
46d79d3050
|
@ -89,7 +89,8 @@ mavlink_hil_actuator_controls_t Simulator::actuator_controls_from_outputs()
|
|||
int _system_type = _param_mav_type.get();
|
||||
|
||||
/* scale outputs depending on system type */
|
||||
if (_system_type == MAV_TYPE_QUADROTOR ||
|
||||
if (_system_type == MAV_TYPE_AIRSHIP ||
|
||||
_system_type == MAV_TYPE_QUADROTOR ||
|
||||
_system_type == MAV_TYPE_HEXAROTOR ||
|
||||
_system_type == MAV_TYPE_OCTOROTOR ||
|
||||
_system_type == MAV_TYPE_VTOL_DUOROTOR ||
|
||||
|
@ -102,6 +103,7 @@ mavlink_hil_actuator_controls_t Simulator::actuator_controls_from_outputs()
|
|||
unsigned n;
|
||||
|
||||
switch (_system_type) {
|
||||
case MAV_TYPE_AIRSHIP:
|
||||
case MAV_TYPE_VTOL_DUOROTOR:
|
||||
n = 2;
|
||||
break;
|
||||
|
@ -143,25 +145,6 @@ mavlink_hil_actuator_controls_t Simulator::actuator_controls_from_outputs()
|
|||
}
|
||||
}
|
||||
|
||||
} else if (_system_type == MAV_TYPE_AIRSHIP) {
|
||||
/* airship: scale starboard and port throttle to 0..1 and other channels (tilt, tail thruster) to -1..1 */
|
||||
for (unsigned i = 0; i < 16; i++) {
|
||||
if (armed) {
|
||||
if (i < 2) {
|
||||
/* scale PWM out PWM_DEFAULT_MIN..PWM_DEFAULT_MAX us to 0..1 for rotors */
|
||||
msg.controls[i] = (_actuator_outputs.output[i] - PWM_DEFAULT_MIN) / (PWM_DEFAULT_MAX - PWM_DEFAULT_MIN);
|
||||
|
||||
} else {
|
||||
/* scale PWM out PWM_DEFAULT_MIN..PWM_DEFAULT_MAX us to -1..1 for other channels */
|
||||
msg.controls[i] = (_actuator_outputs.output[i] - pwm_center) / ((PWM_DEFAULT_MAX - PWM_DEFAULT_MIN) / 2);
|
||||
}
|
||||
|
||||
} else {
|
||||
/* set 0 for disabled channels */
|
||||
msg.controls[i] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
/* fixed wing: scale throttle to 0..1 and other channels to -1..1 */
|
||||
|
||||
|
|
Loading…
Reference in New Issue