mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-09 22:49:53 +08:00
41048101d0
- possibility to use basic PID with steering rover - fix navigation - add support for mission mode - fix simulator (orientation was wrong, leading to opposite steering between sim and reality) - add support of 2 wheels rover in simulation - add and update config files
108 lines
3.4 KiB
XML
108 lines
3.4 KiB
XML
<!DOCTYPE autopilot SYSTEM "autopilot.dtd">
|
|
|
|
<autopilot name="Rover Autopilot">
|
|
|
|
<state_machine name="ap" freq="PERIODIC_FREQUENCY" gcs_mode="true" settings_mode="true" settings_handler="autopilot_generated|SetModeHandler">
|
|
|
|
<modules>
|
|
<module name="nav" type="rover_base"/>
|
|
<module name="guidance" type="rover"/>
|
|
</modules>
|
|
|
|
<includes>
|
|
<include name="generated/airframe.h"/>
|
|
<include name="autopilot.h"/>
|
|
<include name="autopilot_rc_helpers.h"/>
|
|
<include name="modules/gps/gps.h"/>
|
|
<include name="modules/actuators/actuators.h"/>
|
|
<include name="modules/radio_control/radio_control.h"/>
|
|
</includes>
|
|
|
|
<settings>
|
|
<dl_setting var="autopilot.kill_throttle" min="0" step="1" max="1" module="autopilot" values="Resurrect|Kill" handler="KillThrottle"/>
|
|
</settings>
|
|
|
|
<exceptions>
|
|
<exception cond="nav.too_far_from_home" deroute="HOME"/>
|
|
<exception cond="kill_switch_is_on()" deroute="KILL"/>
|
|
</exceptions>
|
|
|
|
<mode name="DIRECT" shortname="MANUAL">
|
|
<select cond="RCMode0() || RCMode1()"/>
|
|
<control freq="NAVIGATION_FREQUENCY">
|
|
<call fun="nav_periodic_task()"/>
|
|
</control>
|
|
<control>
|
|
<call fun="SetCommandsFromRC(commands, radio_control.values)"/>
|
|
</control>
|
|
<exception cond="RadioControlIsLost()" deroute="KILL"/>
|
|
</mode>
|
|
|
|
<mode name="NAV">
|
|
<select cond="RCMode2()" exception="HOME"/>
|
|
<control freq="NAVIGATION_FREQUENCY">
|
|
<call fun="nav_periodic_task()"/>
|
|
</control>
|
|
<control>
|
|
<call fun="rover_guidance_periodic()"/>
|
|
</control>
|
|
<exception cond="GpsIsLost() && autopilot_in_flight()" deroute="KILL"/>
|
|
</mode>
|
|
|
|
<mode name="HOME">
|
|
<control freq="NAVIGATION_FREQUENCY">
|
|
<call fun="nav_home()"/>
|
|
</control>
|
|
<control>
|
|
<call fun="rover_guidance_periodic()"/>
|
|
</control>
|
|
<exception cond="GpsIsLost()" deroute="KILL"/>
|
|
</mode>
|
|
|
|
<!-- Kill throttle mode -->
|
|
<mode name="KILL">
|
|
<select cond="$DEFAULT_MODE"/>
|
|
<select cond="kill_switch_is_on()"/>
|
|
<on_enter>
|
|
<call fun="autopilot_set_in_flight(false)"/>
|
|
<call fun="autopilot_set_motors_on(false)"/>
|
|
</on_enter>
|
|
<control>
|
|
<call fun="SetCommands(commands_failsafe)"/>
|
|
<call fun="autopilot.throttle = commands[COMMAND_SPEED]"/>
|
|
</control>
|
|
</mode>
|
|
|
|
</state_machine>
|
|
|
|
<state_machine name="guidance" freq="PERIODIC_FREQUENCY">
|
|
|
|
<includes>
|
|
<include name="navigation.h"/>
|
|
</includes>
|
|
|
|
<mode name="NAV_DIRECT">
|
|
<select cond="nav.mode == NAV_MODE_MANUAL"/>
|
|
<control>
|
|
<!-- copy manual nav controls to commands -->
|
|
<call fun="command_set(COMMAND_SPEED, TRIM_PPRZ(nav.speed * MAX_PPRZ))"/>
|
|
<call fun="command_set(COMMAND_TURN, TRIM_PPRZ(nav.turn * MAX_PPRZ))"/>
|
|
<call fun="autopilot.throttle = commands[COMMAND_SPEED]"/>
|
|
</control>
|
|
</mode>
|
|
|
|
<mode name="NAV_AUTO">
|
|
<select cond="nav.mode != NAV_MODE_MANUAL"/>
|
|
<control>
|
|
<call fun="VECT2_COPY(rover_guidance.sp.pos, nav.carrot)"/>
|
|
<call fun="rover_guidance_run(&nav.heading)"/>
|
|
<call fun="command_set(COMMAND_SPEED, TRIM_PPRZ(rover_guidance.cmd.motor_speed))"/>
|
|
<call fun="command_set(COMMAND_TURN, TRIM_PPRZ(rover_guidance.cmd.motor_turn))"/>
|
|
<call fun="autopilot.throttle = commands[COMMAND_SPEED]"/>
|
|
</control>
|
|
</mode>
|
|
|
|
</state_machine>
|
|
|
|
</autopilot>
|