Skip to content

Commit

Permalink
simulator: remove strange disarmed PWM
Browse files Browse the repository at this point in the history
Before that we would send -0.1 instead of just 0.0.

First proposed by @lovettchris.
  • Loading branch information
julianoes committed Feb 20, 2020
1 parent a006d82 commit e46635b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/modules/simulator/simulator_mavlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit e46635b

Please sign in to comment.