AP_HAL_SITL: correct battery setup for rover

This commit is contained in:
Pierre Kancir 2018-11-25 21:23:30 +01:00 committed by Randy Mackay
parent 87d27957d9
commit a5e5ee73eb
1 changed files with 6 additions and 1 deletions

View File

@ -481,7 +481,12 @@ void SITL_State::_simulator_servos(struct sitl_input &input)
}
} else {
// simulate simple battery setup
float throttle = motors_on?(input.servos[2]-1000) / 1000.0f:0;
float throttle;
if (_vehicle == APMrover2) {
throttle = motors_on ? (input.servos[2] - 1500) / 500.0f : 0;
} else {
throttle = motors_on ? (input.servos[2] - 1000) / 1000.0f : 0;
}
// lose 0.7V at full throttle
voltage = _sitl->batt_voltage - 0.7f*fabsf(throttle);