-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Oneloop Controller: some updates #3261
Open
tmldeponti
wants to merge
15
commits into
paparazzi:master
Choose a base branch
from
tudelft:oneloop_update_PR
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
8c5d566
initial commit
tmldeponti 46572ed
merge airframes
tmldeponti cee2326
Delete unused airframe
tmldeponti 206702f
code clean up
tmldeponti fefb226
removed unused functions and some extra clean up
tmldeponti 9ef5660
Removed other unused functions
tmldeponti 4bb59da
Leave out rotwing state fr now, will be addressed in the next PR
tmldeponti b5a4d99
Removed ins ext pose quaternion messages from oneloop controller
tmldeponti 7b626f0
Conf for RW3C
tmldeponti d7df024
Added NAV_HYBRID_GOTO_MODE as suggested
tmldeponti fe4bfaf
Use aux 5 to set preferred pitch for the rotating wing drone
tmldeponti d35ee27
Merge remote-tracking branch 'upstream/master' into oneloop_update_PR
tmldeponti 01a5a02
adjusted name
tmldeponti f93fb8b
removed printf
tmldeponti 2ab3add
Use moment defnition in JSBSIM as suggested
tmldeponti File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
314 changes: 314 additions & 0 deletions
314
conf/airframes/tudelft/rot_wing_v3c_oneloop_optitrack_ext_pose.xml
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
<!DOCTYPE autopilot SYSTEM "autopilot.dtd"> | ||
|
||
<autopilot name="Oneloop Autopilot Rotorcraft"> | ||
|
||
<state_machine name="ap" freq="PERIODIC_FREQUENCY" gcs_mode="true" settings_mode="true" settings_handler="autopilot_generated|SetModeHandler"> | ||
|
||
<includes> | ||
<include name="generated/airframe.h"/> | ||
<include name="autopilot.h"/> | ||
<include name="autopilot_rc_helpers.h"/> | ||
<include name="navigation.h"/> | ||
<include name="guidance.h"/> | ||
<include name="oneloop/oneloop_andi.h"/> | ||
<include name="stabilization/stabilization_attitude.h"/> | ||
<include name="modules/radio_control/radio_control.h"/> | ||
<include name="modules/gps/gps.h"/> | ||
<include name="modules/actuators/actuators.h"/> | ||
<define name="MODE_MANUAL" value="AP_MODE_ATTITUDE_DIRECT" cond="ifndef MODE_MANUAL"/> | ||
<define name="MODE_ONELOOP" value="AP_MODE_MODULE" cond="ifndef MODE_AUTO1"/> | ||
<define name="MODE_AUTO2" value="AP_MODE_NAV" cond="ifndef MODE_AUTO2"/> | ||
<define name="RCLost()" value="(radio_control.status == RC_REALLY_LOST)"/> | ||
<define name="DLModeNav()" value="(autopilot_mode_auto2 == AP_MODE_NAV)"/> | ||
<define name="DLModeGuided()" value="(autopilot_mode_auto2 == AP_MODE_GUIDED)"/> | ||
<define name="DLModeModule()" value="(MODE_AUTO1 == AP_MODE_MODULE)"/> | ||
<define name="DLModeAZH()" value="(MODE_AUTO1 == AP_MODE_ATTITUDE_Z_HOLD)"/> | ||
<define name="ONELOOP_CONTROLLER" value="TRUE"/> | ||
</includes> | ||
|
||
<settings> | ||
<dl_setting var="autopilot.kill_throttle" min="0" step="1" max="1" module="autopilot" values="Resurrect|Kill" handler="KillThrottle"/> | ||
<dl_setting var="autopilot_mode_auto2" min="2" step="1" max="3" module="autopilot" values="NAV|GUIDED"/> | ||
</settings> | ||
|
||
<control_block name="set_commands"> | ||
<call fun="SetRotorcraftCommands(stabilization_cmd, autopilot_in_flight(), autopilot_get_motors_on())"/> | ||
</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())"/> | ||
</control_block> | ||
|
||
<control_block name="throttle_direct"> | ||
<call fun="guidance_v_read_rc()"/> | ||
<call fun="guidance_v_set_z(stateGetPositionNed_i()->z)"/> | ||
<call fun="stabilization_cmd[COMMAND_THRUST] = guidance_v.rc_delta_t"/> | ||
</control_block> | ||
|
||
<control_block name="altitude_loop"> | ||
<call fun="gv_update_ref_from_z_sp(guidance_v.z_sp)"/> | ||
<call fun="guidance_v.delta_t = guidance_v_run_pos(autopilot_in_flight(), &guidance_v)"/> | ||
<call fun="stabilization_cmd[COMMAND_THRUST] = guidance_v.rc_delta_t"/> | ||
</control_block> | ||
|
||
<exceptions> | ||
<exception cond="nav.too_far_from_home" deroute="HOME"/> | ||
<exception cond="kill_switch_is_on()" deroute="KILL"/> | ||
</exceptions> | ||
|
||
<mode name="ATTITUDE_DIRECT" shortname="ATT"> | ||
<select cond="RCMode0()"/> | ||
<on_enter> | ||
<call fun="stabilization_attitude_enter()"/> | ||
</on_enter> | ||
<control freq="NAVIGATION_FREQUENCY"> | ||
<call fun="nav_periodic_task()"/> | ||
</control> | ||
<control> | ||
<call_block name="attitude_loop"/> | ||
<call_block name="throttle_direct"/> | ||
<call_block name="set_commands"/> | ||
</control> | ||
<exception cond="RCLost()" deroute="FAILSAFE"/> | ||
</mode> | ||
|
||
<mode name="NAV"> | ||
<select cond="RCMode2() && DLModeNav()" exception="HOME"/> | ||
<on_enter> | ||
<call fun="oneloop_andi_enter(false, CTRL_INDI)"/> | ||
</on_enter> | ||
<control> | ||
<call fun="nav_periodic_task()"/> | ||
<call fun="guidance_h_set_pos(nav.carrot.y, nav.carrot.x)"/> | ||
<call fun="oneloop_from_nav(autopilot_in_flight())"/> | ||
</control> | ||
<exception cond="RCLost()" deroute="FAILSAFE"/> | ||
</mode> | ||
|
||
<mode name="GUIDED"> | ||
<select cond="RCMode2() && DLModeGuided()" exception="HOME"/> | ||
<on_enter> | ||
<call fun="guidance_h_hover_enter()"/> | ||
<call fun="stabilization_attitude_enter()"/> | ||
<call fun="guidance_v.mode = GUIDANCE_V_MODE_GUIDED"/> | ||
<call fun="guidance_v_guided_enter()"/> | ||
</on_enter> | ||
<control freq="NAVIGATION_FREQUENCY"> | ||
<call fun="nav_periodic_task()"/> | ||
</control> | ||
<control> | ||
<call fun="guidance_v_read_rc()"/> | ||
<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_commands"/> | ||
</control> | ||
<exception cond="GpsIsLost() && autopilot_in_flight()" deroute="FAILSAFE"/> | ||
</mode> | ||
|
||
<mode name="ATTITUDE_Z_HOLD" shortname="A_ZH"> | ||
<select cond="RCMode1() && DLModeAZH()"/> | ||
<on_enter> | ||
<call fun="guidance_h_hover_enter()"/> | ||
<call fun="stabilization_attitude_enter()"/> | ||
<call fun="guidance_v.mode = GUIDANCE_V_MODE_GUIDED"/> | ||
<call fun="guidance_v_guided_enter()"/> | ||
</on_enter> | ||
<control freq="NAVIGATION_FREQUENCY"> | ||
<call fun="nav_periodic_task()"/> | ||
</control> | ||
<control> | ||
<call fun="guidance_v_read_rc()"/> | ||
<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_commands"/> | ||
</control> | ||
<exception cond="GpsIsLost() && autopilot_in_flight()" deroute="FAILSAFE"/> | ||
</mode> | ||
|
||
<mode name="MODULE" shortname="ONE"> | ||
<select cond="RCMode1() && DLModeModule()" exception="HOME"/> | ||
<on_enter> | ||
<call fun="oneloop_andi_enter(false, CTRL_ANDI)"/> | ||
</on_enter> | ||
<control> | ||
<call fun="nav_periodic_task()"/> | ||
<call fun="guidance_h_set_pos(nav.carrot.y, nav.carrot.x)"/> | ||
<call fun="oneloop_from_nav(autopilot_in_flight())"/> | ||
</control> | ||
<exception cond="RCLost()" deroute="FAILSAFE"/> | ||
</mode> | ||
|
||
<mode name="HOME"> | ||
<on_enter> | ||
<call fun="guidance_h_nav_enter()"/> | ||
</on_enter> | ||
<control freq="NAVIGATION_FREQUENCY"> | ||
<call fun="nav_home()"/> | ||
</control> | ||
<control> | ||
<call fun="guidance_v_read_rc()"/> | ||
<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())"/> | ||
</control> | ||
<exception cond="GpsIsLost()" deroute="FAILSAFE"/> | ||
</mode> | ||
|
||
<!-- Safe landing --> | ||
<mode name="FAILSAFE" shortname="FAIL"> | ||
<!-- Failsafe does not work needs to be fixed--> | ||
<on_enter> | ||
<call fun="guidance_v_mode_changed(GUIDANCE_V_MODE_CLIMB)"/> | ||
<call fun="guidance_v_set_z(SPEED_BFP_OF_REAL(FAILSAFE_DESCENT_SPEED))"/> | ||
</on_enter> | ||
<control> | ||
<call fun="gv_update_ref_from_zd_sp(guidance_v.zd_sp, stateGetPositionNed_i()->z)"/> | ||
<call fun="guidance_v_update_ref()"/> | ||
<call fun="guidance_v.delta_t = guidance_v_run_speed(autopilot_in_flight(), &guidance_v)"/> | ||
<call_block name="set_commands"/> | ||
</control> | ||
<exception cond="!GpsIsLost()" deroute="$LAST_MODE"/> | ||
</mode> | ||
|
||
<!-- Kill throttle mode --> | ||
<mode name="KILL"> | ||
<select cond="kill_switch_is_on()"/> | ||
<on_enter> | ||
<call fun="autopilot_set_in_flight(false)"/> | ||
<call fun="autopilot_set_motors_on(false)"/> | ||
<call fun="stabilization_cmd[COMMAND_THRUST] = 0"/> | ||
</on_enter> | ||
<control> | ||
<call fun="SetCommands(commands_failsafe)"/> | ||
</control> | ||
</mode> | ||
|
||
</state_machine> | ||
|
||
</autopilot> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a pending PR (#3248) that is changing a lot of things for stabilization, and it should be merged soon. You controller is rather independent since it is based on generated autopilot and with specific control stack, however you should check the changes that might impact you:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the heads up! will keep an eye if some of my code is affected and report/fix it.