mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-18 08:37:34 +08:00
simulator: remove strange disarmed PWM
Before that we would send -0.1 instead of just 0.0. First proposed by @lovettchris.
This commit is contained in:
@@ -127,7 +127,7 @@ mavlink_hil_actuator_controls_t Simulator::actuator_controls_from_outputs()
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < 16; i++) {
|
||||
if (_actuator_outputs.output[i] > PWM_DEFAULT_MIN / 2) {
|
||||
if (armed) {
|
||||
if (i < n) {
|
||||
/* 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);
|
||||
@@ -147,7 +147,7 @@ mavlink_hil_actuator_controls_t Simulator::actuator_controls_from_outputs()
|
||||
/* fixed wing: scale throttle to 0..1 and other channels to -1..1 */
|
||||
|
||||
for (unsigned i = 0; i < 16; i++) {
|
||||
if (_actuator_outputs.output[i] > PWM_DEFAULT_MIN / 2) {
|
||||
if (armed) {
|
||||
if (i != 4) {
|
||||
/* scale PWM out PWM_DEFAULT_MIN..PWM_DEFAULT_MAX us to -1..1 for normal channels */
|
||||
msg.controls[i] = (_actuator_outputs.output[i] - pwm_center) / ((PWM_DEFAULT_MAX - PWM_DEFAULT_MIN) / 2);
|
||||
|
||||
Reference in New Issue
Block a user