Hello guys,
I am trying to run my own flight mode. It doesn’t do anything special, I just added some variables in the commander.cpp and state_machine_helper.cpp. However when I set the commander to change to my flight mode (> commander mode test) the vehicle detects a freefall in SITL.
This is the code I added on set_control_mode():
switch (status.nav_state) {
//# Add test flight mode
case vehicle_status_s::NAVIGATION_STATE_TEST:
control_mode.flag_control_test_enabled = true;
control_mode.flag_control_manual_enabled = false;
control_mode.flag_control_auto_enabled = true;
control_mode.flag_control_rates_enabled = true;
control_mode.flag_control_attitude_enabled = true;
control_mode.flag_control_rattitude_enabled = false;
control_mode.flag_control_altitude_enabled = false;
control_mode.flag_control_climb_rate_enabled = false;
control_mode.flag_control_position_enabled = false;
control_mode.flag_control_velocity_enabled = false;
control_mode.flag_control_acceleration_enabled = false;
control_mode.flag_control_termination_enabled = false;
//#
And that is the output:
pxh> INFO [commander] Freefall detected
The commander app switches to my flight mode but the vehicle is falling even though I make the attitude, rates and auto flags true. What am I missing here?