Skip to content

Commit

Permalink
fix rotorcraft autopilot for new API
Browse files Browse the repository at this point in the history
  • Loading branch information
gautierhattenberger committed Apr 25, 2017
1 parent 9e57986 commit 0ea1afe
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions conf/autopilot/rotorcraft_autopilot.xml
Expand Up @@ -29,13 +29,13 @@
</settings>

<control_block name="set_actuators">
<call fun="SetRotorcraftCommands(stabilization_cmd, autopilot_in_flight, autopilot_motors_on)"/>
<call fun="SetRotorcraftCommands(stabilization_cmd, autopilot_in_flight(), autopilot_get_motors_on())"/>
<call fun="SetActuatorsFromCommands(commands, autopilot_mode)"/>
</control_block>

<control_block name="attitude_loop">
<call fun="stabilization_attitude_read_rc(autopilot_in_flight, FALSE, FALSE)"/>
<call fun="stabilization_attitude_run(autopilot_in_flight)"/>
<call fun="stabilization_attitude_read_rc(autopilot_in_flight(), FALSE, FALSE)"/>
<call fun="stabilization_attitude_run(autopilot_in_flight())"/>
</control_block>

<control_block name="throttle_direct">
Expand All @@ -46,7 +46,7 @@

<control_block name="altitude_loop">
<call fun="gv_update_ref_from_z_sp(guidance_v_z_sp)"/>
<call fun="run_hover_loop(autopilot_in_flight)"/>
<call fun="run_hover_loop(autopilot_in_flight())"/>
<!--call fun="SaturateThrottle(rc_values)"/-->
</control_block>

Expand Down Expand Up @@ -99,12 +99,12 @@
<call fun="nav_periodic_task()"/>
</control>
<control>
<call fun="guidance_v_thrust_adapt(autopilot_in_flight)"/>
<call fun="guidance_v_from_nav(autopilot_in_flight)"/>
<call fun="guidance_h_from_nav(autopilot_in_flight)"/>
<call fun="guidance_v_thrust_adapt(autopilot_in_flight())"/>
<call fun="guidance_v_from_nav(autopilot_in_flight())"/>
<call fun="guidance_h_from_nav(autopilot_in_flight())"/>
<call_block name="set_actuators"/>
</control>
<exception cond="GpsIsLost() && autopilot_in_flight" deroute="FAILSAFE"/>
<exception cond="GpsIsLost() && autopilot_in_flight()" deroute="FAILSAFE"/>
</mode>

<mode name="GUIDED">
Expand All @@ -119,12 +119,12 @@
<call fun="nav_periodic_task()"/>
</control>
<control>
<call fun="guidance_v_thrust_adapt(autopilot_in_flight)"/>
<call fun="guidance_v_guided_run(autopilot_in_flight)"/>
<call fun="guidance_h_guided_run(autopilot_in_flight)"/>
<call fun="guidance_v_thrust_adapt(autopilot_in_flight())"/>
<call fun="guidance_v_guided_run(autopilot_in_flight())"/>
<call fun="guidance_h_guided_run(autopilot_in_flight())"/>
<call_block name="set_actuators"/>
</control>
<exception cond="GpsIsLost() && autopilot_in_flight" deroute="FAILSAFE"/>
<exception cond="GpsIsLost() && autopilot_in_flight()" deroute="FAILSAFE"/>
</mode>

<mode name="HOME">
Expand All @@ -137,9 +137,9 @@
<call fun="nav_home()"/>
</control>
<control>
<call fun="guidance_v_thrust_adapt(autopilot_in_flight)"/>
<call fun="guidance_v_from_nav(autopilot_in_flight)"/>
<call fun="guidance_h_from_nav(autopilot_in_flight)"/>
<call fun="guidance_v_thrust_adapt(autopilot_in_flight())"/>
<call fun="guidance_v_from_nav(autopilot_in_flight())"/>
<call fun="guidance_h_from_nav(autopilot_in_flight())"/>
<call_block name="set_actuators"/>
</control>
<exception cond="GpsIsLost()" deroute="FAILSAFE"/>
Expand All @@ -154,9 +154,9 @@
</on_enter>
<control>
<call fun="stabilization_attitude_set_failsafe_setpoint()"/>
<call fun="stabilization_attitude_run(autopilot_in_flight)"/>
<call fun="stabilization_attitude_run(autopilot_in_flight())"/>
<call fun="gv_update_ref_from_zd_sp(guidance_v_zd_sp, stateGetPositionNed_i()->z)"/>
<call fun="run_hover_loop(autopilot_in_flight)"/>
<call fun="run_hover_loop(autopilot_in_flight())"/>
<call_block name="set_actuators"/>
</control>
<exception cond="!GpsIsLost()" deroute="$LAST_MODE"/>
Expand All @@ -167,8 +167,7 @@
<select cond="$DEFAULT_MODE"/>
<select cond="kill_switch_is_on()"/>
<on_enter>
<call fun="autopilot_in_flight = false"/>
<call fun="autopilot_in_flight_counter = 0"/>
<call fun="autopilot_set_in_flight(false)"/>
<call fun="autopilot_set_motors_on(false)"/>
<call fun="stabilization_cmd[COMMAND_THRUST] = 0"/>
</on_enter>
Expand Down

0 comments on commit 0ea1afe

Please sign in to comment.