SITL: added ignition control for gas heli

This commit is contained in:
Andrew Tridgell 2015-07-31 10:54:16 +10:00 committed by Randy Mackay
parent b5d7c900d7
commit 12ae3c5031
2 changed files with 8 additions and 0 deletions

View File

@ -48,6 +48,7 @@ Helicopter::Helicopter(const char *home_str, const char *frame_str) :
} else {
frame_type = HELI_FRAME_CONVENTIONAL;
}
gas_heli = (strstr(frame_str, "-gas") != NULL);
}
/*
@ -60,6 +61,8 @@ void Helicopter::update(const struct sitl_input &input)
float rsc = (input.servos[7]-1000) / 1000.0f;
float rsc_scale = rsc/rsc_setpoint;
// ignition only for gas helis
bool ignition_enabled = gas_heli?(input.servos[6] > 1500):true;
float thrust = 0;
float roll_rate = 0;
@ -73,6 +76,10 @@ void Helicopter::update(const struct sitl_input &input)
float swash2 = (input.servos[1]-1000) / 1000.0f;
float swash3 = (input.servos[2]-1000) / 1000.0f;
if (!ignition_enabled) {
rsc = 0;
}
switch (frame_type) {
case HELI_FRAME_CONVENTIONAL: {
// simulate a traditional helicopter

View File

@ -56,6 +56,7 @@ private:
HELI_FRAME_DUAL,
HELI_FRAME_COMPOUND
} frame_type = HELI_FRAME_CONVENTIONAL;
bool gas_heli = false;
};