Fix PPRZ Bebop Orange (#3592)

* Fixes from last year
* Remove old GCS
* FP cleanup
* Change AHRS to version that works with simulaton
* Install script updates: Gazebo packages moved
* Install New Gazebo
* Apply suggestion from @dewagter
* Apply suggestion from @dewagter
This commit is contained in:
Christophe De Wagter
2026-02-12 13:55:06 +01:00
committed by GitHub
parent 5aa3d5f368
commit 6a640bf84e
8 changed files with 142 additions and 34 deletions
@@ -33,7 +33,7 @@
<define name="COLOR_OBJECT_DETECTOR_CR_MAX1" value="249"/>
</target>
<define name="ARRIVED_AT_WAYPOINT" value="0.5"/><!-- Detect arrival at waypoint when within 0.5m -->
<define name="ARRIVED_AT_WAYPOINT" value="0.3"/><!-- Detect arrival at waypoint when within 0.3m -->
<!-- Subsystem section -->
<module name="telemetry" type="transparent_udp"/>
@@ -44,7 +44,7 @@
<module name="gps" type="datalink"/>
<module name="stabilization" type="indi_simple"/>
<module name="stabilization" type="rate_indi"/>
<module name="ahrs" type="int_cmpl_quat">
<module name="ahrs" type="float_mlkf"> <!-- was int_cmpl_quat -->
<configure name="USE_MAGNETOMETER" value="FALSE"/>
<define name="AHRS_USE_GPS_HEADING" value="TRUE"/>
</module>
@@ -81,7 +81,7 @@
<axis name="PITCH" failsafe_value="0"/>
<axis name="ROLL" failsafe_value="0"/>
<axis name="YAW" failsafe_value="0"/>
<axis name="THRUST" failsafe_value="6000"/>
<axis name="THRUST" failsafe_value="0"/>
</commands>
<servos driver="Default">
@@ -227,7 +227,7 @@
<define name="ADAPT_THROTTLE_ENABLED" value="TRUE"/>
<define name="ADAPT_INITIAL_HOVER_THROTTLE" value="0.68" />
<define name="ADAPT_MIN_HOVER_THROTTLE" value="0.55" />
<define name="ADAPT_MIN_HOVER_THROTTLE" value="0.50" />
<define name="ADAPT_MAX_HOVER_THROTTLE" value="0.72" />
<!-- <define name="ADAPT_NOISE_FACTOR" value="0.8" /> -->
</section>
+1 -1
View File
@@ -17,7 +17,7 @@
<session name="Flight UDP/WiFi">
<program name="Server"/>
<program name="PprgGCS"/>
<program name="PprzGCS"/>
<program name="Data Link">
<arg flag="-udp"/>
</program>
@@ -1,20 +1,25 @@
<?xml version="1.0"?>
<!DOCTYPE flight_plan SYSTEM "../flight_plan.dtd">
<flight_plan alt="1.0" ground_alt="0" lat0="51.990634" lon0="4.376789" max_dist_from_home="60" name="Bebop avoid orange TU Delft Cyberzoo" security_height="0.4">
<!--=== Header: module and Gazebo simulation world includes ===-->
<header>
#include "modules/datalink/datalink.h"
#include "modules/energy/electrical.h"
#include "modules/radio_control/radio_control.h"
#include "modules/ahrs/ahrs.h"
#define NPS_GAZEBO_WORLD "cyberzoo_orange_poles.world"
</header>
</header>
<!--=== Waypoints: define all waypoints and geofence corners ===-->
<waypoints>
<waypoint lat="51.990631" lon="4.376796" name="HOME"/>
<waypoint name="CLIMB" x="1.9" y="1.0"/>
<waypoint name="STDBY" x="1.9" y="1.0"/>
<waypoint name="TD" x="0.8" y="-1.7"/>
<waypoint name="TD" x="0.8" y="-1.7" height="0.5"/>
<waypoint name="GOAL" x="1.9" y="1.0"/>
<waypoint name="TRAJECTORY" x="1.9" y="1.0"/>
<waypoint name="RETREAT" x="1.9" y="1.0"/>
<waypoint lat="51.9905834" lon="4.3767710" name="_CZ1"/>
<waypoint lat="51.9906440" lon="4.3767060" name="_CZ2"/>
<waypoint lat="51.9906860" lon="4.3768080" name="_CZ3"/>
@@ -24,13 +29,18 @@
<waypoint lat="51.9906687" lon="4.3768025" name="_OZ3"/>
<waypoint lat="51.9906273" lon="4.3768438" name="_OZ4"/>
</waypoints>
<!--=== Sectors: define geofence regions ===-->
<sectors>
<!-- Outer geofence (hard stop, Cyberzoo walls) -->
<sector color="red" name="CyberZoo">
<corner name="_CZ1"/>
<corner name="_CZ2"/>
<corner name="_CZ3"/>
<corner name="_CZ4"/>
</sector>
<!-- Inner geofence (soft stop, obstacle zone) -->
<sector color="#FF9922" name="ObstacleZone">
<corner name="_OZ1"/>
<corner name="_OZ2"/>
@@ -38,6 +48,8 @@
<corner name="_OZ4"/>
</sector>
</sectors>
<!--=== Exceptions: handle emergencies and geofencing ===-->
<exceptions>
<!-- RC lost -->
<!--exception cond="((radio_control.status == RC_REALLY_LOST) @AND
@@ -74,50 +86,78 @@
!(nav_block >= IndexOfBlock('land here')) @AND
(autopilot_in_flight() == true) )" deroute="land here"/>
</exceptions>
<!--=== Blocks: define mission workflow ===-->
<blocks>
<block name="Wait GPS">
<call_once fun="NavKillThrottle()"/>
<while cond="!GpsFixValid()"/>
</block>
<block name="Geo init">
<while cond="LessThan(NavBlockTime(), 2)"/>
<call_once fun="NavSetAltitudeReferenceHere()"/>
</block>
<block name="Holding point">
<call_once fun="NavKillThrottle()"/>
<attitude pitch="0" roll="0" throttle="0" until="FALSE" vmode="throttle"/>
</block>
<block key="r" name="Start Engine">
<call_once fun="NavResurrect()"/>
<attitude pitch="0" roll="0" throttle="0" until="FALSE" vmode="throttle"/>
<call_once fun="NavResurrect()"/>
</block>
<block key="t" name="Takeoff" strip_button="Takeoff" strip_icon="takeoff.png">
<call_once fun="NavSetWaypointHere(WP_TD)"/>
<exception cond="GetPosAlt() @GT 0.8" deroute="Standby"/>
<call_once fun="NavSetWaypointHere(WP_CLIMB)"/>
<stay climb="nav.climb_vspeed" vmode="climb" wp="CLIMB"/>
</block>
<block key="s" name="Standby" strip_button="Standby" strip_icon="home.png">
<call_once fun="NavSetWaypointHere(WP_STDBY)"/>
<stay wp="STDBY"/>
</block>
<block key="g" name="START" strip_button="Go" strip_icon="lookfore.png">
<call_once fun="NavSetWaypointHere(WP_GOAL)"/>
<stay wp="GOAL"/>
</block>
<block name="STOP">
<call_once fun="NavSetWaypointHere(WP_STDBY)"/>
<stay wp="STDBY"/>
</block>
<block name="RETREAT">
<exception cond="block_time @GT 2.0" deroute="STOP"/>
<call_once fun="NavSetWaypointHere(WP_RETREAT)"/>
<stay wp="RETREAT"/>
</block>
<block key="e" name="Emergency Landing">
<exception cond="!nav_is_in_flight()" deroute="KILL"/>
<exception cond="0.10 @GT GetPosAlt()" deroute="KILL"/>
<call_once fun="NavSetWaypointHere(WP_TD)"/>
<call_once fun="NavStartDetectGround()"/>
<stay climb="-1.25" vmode="climb" wp="TD"/>
</block>
<block key="l" name="land here" strip_button="land here" strip_icon="land-right.png">
<call_once fun="NavSetWaypointHere(WP_TD)"/>
<go wp="TD"/>
<deroute block="Flare"/>
</block>
<block name="Land">
<exception cond="0.55 @GEQ GetPosAlt()" deroute="Flare"/>
<exception cond="block_time @GT 5" deroute="Flare"/>
<go wp="TD"/>
<deroute block="Flare"/>
</block>
<block name="Flare">
<exception cond="NavDetectGround()" deroute="Holding point"/>
<exception cond="!nav_is_in_flight()" deroute="Landed"/>
@@ -125,9 +165,16 @@
<call_once fun="NavStartDetectGround()"/>
<stay climb="nav.descend_vspeed" vmode="climb" wp="TD"/>
</block>
<block name="Landed">
<call_once fun="NavKillThrottle()"/>
<attitude pitch="0" roll="0" throttle="0" until="FALSE" vmode="throttle"/>
</block>
<block name="KILL">
<call_once fun="autopilot_set_mode(AP_MODE_KILL)"/>
<call_once fun="NavKillThrottle()"/>
<attitude pitch="0" roll="0" throttle="0" until="FALSE" vmode="throttle"/>
</block>
</blocks>
</flight_plan>
@@ -1,6 +1,7 @@
<!DOCTYPE flight_plan SYSTEM "../flight_plan.dtd">
<flight_plan alt="1.0" ground_alt="0" lat0="51.990634" lon0="4.376789" max_dist_from_home="60" name="Bebop avoid orange guided TU Delft Cyberzoo" security_height="0.4">
<flight_plan alt="1.0" ground_alt="0" lat0="51.990634" lon0="4.376789" max_dist_from_home="60" name="Bebop avoid orange TU Delft Cyberzoo" security_height="0.4">
<!--=== Header: module and Gazebo simulation world includes ===-->
<header>
#include "modules/datalink/datalink.h"
#include "modules/energy/electrical.h"
@@ -21,25 +22,30 @@ inline void setGuided(void){
<waypoint lat="51.990631" lon="4.376796" name="HOME"/>
<waypoint name="CLIMB" x="1.9" y="1.0"/>
<waypoint name="STDBY" x="1.9" y="1.0"/>
<waypoint name="TD" x="0.8" y="-1.7"/>
<waypoint name="TD" x="0.8" y="-1.7" height="0.5"/>
<waypoint name="GOAL" x="1.9" y="1.0"/>
<waypoint name="TRAJECTORY" x="1.9" y="1.0"/>
<waypoint lat="51.9905834" lon="4.3767710" name="_CZ1"/>
<waypoint lat="51.9906440" lon="4.3767060" name="_CZ2"/>
<waypoint lat="51.9906860" lon="4.3768080" name="_CZ3"/>
<waypoint lat="51.9906238" lon="4.3768729" name="_CZ4"/>
<waypoint lat="51.990595" lon="4.376779" name="_OZ1"/>
<waypoint lat="51.990640" lon="4.376734" name="_OZ2"/>
<waypoint lat="51.990667" lon="4.376804" name="_OZ3"/>
<waypoint lat="51.990623" lon="4.376850" name="_OZ4"/>
<waypoint lat="51.9906006" lon="4.3767764" name="_OZ1"/>
<waypoint lat="51.9906405" lon="4.3767316" name="_OZ2"/>
<waypoint lat="51.9906687" lon="4.3768025" name="_OZ3"/>
<waypoint lat="51.9906273" lon="4.3768438" name="_OZ4"/>
</waypoints>
<!--=== Sectors: define geofence regions ===-->
<sectors>
<!-- Outer geofence (hard stop, Cyberzoo walls) -->
<sector color="red" name="CyberZoo">
<corner name="_CZ1"/>
<corner name="_CZ2"/>
<corner name="_CZ3"/>
<corner name="_CZ4"/>
</sector>
<!-- Inner geofence (soft stop, obstacle zone) -->
<sector color="#FF9922" name="ObstacleZone">
<corner name="_OZ1"/>
<corner name="_OZ2"/>
@@ -47,6 +53,8 @@ inline void setGuided(void){
<corner name="_OZ4"/>
</sector>
</sectors>
<!--=== Exceptions: handle emergencies and geofencing ===-->
<exceptions>
<!-- RC lost -->
<!--exception cond="((radio_control.status == RC_REALLY_LOST) @AND
@@ -83,42 +91,69 @@ inline void setGuided(void){
!(nav_block >= IndexOfBlock('land here')) @AND
(autopilot_in_flight() == true) )" deroute="land here"/>
</exceptions>
<!--=== Blocks: define mission workflow ===-->
<blocks>
<block name="Wait GPS">
<call_once fun="NavKillThrottle()"/>
<while cond="!GpsFixValid()"/>
</block>
<block name="Geo init">
<while cond="LessThan(NavBlockTime(), 2)"/>
<call_once fun="NavSetAltitudeReferenceHere()"/>
</block>
<block name="Holding point">
<call_once fun="NavKillThrottle()"/>
<attitude pitch="0" roll="0" throttle="0" until="FALSE" vmode="throttle"/>
</block>
<block key="r" name="Start Engine">
<call_once fun="NavResurrect()"/>
<attitude pitch="0" roll="0" throttle="0" until="FALSE" vmode="throttle"/>
<call_once fun="NavResurrect()"/>
</block>
<block key="t" name="Takeoff" strip_button="Takeoff" strip_icon="takeoff.png">
<call_once fun="NavSetWaypointHere(WP_TD)"/>
<exception cond="GetPosAlt() @GT 0.8" deroute="Standby"/>
<call_once fun="NavSetWaypointHere(WP_CLIMB)"/>
<stay climb="nav.climb_vspeed" vmode="climb" wp="CLIMB"/>
</block>
<block key="s" name="Standby" strip_button="Standby" strip_icon="home.png">
<call_once fun="NavSetWaypointHere(WP_STDBY)"/>
<stay wp="STDBY"/>
</block>
<block key="g" name="START" strip_button="Go" strip_icon="lookfore.png">
<call_once fun="setGuided()"/>
<stay wp="STDBY"/>
</block>
<block name="STOP">
<call_once fun="NavSetWaypointHere(WP_STDBY)"/>
<call_once fun="setNav()"/>
<stay wp="STDBY"/>
</block>
<block name="RETREAT">
<call_once fun="setGuided()"/>
<call_once fun="orange_avoider_guided_retreat()"/>
<exception cond="block_time @GT 2.0" deroute="STOP"/>
<stay wp="STDBY"/>
</block>
<block key="e" name="Emergency Landing">
<exception cond="!nav_is_in_flight()" deroute="KILL"/>
<exception cond="0.10 @GT GetPosAlt()" deroute="KILL"/>
<call_once fun="setNav()"/>
<call_once fun="NavSetWaypointHere(WP_TD)"/>
<call_once fun="NavStartDetectGround()"/>
<stay climb="-1.25" vmode="climb" wp="TD"/>
</block>
<block key="l" name="land here" strip_button="Land Here" strip_icon="land-right.png">
<call_once fun="setNav()"/>
<call_once fun="NavSetWaypointHere(WP_TD)"/>
@@ -126,10 +161,13 @@ inline void setGuided(void){
<deroute block="Flare"/>
</block>
<block name="Land">
<exception cond="0.55 @GEQ GetPosAlt()" deroute="Flare"/>
<exception cond="block_time @GT 5" deroute="Flare"/>
<call_once fun="setNav()"/>
<go wp="TD"/>
<deroute block="Flare"/>
</block>
<block name="Flare">
<exception cond="NavDetectGround()" deroute="Holding point"/>
<exception cond="!nav_is_in_flight()" deroute="Landed"/>
@@ -137,9 +175,16 @@ inline void setGuided(void){
<call_once fun="NavStartDetectGround()"/>
<stay climb="nav.descend_vspeed" vmode="climb" wp="TD"/>
</block>
<block name="Landed">
<call_once fun="NavKillThrottle()"/>
<attitude pitch="0" roll="0" throttle="0" until="FALSE" vmode="throttle"/>
</block>
<block name="KILL">
<call_once fun="autopilot_set_mode(AP_MODE_KILL)"/>
<call_once fun="NavKillThrottle()"/>
<attitude pitch="0" roll="0" throttle="0" until="FALSE" vmode="throttle"/>
</block>
</blocks>
</flight_plan>
+1 -1
View File
@@ -11,7 +11,7 @@ The avoidance strategy is to simply count the total number of orange pixels. Whe
The color filter settings are set using the cv_detect_color_object. This module can run multiple filters simultaneously
so you have to define which filter to use with the ORANGE_AVOIDER_VISUAL_DETECTION_ID setting.
</description>
<define name="ORANGE_AVOIDER_VISUAL_DETECTION_ID" value="ABI_BROADCAST" description="which VISUAL_DETECTION message to recieve for orange pole detection."/>
<define name="ORANGE_AVOIDER_VISUAL_DETECTION_ID" value="ABI_BROADCAST" description="which VISUAL_DETECTION message to receive for orange pixel detection."/>
</doc>
<settings>
<dl_settings>
+1 -1
View File
@@ -7,7 +7,7 @@
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/tudelft/course_orangeavoid_cyberzoo.xml"
settings="settings/rotorcraft_basic.xml"
settings_modules="modules/ahrs_int_cmpl_quat.xml modules/bebop_cam.xml modules/cv_detect_color_object.xml modules/electrical.xml modules/gps.xml modules/guidance_pid_rotorcraft.xml modules/guidance_rotorcraft.xml modules/imu_common.xml modules/ins_extended.xml modules/nav_rotorcraft.xml modules/orange_avoider.xml modules/stabilization_indi_simple.xml modules/video_capture.xml modules/video_rtp_stream.xml"
settings_modules="modules/ahrs_float_mlkf.xml modules/bebop_cam.xml modules/cv_detect_color_object.xml modules/electrical.xml modules/gps.xml modules/guidance_pid_rotorcraft.xml modules/guidance_rotorcraft.xml modules/imu_common.xml modules/ins_extended.xml modules/nav_rotorcraft.xml modules/orange_avoider.xml modules/stabilization_indi_simple.xml modules/video_capture.xml modules/video_rtp_stream.xml"
gui_color="white"
/>
<aircraft
+4 -10
View File
@@ -15,14 +15,8 @@
<program name="Server">
<arg flag="-n"/>
</program>
<program name="GCS">
<arg flag="-speech"/>
<arg flag="-maximize"/>
<arg flag="-center_ac"/>
<arg flag="-mercator"/>
<arg flag="-maps_no_http"/>
<arg flag="-track_size" constant="200"/>
<arg flag="-zoom" constant="40."/>
<program name="PprzGCS">
<arg flag="--speech"/>
</program>
<program name="Joystick" command="sw/ground_segment/joystick/input2ivy">
<arg flag="-ac" constant="@AIRCRAFT"/>
@@ -41,8 +35,8 @@
<arg flag="-udp"/>
</program>
<program name="Server"/>
<program name="GCS">
<arg flag="-speech"/>
<program name="PprzGCS">
<arg flag="--speech"/>
</program>
<program name="Joystick" command="sw/ground_segment/joystick/input2ivy">
<arg flag="-ac" constant="@AIRCRAFT"/>