[rotorcraft][modules] add orange_avoider and MavLab course confs

closes #1539
This commit is contained in:
mavlabcourse
2016-01-25 17:35:32 +01:00
committed by Felix Ruess
parent 1e29cb623f
commit 9fcef07f45
9 changed files with 885 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
<conf>
<aircraft
name="bebop_avoid"
ac_id="2"
airframe="airframes/TUDELFT/tudelft_course2016_bebop_avoider.xml"
radio="radios/dummy.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/TUDELFT/tudelft_course2016_avoid_orange_cyberzoo.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_rate.xml ../conf/modules/cv_colorfilter.xml"
settings_modules="modules/geo_mag.xml modules/air_data.xml modules/video_thread.xml modules/cv_colorfilter.xml"
gui_color="#db67fffffaeb"
/>
<aircraft
name="bebop_video"
ac_id="1"
airframe="airframes/examples/course_bebop_colorfilter.xml"
radio="radios/dummy.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/dummy.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml [settings/control/stabilization_att_indi.xml] settings/control/stabilization_rate.xml"
settings_modules="modules/geo_mag.xml modules/air_data.xml modules/video_thread.xml modules/cv_colorfilter.xml modules/video_rtp_stream.xml"
gui_color="#ffffb1c0b1c0"
/>
</conf>
@@ -0,0 +1,92 @@
<control_panel name="paparazzi control panel">
<section name="programs">
<program name="Server" command="sw/ground_segment/tmtc/server"/>
<program name="Data Link" command="sw/ground_segment/tmtc/link">
<arg flag="-d" constant="/dev/ttyUSB0"/>
</program>
<program name="Link Combiner" command="sw/ground_segment/python/redundant_link/link_combiner.py"/>
<program name="GCS" command="sw/ground_segment/cockpit/gcs"/>
<program name="Flight Plan Editor" command="sw/ground_segment/cockpit/gcs">
<arg flag="-edit"/>
</program>
<program name="Messages" command="sw/ground_segment/tmtc/messages"/>
<program name="Messages (Python)" command="sw/ground_segment/python/messages_app/messagesapp.py"/>
<program name="Settings" command="sw/ground_segment/tmtc/settings">
<arg flag="-ac" constant="@AIRCRAFT"/>
</program>
<program name="Settings (Python)" command="sw/ground_segment/python/settings_app/settingsapp.py"/>
<program name="GPSd position display" command="sw/ground_segment/tmtc/gpsd2ivy"/>
<program name="Log Plotter" command="sw/logalizer/logplotter"/>
<program name="Real-time Plotter" command="sw/logalizer/plotter"/>
<program name="Real-time Plotter (Python)" command="sw/ground_segment/python/real_time_plot/messagepicker.py"/>
<program name="Log File Player" command="sw/logalizer/play"/>
<program name="Simulator" command="sw/simulator/pprzsim-launch"/>
<program name="Video Synchronizer" command="sw/ground_segment/misc/video_synchronizer"/>
<program name="Joystick" command="sw/ground_segment/joystick/input2ivy">
<arg flag="-ac" constant="@AIRCRAFT"/>
<arg flag="xbox_gamepad.xml"/>
</program>
<program name="Hardware in the Loop" command="sw/simulator/simhitl"/>
<program name="Environment Simulator" command="sw/simulator/gaia"/>
<program name="Http Server" command="$python">
<arg flag="-m" constant="SimpleHTTPServer"/>
<arg flag="8889"/>
</program>
<program name="Plot Meteo Profile" command="sw/logalizer/plotprofile"/>
<program name="Weather Station" command="sw/ground_segment/misc/davis2ivy">
<arg flag="-d" constant="/dev/ttyUSB1"/>
</program>
<program name="Attitude Visualizer" command="sw/tools/attitude_viz.py"/>
<program name="App Server" command="sw/ground_segment/tmtc/app_server"/>
<program name="NatNet" command="sw/ground_segment/misc/natnet2ivy"/>
<program name="Ivy2Nmea" command="sw/ground_segment/tmtc/ivy2nmea">
<arg flag="--port" constant="/dev/ttyUSB1"/>
<arg flag="--id" constant="1"/>
</program>
<program name="BluegigaUsbDongleScanner" command="sw/tools/bluegiga_usb_dongle/bluegiga_usb_driver">
<arg flag="/dev/ttyACM2"/>
<arg flag="scan"/>
</program>
<program name="BluegigaUsbDongle" command="sw/tools/bluegiga_usb_dongle/bluegiga_usb_driver">
<arg flag="/dev/ttyACM2"/>
<arg flag="00:07:00:2d:d6:bb"/>
<arg flag="4242"/>
<arg flag="4252"/>
</program>
</section>
<section name="sessions">
<session name="Bebop basic">
<program name="Data Link">
<arg flag="-udp"/>
</program>
<program name="Server"/>
<program name="GCS">
<arg flag="-speech"/>
</program>
<program name="Joystick" command="sw/ground_segment/joystick/input2ivy">
<arg flag="-ac" constant="@AIRCRAFT"/>
<arg flag="hobbyking.xml"/>
</program>
</session>
<session name="Bebop extensive">
<program name="Data Link">
<arg flag="-udp"/>
</program>
<program name="Server"/>
<program name="GCS">
<arg flag="-speech"/>
</program>
<program name="Joystick" command="sw/ground_segment/joystick/input2ivy">
<arg flag="-d" constant="2"/>
<arg flag="-ac" constant="@AIRCRAFT"/>
<arg flag="hobbyking.xml"/>
</program>
<program name="NatNet" command="sw/ground_segment/misc/natnet2ivy">
<arg flag="-ac 3" constant="@AC_ID"/>
</program>
<program name="Messages" command="sw/ground_segment/tmtc/messages"/>
</session>
</section>
</control_panel>
@@ -0,0 +1,258 @@
<!DOCTYPE airframe SYSTEM "../airframe.dtd">
<!-- And example airframe to be use in the TU DElft Course 2016 -->
<airframe name="AvoiderBob"> <!-- The name of your airframe -->
<firmware name="rotorcraft">
<target name="ap" board="bebop"/> <!-- The type of Autopilot board hardware one uses -->
<target name="nps" board="pc">
<subsystem name="fdm" type="jsbsim"/>
<subsystem name="udp"/>
</target>
<!--define name="USE_SONAR" value="TRUE"/-->
<!-- Subsystem section -->
<subsystem name="telemetry" type="transparent_udp"/>
<subsystem name="radio_control" type="datalink"/> <!-- We control the bebop through wifi -->
<subsystem name="motor_mixing"/>
<subsystem name="actuators" type="bebop"/>
<subsystem name="imu" type="bebop"/>
<subsystem name="gps" type="datalink"/> <!-- The GPS information also comes over this wifi, as we are sitting in the cyberzoo all the time -->
<subsystem name="stabilization" type="indi"/>
<subsystem name="ahrs" type="int_cmpl_quat">
<configure name="USE_MAGNETOMETER" value="FALSE"/> <!-- Heading is from Optitrack, in reguler outside flight case one would use and Magnetometer-->
<define name="AHRS_USE_GPS_HEADING" value="TRUE"/>
</subsystem>
<subsystem name="ins" type="extended"/>
</firmware>
<!-- This is the place where you add all your modules -->
<!-- If there is a variable you can define in your module you can add it within the load node-->
<!-- Note that for vision the order in which modules are loaded is important -->
<!-- If you place cv_colorfilter before your own module your own module will only get the filtered image-->
<modules main_freq="512">
<load name="geo_mag.xml"/>
<load name="air_data.xml"/>
<load name="send_imu_mag_current.xml"/>
<!--load name="logger_file.xml">
<define name="FILE_LOGGER_PATH" value="/data/ftp/internal_000"/>
</load-->
<load name="video_thread.xml">
<define name="VIDEO_THREAD_FPS" value="4"/>
<define name="VIDEO_THREAD_CAMERA" value="front_camera"/>
<define name="VIDEO_THREAD_SHOT_PATH" value="/data/ftp/internal_000/images"/>
</load>
<!--
<load name="video_rtp_stream.xml">
<define name="VIEWVIDEO_QUALITY_FACTOR" value="80"/>
<define name="VIEWVIDEO_DOWNSIZE_FACTOR" value="1"/>
</load>
-->
<load name="cv_colorfilter.xml">
</load>
<load name="orange_avoider.xml"/>
</modules>
<commands>
<axis name="PITCH" failsafe_value="0"/>
<axis name="ROLL" failsafe_value="0"/>
<axis name="YAW" failsafe_value="0"/>
<axis name="THRUST" failsafe_value="6000"/>
</commands>
<servos driver="Default">
<servo name="TOP_RIGHT" no="0" min="3000" neutral="3000" max="12000"/>
<servo name="TOP_LEFT" no="1" min="3000" neutral="3000" max="12000"/>
<servo name="BOTTOM_LEFT" no="2" min="3000" neutral="3000" max="12000"/>
<servo name="BOTTOM_RIGHT" no="3" min="3000" neutral="3000" max="12000"/>
</servos>
<section name="MIXING" prefix="MOTOR_MIXING_">
<!-- Time cross layout (X), with order NW (CW), NE (CCW), SE (CW), SW (CCW) -->
<define name="TYPE" value="QUAD_X"/>
</section>
<command_laws>
<call fun="motor_mixing_run(autopilot_motors_on,FALSE,values)"/>
<set servo="TOP_LEFT" value="motor_mixing.commands[MOTOR_FRONT_LEFT]"/>
<set servo="TOP_RIGHT" value="motor_mixing.commands[MOTOR_FRONT_RIGHT]"/>
<set servo="BOTTOM_RIGHT" value="motor_mixing.commands[MOTOR_BACK_RIGHT]"/>
<set servo="BOTTOM_LEFT" value="motor_mixing.commands[MOTOR_BACK_LEFT]"/>
</command_laws>
<section name="AIR_DATA" prefix="AIR_DATA_">
<define name="CALC_AIRSPEED" value="FALSE"/>
<define name="CALC_TAS_FACTOR" value="FALSE"/>
<define name="CALC_AMSL_BARO" value="TRUE"/>
</section>
<!-- The IMU calibration can be quite important -->
<!-- Follow the MAVLab video to see how you can calibrate it -->
<!-- If your drone tends to always go forward check your primary flight display -->
<!-- Put the drone on a table, if the horizon is not perfectly straight you might want -->
<!-- to adjust your body to imu variables until it is -->
<section name="IMU" prefix="IMU_">
<!-- Magneto calibration -->
<define name="MAG_X_NEUTRAL" value="18"/>
<define name="MAG_Y_NEUTRAL" value="157"/>
<define name="MAG_Z_NEUTRAL" value="49"/>
<define name="MAG_X_SENS" value="10.5007722373" integer="16"/>
<define name="MAG_Y_SENS" value="11.1147400462" integer="16"/>
<define name="MAG_Z_SENS" value="11.6479371722" integer="16"/>
<!-- Magneto current calibration -->
<define name="MAG_X_CURRENT_COEF" value="0.0"/>
<define name="MAG_Y_CURRENT_COEF" value="0.0"/>
<define name="MAG_Z_CURRENT_COEF" value="0.0"/>
<define name="BODY_TO_IMU_PHI" value="0." unit="deg"/>
<define name="BODY_TO_IMU_THETA" value="0." unit="deg"/>
<define name="BODY_TO_IMU_PSI" value="0." unit="deg"/>
</section>
<!-- local magnetic field -->
<!-- http://wiki.paparazziuav.org/wiki/Subsystem/ahrs#Local_Magnetic_Field -->
<section name="AHRS" prefix="AHRS_">
<!-- values used if no GPS fix, on 3D fix is update by geo_mag module -->
<!-- Delft, The Netherlands 2014 -->
<define name="H_X" value="0.3892503"/>
<define name="H_Y" value="0.0017972"/>
<define name="H_Z" value="0.9211303"/>
</section>
<section name="INS" prefix="INS_">
<define name="SONAR_MAX_RANGE" value="2.2"/>
<define name="SONAR_UPDATE_ON_AGL" value="TRUE"/>
</section>
<section name="RC_SETPOINT" prefix="STABILIZATION_ATTITUDE_">
<!-- setpoint limits for attitude stabilization rc flight -->
<define name="SP_MAX_PHI" value="45" unit="deg"/>
<define name="SP_MAX_THETA" value="45" unit="deg"/>
<define name="SP_MAX_R" value="100" unit="deg/s"/>
<define name="DEADBAND_A" value="0"/>
<define name="DEADBAND_E" value="0"/>
<define name="DEADBAND_R" value="50"/>
</section>
<section name="STABILIZATION_RATE" prefix="STABILIZATION_RATE_">
<!-- setpoints -->
<define name="SP_MAX_P" value="140" unit="deg/s"/>
<define name="SP_MAX_Q" value="140" unit="deg/s"/>
<define name="SP_MAX_R" value="140" unit="deg/s"/>
<define name="DEADBAND_P" value="20"/>
<define name="DEADBAND_Q" value="20"/>
<define name="DEADBAND_R" value="200"/>
<!-- feedback -->
<define name="GAIN_P" value="400"/>
<define name="GAIN_Q" value="400"/>
<define name="GAIN_R" value="350"/>
<define name="IGAIN_P" value="75"/>
<define name="IGAIN_Q" value="75"/>
<define name="IGAIN_R" value="50"/>
</section>
<section name="ATTITUDE_REFERENCE" prefix="STABILIZATION_ATTITUDE_">
<!-- attitude reference generation model -->
<define name="REF_OMEGA_P" value="450" unit="deg/s"/>
<define name="REF_ZETA_P" value="0.9"/>
<define name="REF_MAX_P" value="600." unit="deg/s"/>
<define name="REF_MAX_PDOT" value="RadOfDeg(8000.)"/>
<define name="REF_OMEGA_Q" value="450" unit="deg/s"/>
<define name="REF_ZETA_Q" value="0.9"/>
<define name="REF_MAX_Q" value="600." unit="deg/s"/>
<define name="REF_MAX_QDOT" value="RadOfDeg(8000.)"/>
<define name="REF_OMEGA_R" value="450" unit="deg/s"/>
<define name="REF_ZETA_R" value="0.9"/>
<define name="REF_MAX_R" value="600." unit="deg/s"/>
<define name="REF_MAX_RDOT" value="RadOfDeg(8000.)"/>
</section>
<section name="STABILIZATION_ATTITUDE_INDI" prefix="STABILIZATION_INDI_">
<!-- control effectiveness -->
<define name="G1_P" value="0.0639"/>
<define name="G1_Q" value="0.0361"/>
<define name="G1_R" value="0.0022"/>
<define name="G2_R" value="0.1450"/>
<!-- reference acceleration for attitude control -->
<define name="REF_ERR_P" value="600.0"/>
<define name="REF_ERR_Q" value="600.0"/>
<define name="REF_ERR_R" value="600.0"/>
<define name="REF_RATE_P" value="28.0"/>
<define name="REF_RATE_Q" value="28.0"/>
<define name="REF_RATE_R" value="28.0"/>
<!--Maxium yaw rate, to avoid instability-->
<define name="MAX_R" value="120.0"/> <!--deg/s-->
<!-- second order filter parameters -->
<define name="FILT_OMEGA" value="50.0"/>
<define name="FILT_ZETA" value="0.55"/>
<define name="FILT_OMEGA_R" value="50.0"/>
<define name="FILT_ZETA_R" value="0.55"/>
<!-- first order actuator dynamics -->
<define name="ACT_DYN_P" value="0.1"/>
<define name="ACT_DYN_Q" value="0.1"/>
<define name="ACT_DYN_R" value="0.1"/>
<!-- Adaptive Learning Rate -->
<define name="USE_ADAPTIVE" value="FALSE"/>
<define name="ADAPTIVE_MU" value="0.0001"/>
</section>
<section name="GUIDANCE_V" prefix="GUIDANCE_V_">
<define name="HOVER_KP" value="283"/>
<define name="HOVER_KD" value="82"/>
<define name="HOVER_KI" value="70"/>
<define name="NOMINAL_HOVER_THROTTLE" value="0.5"/>
<define name="ADAPT_THROTTLE_ENABLED" value="FALSE"/>
</section>
<section name="GUIDANCE_H" prefix="GUIDANCE_H_">
<define name="MAX_BANK" value="32" unit="deg"/>
<define name="PGAIN" value="79"/>
<define name="DGAIN" value="100"/>
<define name="IGAIN" value="30"/>
</section>
<section name="NAVIGATION" prefix="NAV_">
<define name="CLIMB_VSPEED" value="1.0" />
<define name="DESCEND_VSPEED" value="-1.0" />
</section>
<section name="SIMULATOR" prefix="NPS_">
<define name="ACTUATOR_NAMES" value="nw_motor, ne_motor, se_motor, sw_motor" type="string[]"/>
<define name="JSBSIM_MODEL" value="simple_x_quad_ccw" type="string"/>
<define name="SENSORS_PARAMS" value="nps_sensors_params_default.h" type="string"/>
</section>
<!-- Here you put the modes that your drone can fly in -->
<!-- If you are using a hobbyking joystick mode_manual and mode_auto2 have to be set-->
<!-- These settings are probably ok for your project! -->
<section name="AUTOPILOT">
<define name="MODE_STARTUP" value="AP_MODE_NAV"/>
<define name="MODE_MANUAL" value="AP_MODE_ATTITUDE_DIRECT"/>
<define name="MODE_AUTO1" value="AP_MODE_ATTITUDE_Z_HOLD"/>
<define name="MODE_AUTO2" value="AP_MODE_NAV"/>
<define name="NO_RC_THRUST_LIMIT" value="TRUE"/>
</section>
<section name="MISC">
<define name="NO_RC_THRUST_LIMIT" value="TRUE"/>
</section>
<section name="BAT">
<define name="MILLIAMP_AT_FULL_THROTTLE" value="8700"/>
<define name="CATASTROPHIC_BAT_LEVEL" value="10.5" unit="V"/>
<define name="CRITIC_BAT_LEVEL" value="10.8" unit="V"/>
<define name="LOW_BAT_LEVEL" value="11.0" unit="V"/>
<define name="MAX_BAT_LEVEL" value="12.4" unit="V"/>
</section>
</airframe>
@@ -0,0 +1,243 @@
<!DOCTYPE airframe SYSTEM "../airframe.dtd">
<airframe name="bebop"> <!-- The name of your airframe, not that important -->
<firmware name="rotorcraft">
<target name="ap" board="bebop"/>
<!--define name="USE_SONAR" value="TRUE"/--> <!-- As we have a height from Optitrack we dont need to use the sonar -->
<!-- Subsystem section -->
<subsystem name="telemetry" type="transparent_udp"/>
<subsystem name="radio_control" type="datalink"/> <!-- We control the bebop through wifi -->
<subsystem name="motor_mixing"/>
<subsystem name="actuators" type="bebop"/>
<subsystem name="imu" type="bebop"/>
<subsystem name="gps" type="datalink"/> <!-- The GPS information also comes over this wifi, as we are sitting in the cyberzoo all the time -->
<subsystem name="stabilization" type="indi"/>
<subsystem name="ahrs" type="int_cmpl_quat">
<configure name="USE_MAGNETOMETER" value="FALSE"/>
<define name="AHRS_USE_GPS_HEADING" value="TRUE"/>
</subsystem>
<subsystem name="ins" type="extended"/>
</firmware>
<!-- This is the place where you add all your modules -->
<!-- If there is a variable you can define in your module you can add it within the load node-->
<!-- Note that for vision the order in which modules are loaded is important -->
<!-- If you place cv_colorfilter before your own module your own module will only get the filtered image-->
<modules main_freq="512">
<load name="geo_mag.xml"/>
<load name="air_data.xml"/>
<load name="send_imu_mag_current.xml"/>
<load name="video_thread.xml">
<define name="VIDEO_THREAD_FPS" value="4"/>
<define name="VIDEO_THREAD_CAMERA" value="front_camera"/>
<define name="VIDEO_THREAD_SHOT_PATH" value="/data/ftp/internal_000/images"/>
</load>
<load name="cv_colorfilter.xml">
</load>
<load name="orange_avoider.xml">
</load>
<load name="video_rtp_stream.xml">
<define name="VIEWVIDEO_DOWNSIZE_FACTOR" value="1"/>
<define name="VIEWVIDEO_QUALITY_FACTOR" value="70"/>
</load>
</modules>
<commands>
<axis name="PITCH" failsafe_value="0"/>
<axis name="ROLL" failsafe_value="0"/>
<axis name="YAW" failsafe_value="0"/>
<axis name="THRUST" failsafe_value="6000"/>
</commands>
<servos driver="Default">
<servo name="TOP_RIGHT" no="0" min="3000" neutral="3000" max="12000"/>
<servo name="TOP_LEFT" no="1" min="3000" neutral="3000" max="12000"/>
<servo name="BOTTOM_LEFT" no="2" min="3000" neutral="3000" max="12000"/>
<servo name="BOTTOM_RIGHT" no="3" min="3000" neutral="3000" max="12000"/>
</servos>
<section name="MIXING" prefix="MOTOR_MIXING_">
<!-- Time cross layout (X), with order NW (CW), NE (CCW), SE (CW), SW (CCW) -->
<define name="TYPE" value="QUAD_X"/>
</section>
<command_laws>
<call fun="motor_mixing_run(autopilot_motors_on,FALSE,values)"/>
<set servo="TOP_LEFT" value="motor_mixing.commands[MOTOR_FRONT_LEFT]"/>
<set servo="TOP_RIGHT" value="motor_mixing.commands[MOTOR_FRONT_RIGHT]"/>
<set servo="BOTTOM_RIGHT" value="motor_mixing.commands[MOTOR_BACK_RIGHT]"/>
<set servo="BOTTOM_LEFT" value="motor_mixing.commands[MOTOR_BACK_LEFT]"/>
</command_laws>
<section name="AIR_DATA" prefix="AIR_DATA_">
<define name="CALC_AIRSPEED" value="FALSE"/>
<define name="CALC_TAS_FACTOR" value="FALSE"/>
<define name="CALC_AMSL_BARO" value="TRUE"/>
</section>
<!-- The IMU calibration can be quite important -->
<!-- Follow the MAVLab video to see how you can calibrate it -->
<!-- If your drone tends to always go forward check your primary flight display -->
<!-- Put the drone on a table, if the horizon is not perfectly straight you might want -->
<!-- to adjust your body to imu variables until it is -->
<section name="IMU" prefix="IMU_">
<!-- Magneto calibration -->
<define name="MAG_X_NEUTRAL" value="18"/>
<define name="MAG_Y_NEUTRAL" value="157"/>
<define name="MAG_Z_NEUTRAL" value="49"/>
<define name="MAG_X_SENS" value="10.5007722373" integer="16"/>
<define name="MAG_Y_SENS" value="11.1147400462" integer="16"/>
<define name="MAG_Z_SENS" value="11.6479371722" integer="16"/>
<!-- Magneto current calibration -->
<define name="MAG_X_CURRENT_COEF" value="0.0"/>
<define name="MAG_Y_CURRENT_COEF" value="0.0"/>
<define name="MAG_Z_CURRENT_COEF" value="0.0"/>
<define name="BODY_TO_IMU_PHI" value="0." unit="deg"/>
<define name="BODY_TO_IMU_THETA" value="0." unit="deg"/>
<define name="BODY_TO_IMU_PSI" value="0." unit="deg"/>
</section>
<!-- local magnetic field -->
<!-- http://wiki.paparazziuav.org/wiki/Subsystem/ahrs#Local_Magnetic_Field -->
<section name="AHRS" prefix="AHRS_">
<!-- values used if no GPS fix, on 3D fix is update by geo_mag module -->
<!-- Delft -->
<define name="H_X" value="0.3892503"/>
<define name="H_Y" value="0.0017972"/>
<define name="H_Z" value="0.9211303"/>
</section>
<section name="INS" prefix="INS_">
<define name="SONAR_MAX_RANGE" value="2.2"/>
<define name="SONAR_UPDATE_ON_AGL" value="TRUE"/>
</section>
<section name="RC_SETPOINT" prefix="STABILIZATION_ATTITUDE_">
<!-- setpoint limits for attitude stabilization rc flight -->
<define name="SP_MAX_PHI" value="45" unit="deg"/>
<define name="SP_MAX_THETA" value="45" unit="deg"/>
<define name="SP_MAX_R" value="100" unit="deg/s"/>
<define name="DEADBAND_A" value="0"/>
<define name="DEADBAND_E" value="0"/>
<define name="DEADBAND_R" value="50"/>
</section>
<section name="STABILIZATION_RATE" prefix="STABILIZATION_RATE_">
<!-- setpoints -->
<define name="SP_MAX_P" value="140" unit="deg/s"/>
<define name="SP_MAX_Q" value="140" unit="deg/s"/>
<define name="SP_MAX_R" value="140" unit="deg/s"/>
<define name="DEADBAND_P" value="20"/>
<define name="DEADBAND_Q" value="20"/>
<define name="DEADBAND_R" value="200"/>
<!-- feedback -->
<define name="GAIN_P" value="400"/>
<define name="GAIN_Q" value="400"/>
<define name="GAIN_R" value="350"/>
<define name="IGAIN_P" value="75"/>
<define name="IGAIN_Q" value="75"/>
<define name="IGAIN_R" value="50"/>
</section>
<section name="ATTITUDE_REFERENCE" prefix="STABILIZATION_ATTITUDE_">
<!-- attitude reference generation model -->
<define name="REF_OMEGA_P" value="450" unit="deg/s"/>
<define name="REF_ZETA_P" value="0.9"/>
<define name="REF_MAX_P" value="600." unit="deg/s"/>
<define name="REF_MAX_PDOT" value="RadOfDeg(8000.)"/>
<define name="REF_OMEGA_Q" value="450" unit="deg/s"/>
<define name="REF_ZETA_Q" value="0.9"/>
<define name="REF_MAX_Q" value="600." unit="deg/s"/>
<define name="REF_MAX_QDOT" value="RadOfDeg(8000.)"/>
<define name="REF_OMEGA_R" value="450" unit="deg/s"/>
<define name="REF_ZETA_R" value="0.9"/>
<define name="REF_MAX_R" value="600." unit="deg/s"/>
<define name="REF_MAX_RDOT" value="RadOfDeg(8000.)"/>
</section>
<section name="STABILIZATION_ATTITUDE_INDI" prefix="STABILIZATION_INDI_">
<!-- control effectiveness -->
<define name="G1_P" value="0.0639"/>
<define name="G1_Q" value="0.0361"/>
<define name="G1_R" value="0.0022"/>
<define name="G2_R" value="0.1450"/>
<!-- reference acceleration for attitude control -->
<define name="REF_ERR_P" value="600.0"/>
<define name="REF_ERR_Q" value="600.0"/>
<define name="REF_ERR_R" value="600.0"/>
<define name="REF_RATE_P" value="28.0"/>
<define name="REF_RATE_Q" value="28.0"/>
<define name="REF_RATE_R" value="28.0"/>
<!--Maxium yaw rate, to avoid instability-->
<define name="MAX_R" value="120.0"/> <!--deg/s-->
<!-- second order filter parameters -->
<define name="FILT_OMEGA" value="50.0"/>
<define name="FILT_ZETA" value="0.55"/>
<define name="FILT_OMEGA_R" value="50.0"/>
<define name="FILT_ZETA_R" value="0.55"/>
<!-- first order actuator dynamics -->
<define name="ACT_DYN_P" value="0.1"/>
<define name="ACT_DYN_Q" value="0.1"/>
<define name="ACT_DYN_R" value="0.1"/>
<!-- Adaptive Learning Rate -->
<define name="USE_ADAPTIVE" value="FALSE"/>
<define name="ADAPTIVE_MU" value="0.0001"/>
</section>
<section name="GUIDANCE_V" prefix="GUIDANCE_V_">
<define name="HOVER_KP" value="283"/>
<define name="HOVER_KD" value="82"/>
<define name="HOVER_KI" value="13"/>
<define name="NOMINAL_HOVER_THROTTLE" value="0.655"/>
<define name="ADAPT_THROTTLE_ENABLED" value="TRUE"/>
</section>
<section name="GUIDANCE_H" prefix="GUIDANCE_H_">
<!-- Good weather -->
<define name="MAX_BANK" value="20" unit="deg"/>
<!-- Bad weather -->
<!-- define name="MAX_BANK" value="32" unit="deg"/ -->
<define name="PGAIN" value="79"/>
<define name="DGAIN" value="100"/>
<define name="IGAIN" value="30"/>
</section>
<section name="NAVIGATION" prefix="NAV_">
<define name="CLIMB_VSPEED" value="2.5" />
<define name="DESCEND_VSPEED" value="-1.0" />
</section>
<!-- Here you put the modes that your drone can fly in -->
<!-- If you are using a hobbyking joystick mode_manual and mode_auto2 have to be set-->
<!-- These settings are probably ok for your project! -->
<section name="AUTOPILOT">
<define name="MODE_STARTUP" value="AP_MODE_NAV"/>
<define name="MODE_MANUAL" value="AP_MODE_ATTITUDE_DIRECT"/>
<define name="MODE_AUTO1" value="AP_MODE_ATTITUDE_Z_HOLD"/>
<define name="MODE_AUTO2" value="AP_MODE_NAV"/>
</section>
<section name="BAT">
<define name="MILLIAMP_AT_FULL_THROTTLE" value="8700"/>
<define name="CATASTROPHIC_BAT_LEVEL" value="10.8" unit="V"/>
<define name="CRITIC_BAT_LEVEL" value="11.0" unit="V"/>
<define name="LOW_BAT_LEVEL" value="11.2" unit="V"/>
<define name="MAX_BAT_LEVEL" value="12.4" unit="V"/>
</section>
</airframe>
@@ -0,0 +1,124 @@
<!DOCTYPE flight_plan SYSTEM "../flight_plan.dtd">
<flight_plan alt="1.5" ground_alt="0" lat0="51.990634" lon0="4.376789" max_dist_from_home="8" name="Bebop avoid orange TU Delft Cyberzoo" security_height="0.4">
<header>
#include "autopilot.h"
#include "subsystems/ahrs.h"
#include "subsystems/electrical.h"
#include "subsystems/datalink/datalink.h"
</header>
<waypoints>
<waypoint height="0" name="HOME" x="0.0" y="0.0"/>
<waypoint height="5" name="CLIMB" x="1.2" y="-0.6"/>
<waypoint name="GOAL" x="2.0" y="2.0"/>
<waypoint height="1.342321" name="STDBY" x="-0.7" y="-0.8"/>
<waypoint name="TD" x="0.8" y="-1.7"/>
<waypoint lat="51.9906213" lon="4.3768628" name="_CZ1"/>
<waypoint lat="51.9905874" lon="4.3767766" name="_CZ2"/>
<waypoint lat="51.9906409" lon="4.3767226" name="_CZ3"/>
<waypoint lat="51.990667" lon="4.376806" name="_CZ4"/>
<waypoint lat="51.990624" lon="4.376845" name="_OZ1"/>
<waypoint lat="51.990601" lon="4.376782" name="_OZ2"/>
<waypoint alt="11.5" lat="51.990638" lon="4.376748" name="_OZ3"/>
<waypoint lat="51.990657" lon="4.376804" name="_OZ4"/>
</waypoints>
<sectors>
<sector color="red" name="CyberZoo">
<corner name="_CZ1"/>
<corner name="_CZ2"/>
<corner name="_CZ3"/>
<corner name="_CZ4"/>
</sector>
<sector color="#FF9922" name="ObstacleZone">
<corner name="_OZ1"/>
<corner name="_OZ2"/>
<corner name="_OZ3"/>
<corner name="_OZ4"/>
</sector>
</sectors>
<exceptions>
<exception cond="!InsideCyberZoo(GetPosX(), GetPosY())" deroute="Standby"/>
<exception cond="datalink_time > 2" deroute="Land here"/>
<exception cond="electrical.bat_low && !(nav_block == IndexOfBlock('Land')) && !(nav_block == IndexOfBlock('Flare')) && !(nav_block == IndexOfBlock('Landed'))" deroute="Land"/>
<exception cond="electrical.bat_critical && !(nav_block == IndexOfBlock('Land')) && !(nav_block == IndexOfBlock('Flare')) && !(nav_block == IndexOfBlock('Landed'))" deroute="Land here"/>
</exceptions>
<blocks>
<block name="Wait GPS">
<call fun="NavKillThrottle()"/>
<while cond="!GpsFixValid()"/>
</block>
<block name="Geo init">
<while cond="LessThan(NavBlockTime(), 2)"/>
<call fun="NavSetAltitudeReferenceHere()"/>
</block>
<block name="Holding point">
<call fun="NavKillThrottle()"/>
<attitude pitch="0" roll="0" throttle="0" until="FALSE" vmode="throttle"/>
</block>
<block key="r" name="Start Engine">
<call fun="NavResurrect()"/>
<attitude pitch="0" roll="0" throttle="0" until="FALSE" vmode="throttle"/>
</block>
<block key="t" name="Takeoff" strip_button="Takeoff" strip_icon="takeoff.png">
<exception cond="stateGetPositionEnu_f()->z > 1.25" deroute="Standby"/>
<call 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 fun="NavSetWaypointHere(WP_STDBY)"/>
<stay wp="STDBY"/>
</block>
<block key="g" name="START" strip_button="Go" strip_icon="lookfore.png">
<call fun="NavSetWaypointHere(WP_GOAL)"/>
</block>
<block name="StayGoal">
<go wp="GOAL"/>
<exception cond="block_time > 1" deroute="MoveGoalForward"/>
<exception cond="!safeToGoForwards" deroute="ChangeHeading"/>
<exception cond="!InsideObstacleZone(GetPosX(),GetPosY())" deroute="PrepareObstacleRun"/>
</block>
<block name="MoveGoalForward">
<call fun="moveWaypointForwards(WP_GOAL,3.0)"/>
<deroute block="StayGoal"/>
<exception cond="!safeToGoForwards" deroute="ChangeHeading"/>
<exception cond="!InsideObstacleZone(WaypointX(WP_GOAL),WaypointY(WP_GOAL))" deroute="PrepareObstacleRun"/>
</block>
<block name="ChangeHeading">
<call fun="NavSetWaypointHere(WP_STDBY)"/>
<while cond="1">
<call fun="increase_nav_heading(&nav_heading, incrementForAvoidance)"/>
<call fun="moveWaypointForwards(WP_GOAL,3.0)"/>
<go wp="STDBY"/>
</while>
<exception cond="safeToGoForwards" deroute="StayGoal"/>
</block>
<block name="PrepareObstacleRun">
<call fun="NavSetWaypointHere(WP_STDBY)"/>
<call fun="nav_set_heading_towards_waypoint(WP_HOME)"/>
<stay wp="STDBY"/>
<exception cond="block_time > 1" deroute="GetOutOfObstacleZone"/>
</block>
<block name="GetOutOfObstacleZone">
<call fun="moveWaypointForwards(WP_GOAL,0.5)"/>
<call fun="chooseRandomIncrementAvoidance()"/>
<stay wp="GOAL"/>
<exception cond="block_time > 1" deroute="START"/>
</block>
<block key="l" name="Land here" strip_button="Land Here" strip_icon="land-right.png">
<call fun="NavSetWaypointHere(WP_TD)"/>
</block>
<block name="Land">
<go wp="TD"/>
</block>
<block name="Flare">
<exception cond="NavDetectGround()" deroute="Holding point"/>
<exception cond="!nav_is_in_flight()" deroute="Landed"/>
<call fun="NavStartDetectGround()"/>
<stay climb="nav_descend_vspeed" vmode="climb" wp="TD"/>
</block>
<block name="Landed">
<call fun="NavKillThrottle()"/>
<attitude pitch="0" roll="0" throttle="0" until="FALSE" vmode="throttle"/>
</block>
</blocks>
</flight_plan>
@@ -27,6 +27,15 @@
<corner name="FA1"/>
</sector>
</sectors>
<exceptions>
<!-- Check inside small flight area, then goto Center(Standby) -->
<exception cond="Or(! InsideFlight_Area(GetPosX(), GetPosY()), GetPosAlt() > GetAltRef() + 50) && !(nav_block == BLOCK_Init) && !(nav_block == BLOCK_Geo_init) && !(nav_block == BLOCK_Landed)" deroute="Standby"/>
<!-- Check if battery is empty, then Land Here -->
<exception cond="electrical.bat_low && !(nav_block == BLOCK_Land) && !(nav_block == BLOCK_Flare) && !(nav_block == BLOCK_Landed)" deroute="Land_Here"/>
<!-- Check if time is up(10 seconds range), then Land Here -->
<exception cond="10 > time_until_end && !(nav_block == BLOCK_Land) && !(nav_block == BLOCK_Flare) && !(nav_block == BLOCK_Landed)" deroute="Land_Here"/>
</exceptions>
<blocks>
<block name="Wait GPS">
<call fun="NavKillThrottle()"/>
+21
View File
@@ -0,0 +1,21 @@
<!DOCTYPE module SYSTEM "module.dtd">
<module name="orange_avoider">
<doc>
<description>
Avoid all objects that are orange!
This example module shows how you can use the camera stream and colorfilter to detect orange objects.
By adding this module to your flightplan and flying in the cyberzoo with the flightplan TUDELFT/tudelft_course2016_avoid_orange_cyberzoo.xml you will avoid every obstacle that is orange.
</description>
</doc>
<depends>cv_colorfilter.xml</depends>
<header>
<file name="orange_avoider.h"/>
</header>
<init fun="orange_avoider_init()"/>
<periodic fun="orange_avoider_periodic()" freq="4"/>
<makefile>
<file name="orange_avoider.c"/>
</makefile>
</module>
@@ -0,0 +1,88 @@
/*
* Copyright (C) Roland Meertens
*
* This file is part of paparazzi
*
*/
/**
* @file "modules/orange_avoider/orange_avoider.c"
* @author Roland Meertens
* Example on how to use the colours detected to avoid orange pole in the cyberzoo
*/
#include "modules/orange_avoider/orange_avoider.h"
#include "modules/computer_vision/colorfilter.h"
#include "firmwares/rotorcraft/navigation.h"
#include "state.h"
#include <time.h>
#include <stdlib.h>
uint8_t safeToGoForwards = FALSE;
int tresholdColorCount = 200;
int32_t incrementForAvoidance;
void orange_avoider_init()
{
// Initialise the variables of the colorfilter to accept orange
color_lum_min = 0;
color_lum_max = 131;
color_cb_min = 93;
color_cb_max = 255;
color_cr_min = 134;
color_cr_max = 255;
// Initialise random values
srand(time(NULL));
chooseRandomIncrementAvoidance();
}
void orange_avoider_periodic()
{
// Check the amount of orange. If this is above a threshold
// you want to turn a certain amount of degrees
safeToGoForwards = color_count < tresholdColorCount;
printf("Checking if this funciton is called %d treshold: %d now: %d \n", color_count, tresholdColorCount,
safeToGoForwards);
}
/**
* Increases the NAV heading. Assumes heading is an INT32_ANGLE. It is bound in this function.
*/
uint8_t increase_nav_heading(int32_t *heading, int32_t increment)
{
*heading = *heading + increment;
// Check if your turn made it go out of bounds...
INT32_ANGLE_NORMALIZE(*heading); // HEADING HAS INT32_ANGLE_FRAC....
return FALSE;
}
uint8_t moveWaypointForwards(uint8_t waypoint, float distanceMeters)
{
struct EnuCoor_i new_coor;
struct EnuCoor_i *pos = stateGetPositionEnu_i(); // Get your current position
// Calculate the sine and cosine of the heading the drone is keeping
float sin_heading = sinf(ANGLE_FLOAT_OF_BFP(nav_heading));
float cos_heading = cosf(ANGLE_FLOAT_OF_BFP(nav_heading));
// Now determine where to place the waypoint you want to go to
new_coor.x = pos->x + POS_BFP_OF_REAL(sin_heading * (distanceMeters));
new_coor.y = pos->y + POS_BFP_OF_REAL(cos_heading * (distanceMeters));
new_coor.z = pos->z; // Keep the height the same
// Set the waypoint to the calculated position
waypoint_set_xy_i(waypoint, new_coor.x, new_coor.y);
return FALSE;
}
uint8_t chooseRandomIncrementAvoidance()
{
int r = rand() % 2;
if (r == 0) {
incrementForAvoidance = 350;
} else {
incrementForAvoidance = -350;
}
return FALSE;
}
@@ -0,0 +1,26 @@
/*
* Copyright (C) Roland Meertens
*
* This file is part of paparazzi
*
*/
/**
* @file "modules/orange_avoider/orange_avoider.h"
* @author Roland Meertens
* Example on how to use the colours detected to avoid orange pole in the cyberzoo
*/
#ifndef ORANGE_AVOIDER_H
#define ORANGE_AVOIDER_H
#include <inttypes.h>
extern uint8_t safeToGoForwards;
extern int32_t incrementForAvoidance;
extern void orange_avoider_init(void);
extern void orange_avoider_periodic(void);
extern uint8_t moveWaypointForwards(uint8_t waypoint, float distanceMeters);
extern uint8_t increase_nav_heading(int32_t *heading, int32_t increment);
extern uint8_t chooseRandomIncrementAvoidance(void);
#endif