Skip to content

Commit

Permalink
Rotwing control update made compatible with master (#3374)
Browse files Browse the repository at this point in the history
  • Loading branch information
dewagter authored Oct 3, 2024
1 parent 0abafed commit 4e98f10
Show file tree
Hide file tree
Showing 32 changed files with 2,062 additions and 3,448 deletions.
329 changes: 49 additions & 280 deletions conf/airframes/tudelft/rotwing5.xml

Large diffs are not rendered by default.

328 changes: 52 additions & 276 deletions conf/airframes/tudelft/rotwing6.xml

Large diffs are not rendered by default.

258 changes: 258 additions & 0 deletions conf/airframes/tudelft/rotwing_25kg_common.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
<!DOCTYPE airframe SYSTEM "../airframe.dtd">

<airframe>

<section name="CTRL_EFF_SHED" prefix="ROTWING_EFF_SCHED_">
<define name="IXX_BODY" value="0.3953"/>
<define name="IYY_BODY" value="8.472"/>
<define name="IZZ" value="10.18"/>
<define name="IXX_WING" value="0.5385"/>
<define name="IYY_WING" value="1.671"/>
<define name="M" value="23.66"/>

<define name="DM_DPPRZ_HOVER_PITCH" value="{0.0, 0.0111}"/>
<define name="DM_DPPRZ_HOVER_ROLL" value="{0.0, 0.005}"/>

<define name="HOVER_ROLL_PITCH_COEF" value="{0.01994434, -0.00885004}"/>
<define name="HOVER_ROLL_ROLL_COEF" value="{0.0, -0.0}"/>

<define name="K_ELEVATOR" value="{ 1.27655, -6.0, -48.0}"/>
<define name="K_RUDDER" value="{-72.5037, -0.9329, -16.75}"/>
<define name="K_AILERON" value="5.0"/>
<define name="K_FLAPERON" value="2.35"/>
<define name="K_PUSHER" value="{0.027775,-2.41146}"/>

<define name="K_ELEVATOR_DEFLECTION" value="{50.0,-0.0063}"/>
<define name="D_RUDDER_D_PPRZ" value="-0.0018"/>
<define name="K_RPM_PPRZ_PUSHER" value="{1264.51356869248,1.11607176184111,-0.0000229206473957927}"/>

<define name="K_LIFT_WING" value="{-0.7811 -1.4319}"/>
<define name="K_LIFT_FUSELAGE" value="-0.050653927"/>
<define name="K_LIFT_TAIL" value="-0.101691751"/>
</section>

<section name="MISC">
<define name="DEFAULT_CIRCLE_RADIUS" value="300.0"/>

<!-- Others -->
<define name="NAV_CLIMB_VSPEED" value="2.0" />
<define name="NAV_DESCEND_VSPEED" value="-1.0"/>
<define name="NAV_CARROT_DIST" value="300"/>
<define name="AUTOPILOT_IN_FLIGHT_MIN_THRUST" value="300"/>
<define name="ARRIVED_AT_WAYPOINT" value="50.0"/>
<define name="NO_GPS_LOST_WITH_DATALINK_TIME" value="20"/>
<define name="NO_GPS_LOST_WITH_RC_VALID" value="TRUE"/>
<define name="USE_AIRSPEED" value="TRUE"/>
<define name="NAV_HYBRID_MAX_AIRSPEED" value="30"/>
<define name="NAV_HYBRID_MAX_DECELERATION" value="0.8"/>
<define name="MULTI_GPS_MODE" value="GPS_MODE_PRIMARY"/>
<define name="INS_EKF2_FUSION_MODE" value="(MASK_USE_GPS|MASK_USE_GPSYAW)"/>
<define name="INS_EKF2_GPS_YAW_OFFSET" value="0"/>

<!-- Ground detect -->
<define name="GROUND_DETECT_SENSOR_AGL_MIN_VALUE" value="0.24"/>
<define name="USE_GROUND_DETECT_AGL_DIST" value="TRUE"/>

<!-- AGL distance -->
<define name="AGL_DIST_FILTER" value="0.07"/>

<!-- Don't oversaturate the UAVCAN bus -->
<define name="ACTUATORS_UAVCAN_RAW_DIV" value="2"/> <!-- ESC's at half the PERIODIC_FREQ -->
<define name="ACTUATORS_UAVCAN_CMD_DIV" value="4"/> <!-- Servo's at 1/4 the PERIODIC_FREQ -->
</section>

<section name="STABILIZATION_ATTITUDE" prefix="STABILIZATION_ATTITUDE_">
<!-- Limits -->
<define name="SP_MAX_PHI" value="45." unit="deg" />
<define name="SP_MAX_THETA" value="45." unit="deg"/>
<define name="SP_MAX_R" value="90." unit="deg/s"/>
<define name="DEADBAND_R" value="200"/>
<define name="SP_PSI_DELTA_LIMIT" value="5" unit="deg"/>

<!-- Reference model -->
<define name="REF_OMEGA_P" value="800" unit="deg/s"/>
<define name="REF_ZETA_P" value="0.85"/>
<define name="REF_MAX_P" value="300." unit="deg/s"/>
<define name="REF_MAX_PDOT" value="RadOfDeg(7000.)"/>

<define name="REF_OMEGA_Q" value="800" unit="deg/s"/>
<define name="REF_ZETA_Q" value="0.85"/>
<define name="REF_MAX_Q" value="300." unit="deg/s"/>
<define name="REF_MAX_QDOT" value="RadOfDeg(7000.)"/>

<define name="REF_OMEGA_R" value="500" unit="deg/s"/>
<define name="REF_ZETA_R" value="0.85"/>
<define name="REF_MAX_R" value="180." unit="deg/s"/>
<define name="REF_MAX_RDOT" value="RadOfDeg(1800.)"/>

<!-- Gains -->
<define name="PHI_PGAIN" value="500"/>
<define name="PHI_DGAIN" value="230"/>
<define name="PHI_IGAIN" value="10"/>
<define name="PHI_DDGAIN" value="0"/>

<define name="THETA_PGAIN" value="500"/>
<define name="THETA_DGAIN" value="230"/>
<define name="THETA_IGAIN" value="10"/>
<define name="THETA_DDGAIN" value="0"/>

<define name="PSI_PGAIN" value="700"/>
<define name="PSI_DGAIN" value="200"/>
<define name="PSI_IGAIN" value="10"/>
<define name="PSI_DDGAIN" value="0"/>
</section>

<section name="STABILIZATION_ATTITUDE_INDI" prefix="STABILIZATION_INDI_">

<!-- G1 and G2 25 kg-->
<define name="G1_ROLL" value="{ 0.0, -9.0, 0.0, 9.0, 0.0, 0.0, 0.0, 0.0, 0.0}"/>
<define name="G1_PITCH" value="{ 1.14, 0.0, -1.14, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}"/>
<define name="G1_YAW" value="{ -0.29, 0.29, -0.29, 0.29, 0.0, 0.0, 0.0, 0.0, 0.0}"/>
<define name="G1_THRUST" value="{ -0.54, -0.54, -0.54, -0.54, 0.0, 0.0, 0.0, 0.0, 0.0}"/>
<define name="G1_THRUST_X" value="{ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.9}"/>
<define name="G2" value="{ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}"/>

<!-- Actuator dynamics -->
<define name="ACT_FREQ" value="{13.68, 13.68, 13.68, 13.68, 52.7, 52.7, 52.7, 52.7, 24.1}"/>
<define name="ACT_IS_SERVO" value="{ 0, 0, 0, 0, 1, 1, 1, 1, 0}"/>
<define name="ACT_IS_THRUSTER_X" value="{ 0, 0, 0, 0, 0, 0, 0, 0, 1}" />

<!-- Rate INDI -->
<define name="MAX_RATE" value="1.5"/>

<!-- Reference -->
<define name="REF_ERR_P" value="25.0"/>
<define name="REF_ERR_Q" value="25.0"/>
<define name="REF_ERR_R" value="23.0"/>
<define name="REF_RATE_P" value="4.5"/>
<define name="REF_RATE_Q" value="4.5"/>
<define name="REF_RATE_R" value="3.9"/>

<define name="MAX_R" value="30.0" unit="deg/s"/>

<!-- Filters -->
<define name="FILTER_RATES_SECOND_ORDER" value="FALSE" />
<define name="FILT_CUTOFF_P" value="3.0"/>
<define name="FILT_CUTOFF_Q" value="3.0"/>
<define name="FILT_CUTOFF_R" value="3.0"/>
<define name="FILT_CUTOFF" value="2.0"/>
<define name="ESTIMATION_FILT_CUTOFF" value="2.0"/>
<define name="FILTER_YAW_RATE" value="TRUE"/>

<!-- Other -->
<define name="WLS_PRIORITIES" value="{1000, 1000, 1, 100, 100}"/>
<define name="WLS_WU" value="{1.3, 1.3, 1.3, 1.3, 0.2, 1.0, 0.2, 1.0, 1.0}"/>
<define name="USE_ADAPTIVE" value="FALSE"/>
<define name="ADAPTIVE_MU" value="0.001"/>
<define name="YAW_DISTURBANCE_LIMIT" value="0.55"/>
</section>

<section name="GUIDANCE_V" prefix="GUIDANCE_V_">
<!-- Gains -->
<define name="HOVER_KP" value="310"/>
<define name="HOVER_KD" value="130"/>
<define name="HOVER_KI" value="10"/>
<define name="NOMINAL_HOVER_THROTTLE" value="0.42"/>
<define name="ADAPT_THROTTLE_ENABLED" value="FALSE"/>

<!-- Reference -->
<define name="REF_MIN_ZD" value="-4.0"/> <!-- climb -->
<define name="REF_MAX_ZD" value="4.0"/> <!-- descend -->
</section>

<section name="GUIDANCE_H" prefix="GUIDANCE_H_">
<define name="MAX_BANK" value="40" unit="deg"/>
<define name="USE_SPEED_REF" value="TRUE"/>

<!-- Gains -->
<define name="PGAIN" value="60"/>
<define name="DGAIN" value="100"/>
<define name="IGAIN" value="20"/>
<define name="AGAIN" value="0"/>
</section>

<section name="ROTWING" prefix="ROTWING_">
<define name="FW_MIN_AIRSPEED" value="21"/> <!-- Forward stall airspeed + margin (motors off) -->
<define name="FW_QUAD_MIN_AIRSPEED" value="19"/> <!-- Forward stall airspeed + margin with quad motors on -->
<define name="FW_CRUISE_AIRSPEED" value="25"/> <!-- Default cruise airspeed -->
<define name="FW_MAX_AIRSPEED" value="30"/> <!-- Maximum forward airspeed -->
<define name="FW_MAX_DECELERATION" value="0.75"/> <!-- Maximum horizontal deceleration in fixed wing mode -->
<define name="QUAD_NOPUSH_AIRSPEED" value="8"/> <!-- Maximum quadrotor without pusher motor airspeed -->
<define name="QUAD_MAX_AIRSPEED" value="15"/> <!-- Maximum quadrotor airspeed (with pusher motor)-->
<define name="QUAD_MAX_DECELERATION" value="0.75"/> <!-- Maximum horizontal deceleration in quad mode -->
<define name="SKEW_UP_AIRSPEED" value="13"/> <!-- Airspeed where the skewing starts when going up in airspeed -->
<define name="SKEW_DOWN_AIRSPEED" value="11"/> <!-- Airspeed where the skewing starts when going down in airspeed -->

<define name="SKEW_REF_MODEL" value="FALSE"/> <!-- Enable second order reference model for the skewing command -->
<define name="SKEW_REF_MODEL_P_GAIN" value="0.004"/> <!-- Skewing reference model proportional gain -->
<define name="SKEW_REF_MODEL_D_GAIN" value="0.007"/> <!-- Skewing reference model differential gain -->
<define name="SKEW_REF_MODEL_MAX_SPEED" value="9.6"/> <!-- Maximum rotational skewing speed bound for the reference model -->
</section>

<section name="GUIDANCE_INDI_HYBRID" prefix="GUIDANCE_INDI_">
<!--WLS settings-->
<define name="USE_WLS" value="TRUE"/>
<define name="WLS_PRIORITIES" value="{10., 10., 10.}"/>
<define name="WLS_WU" value="{100., 3000., 4., 30.}"/>

<!-- Gains -->
<define name="POS_GAIN" value="1.0"/>
<define name="POS_GAINZ" value="0.5"/>
<define name="SPEED_GAIN" value="0.7"/>
<define name="SPEED_GAINZ" value="0.6"/>

<!-- Other -->
<define name="FILTER_CUTOFF" value="2.0"/>
<define name="HEADING_BANK_GAIN" value="5."/>
<define name="MAX_AIRSPEED" value="25.0"/>
<define name="PITCH_LIFT_EFF" value="0.0"/>

<define name="THRUST_Z_EFF" value="-0.0023"/>

<define name="MAX_PUSHER_INCREMENT" value="2000"/>

<define name="NAV_CIRCLE_DIST" value="60."/>
<define name="NAV_LINE_DIST" value="100"/>
<define name="PUSHER_INDEX" value="8"/>

<define name="MAX_PITCH" value="12"/>
<define name="MIN_PITCH" value="-20"/>
<define name="MAX_LAT_ACCEL" value="4.0"/>

<!-- Climb and descend speeds -->
<define name="FWD_CLIMB_SPEED" value="2.0"/>
<define name="FWD_DESCEND_SPEED" value="-3.0"/>
<define name="QUAD_CLIMB_SPEED" value="2.0"/>
<define name="QUAD_DESCEND_SPEED" value="-1.0"/>
</section>

<section name="FORWARD">
<define name="TURN_AIRSPEED_TH" value="8.0"/>
<define name="TRANSITION_MAX_OFFSET" value="0.0" unit="deg"/>
</section>

<section name="AMT" prefix="APPROACH_MOVING_TARGET_">
<define name="CUTOFF_FREQ_FILTERS_HZ" value="0.25"/>
<define name="ERR_SLOWDOWN_GAIN" value="0.25" />
<define name="SLOPE" value="60.0"/>
<define name="DISTANCE" value="70.0"/>
<define name="SPEED" value="0.0"/>
</section>

<section name="AUTOPILOT">
<define name="MODE_MANUAL" value="AP_MODE_ATTITUDE_DIRECT"/>
<define name="MODE_AUTO1" value="AP_MODE_FORWARD"/>
<define name="MODE_AUTO2" value="AP_MODE_NAV"/>
<define name="MODE_STARTUP" value="AP_MODE_NAV"/>
</section>

<section name="SIMULATOR" prefix="NPS_">
<define name="ACTUATOR_NAMES" value="front_motor, right_motor, back_motor, left_motor, rudder, elevator, aileron, flaperon, pusher, skew" type="string[]"/>
<define name="JSBSIM_MODEL" value="rotwing25" type="string"/>
<define name="SENSORS_PARAMS" value="nps_sensors_params_default.h" type="string"/>
<define name="COMMANDS_NB" value="9"/>
<define name="NO_MOTOR_MIXING" value="TRUE"/>
<define name="JS_AXIS_MODE" value="4"/>
</section>

</airframe>
Loading

0 comments on commit 4e98f10

Please sign in to comment.