vehicles: add new vehicle type: Airship (#14862)

Co-authored-by: Anton Erasmus <anton@flycloudline.com>
Co-authored-by: Beat Küng <beat-kueng@gmx.net>
This commit is contained in:
Daniel Leonard Robinson
2020-08-10 08:52:51 +02:00
committed by GitHub
parent 454433c2ef
commit fa4818e467
18 changed files with 687 additions and 2 deletions

View File

@@ -143,6 +143,25 @@ 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 */