RC Transmitter Flight Mode Configuration — Mission Planner documentation

Notice: Undefined index: HTTP_ACCEPT in /home/n/newavtjc/radiocopter.ru/public_html/wp-content/plugins/realbig-media/textEditing.php on line 823

Introduction

This past winter I invested in a new transmitter. After weeks of research and reading discussion boards I settled on getting a Taranis Plus for a few reasons including flexibility in programming and low cost to function/feature ratio. I was really attracted to the Taranis because the of the flexibility it offered in letting the pilot chose which switches go to which channels.

Abstract

This article will demonstrate a couple of ways the Taranis X9D Plus can be programmed to provide 7 flight modes for the APM:Copter. Other information in this article that you may find useful is the addition of voice announcements and a volume control slider.

Adding a new flight mode to copter — dev documentation

This section covers the basics of how to create a new high level flight mode (i.e. equivalent of Stabilize, Loiter, etc)

Смотрите про коптеры:  RSSI Flysky FS-iA6B. Модернизируем приемник. ⋆

As a reference the diagram below provides a high level view of Copter’s architecture.

../_images/copter-architecture.png

  1. Pick a name for the new mode and add it to the bottom of the control_mode_t enum in modes.h just like “NEW_MODE” has been added below.

    //AutoPilotModesenumerationenumclassNumber{STABILIZE=0,//manualairframeanglewithmanualthrottleACRO=1,//manualbody-frameangularratewithmanualthrottleALT_HOLD=2,//manualairframeanglewithautomaticthrottleAUTO=3,//fullyautomaticwaypointcontrolusingmissioncommandsGUIDED=4,//fullyautomaticflytocoordinateorflyatvelocity/directionusingGCSimmediatecommandsLOITER=5,//automatichorizontalaccelerationwithautomaticthrottleRTL=6,//automaticreturntolaunchingpointCIRCLE=7,//automaticcircularflightwithautomaticthrottleLAND=9,//automaticlandingwithhorizontalpositioncontrolDRIFT=11,//semi-automousposition,yawandthrottlecontrolSPORT=13,//manualearth-frameangularratecontrolwithmanualthrottleFLIP=14,//automaticallyflipthevehicleontherollaxisAUTOTUNE=15,//automaticallytunethevehicle's roll and pitch gainsPOSHOLD=16,//automaticpositionholdwithmanualoverride,withautomaticthrottleBRAKE=17,//full-brakeusinginertial/GPSsystem,nopilotinputTHROW=18,//throwtolaunchmodeusinginertial/GPSsystem,nopilotinputAVOID_ADSB=19,//automaticavoidanceofobstaclesinthemacroscale-e.g.full-sizedaircraftGUIDED_NOGPS=20,//guidedmodebutonlyacceptsattitudeandaltitudeSMART_RTL=21,//SMART_RTLreturnstohomebyretracingitsstepsFLOWHOLD=22,//FLOWHOLDholdspositionwithopticalflowwithoutrangefinderFOLLOW=23,//followattemptstofollowanothervehicleorgroundstationZIGZAG=24,//ZIGZAGmodeisabletoflyinazigzagmannerwithpredefinedpointAandpointBSYSTEMID=25,//SystemIDmodeproducesautomatedsystemidentificationsignalsinthecontrollersAUTOROTATE=26,//AutonomousautorotationNEW_MODE=27,//yournewflightmode};
  2. Define a new class for the mode in mode.h.
    It is probably easiest to copy a similar existing mode’s class definition and just change the class name (i.e. copy and rename “class ModeStabilize” to “class ModeNewMode”).
    The new class should inherit from the Mode class and implement run(), name() and name4() and optionally init().

    The name() and name4() methods are for logging and display purposes. init() will be called when the vehicle first switches into this new mode so it should implement any required initialisation. run() will be called at 400hz and should implement any pilot input decoding and then set position and attitude targets (see below).

    There are also some simple methods returning true/false that you may want to override that control features such as whether the vehicle can be armed in the new mode:

  3. Create a new mode_<new flight mode>.cpp file based on a similar mode such as
    mode_stabilize.cpp
    or mode_loiter.cpp.
    This new file should probably implement the init() method which will be called when the vehicle first enters the mode. This function should return true if it is OK for the vehicle to enter the mode, false if it cannot.
    Below is an excerpt from mode_rtl.cpp’s init method that shows how the vehicle cannot enter RTL mode unless the home position has been set.

    Below is an excerpt from mode_stabilize.cpp’s run method (called 400 times per second) that decodes the user’s input, then sends new targets to the attitude controller.

  4. Instantiate the new mode class in Copter.h by searching for “ModeAcro” and then adding the new mode somewhere below.

  5. In mode.cpp add the new mode to the mode_from_mode_num() function to create the mapping between the mode’s number and the instance of the class.

  6. Add the new flight mode to the list of valid @Values for the FLTMODE1~FLTMODE6 parameters in Parameters.cpp (Search for “FLTMODE1”). Once committed to master, this will cause the new mode to appear in the ground stations list of valid modes.
    Note that even before being committed to master, a user can setup the new flight mode to be activated from the transmitter’s flight mode switch by directly setting the FLTMODE1 (or FLTMODE2, etc) parameters to the number of the new mode.

    //@Param:FLTMODE1//@DisplayName:FlightMode1//@Description:FlightmodewhenChannel5pwmis<=1230//@Values:0:Stabilize,1:Acro,2:AltHold,3:Auto,4:Guided,5:Loiter,6:RTL,7:Circle,9:Land,11:Drift,13:Sport,14:Flip,15:AutoTune,16:PosHold,17:Brake,18:Throw,19:Avoid_ADSB,20:Guided_NoGPS,21:Smart_RTL,22:FlowHold,23:Follow,24:ZigZag//@User:StandardGSCALAR(flight_mode1,"FLTMODE1",FLIGHT_MODE_1),//@Param:FLTMODE2//@DisplayName:FlightMode2//@Description:FlightmodewhenChannel5pwmis>1230,<=1360//@Values:0:Stabilize,1:Acro,2:AltHold,3:Auto,4:Guided,5:Loiter,6:RTL,7:Circle,9:Land,11:Drift,13:Sport,14:Flip,15:AutoTune,16:PosHold,17:Brake,18:Throw,19:Avoid_ADSB,20:Guided_NoGPS,21:Smart_RTL,22:FlowHold,23:Follow,24:ZigZag//@User:StandardGSCALAR(flight_mode2,"FLTMODE2",FLIGHT_MODE_2),
  7. Optionally you may wish to add the flight mode to the COPTER_MODE enum within the mavlink/ardupilotmega.xml because some ground stations may use this to automatically populate the list of available flight modes.

Adding voice announcements.

You can personalize any of the 6 flight modes for your use. I added voice to the flight modes so that the Taranis will tell me which flight mode I switched to without looking down away from my copter.

Screenshot of the special functions that play tracks of voice when the switch is activated. By the way, I added Special Function 8 which (SF8) which makes knob S2 control the volume of the speaker.

My home-built FormicaQuad in loiter mode.

Alternatives..

Like I said before, there are more than one way to achieve the same result (I was going to say, skin a cat, but I didn’t want to offend any cat lovers out there). After thinking about it for a minute or two, I devised a way of producing the 6 flight modes without creating logical switches.

Screenshot of the OpenTX Companion Mixes tab showing entries to produce 6 flight modes for APM:Copter using only mixed physical switches (no logical switches programmed). In this setup we are not starting at -100% weight, but somewhere in the middle of the range.

Switch Setting

Target Weight %

Achieved Weight %

SD (fwd) & SG (fwd)

-65

-64.8

SD (fwd) & SG (Mid)

-41

-41.0

SD (fwd) & SG (back)

-15

-14.8

SD (mid) & SG (fwd)

10

11.1

SD (mid) & SG (mid)

36

34.0

SD (mid) & SG (back)

61

61.1

Utilizing this scheme the flight modes will be entered into Mission Planner in the order of

FM1 – SD(fwd) & SG(fwd)FM2 – SD(fwd) & SG(mid)FM3 – SD(fwd) & SG(back)FM6 – SD(mid) & SG(fwd)FM5 – SD(mid) & SG(mid)FM4 – SD(mid) & SG(back)

With this alternative setup, here are the PWM Values of the AMP:Copter

 

PW

 

PW

Target PW

Switch Setting

Target Weight %

Achieved Weight %

Ideal settings APM:Copter

PWM Values Achieved

FM 1

991

1230

1166

SD (fwd) & SG (fwd)

-65

-64.8

1165

1171

FM 2

1231

1360

1296

SD (fwd) & SG (mid)

-41

-41.0

1295

1293

FM 3

1361

1490

1426

SD (fwd) & SG (back)

-15

-14.8

1425

1428

FM 4

1491

1620

1556

SD (mid) & SG (fwd)

10

11.1

1555

1560

FM 5

1621

1749

1685

SD (mid) & SG (mid)

36

34.0

1685

1682

FM 6

1750

2023

1815

SD (mid) & SG (back)

61

61.1

1815

1816

The PWM Values are almost right on dead center of the ranges. For me, it was a little more difficult to get to the end result, but possible.

Decide which switches to select the flight modes.

Most transmitters that I am familiar with don’t have a built-in 6 position switch. If you’re does, great!, you can stop reading here and go back to the reading the owner’s manual. Many of the higher-end transmitters have a variable pot. Yes, you can use a multivariable pot or slider, but I imagine it is pretty hard to adjust it to a defined value without defined clicks or positions, especially while flying and most especially if operating in a panicked mode.

Ek2_ parameters¶

EK2_MAG_CAL: Magnetometer default fusion mode

Note: This parameter is for advanced users

This determines when the filter will use the 3-axis magnetometer fusion model that estimates both earth and body fixed magnetic field states, when it will use a simpler magnetic heading fusion model that does not use magnetic field states and when it will use an alternative method of yaw determination to the magnetometer. The 3-axis magnetometer fusion is only suitable for use when the external magnetic field environment is stable. EK2_MAG_CAL = 0 uses heading fusion on ground, 3-axis fusion in-flight, and is the default setting for Plane users. EK2_MAG_CAL = 1 uses 3-axis fusion only when manoeuvring. EK2_MAG_CAL = 2 uses heading fusion at all times, is recommended if the external magnetic field is varying and is the default for rovers. EK2_MAG_CAL = 3 uses heading fusion on the ground and 3-axis fusion after the first in-air field and yaw reset has completed, and is the default for copters. EK2_MAG_CAL = 4 uses 3-axis fusion at all times. NOTE: The fusion mode can be forced to 2 for specific EKF cores using the EK2_MAG_MASK parameter. NOTE: limited operation without a magnetometer or any other yaw sensor is possible by setting all COMPASS_USE, COMPASS_USE2, COMPASS_USE3, etc parameters to 0 with COMPASS_ENABLE set to 1. If this is done, the EK2_GSF_RUN and EK2_GSF_USE masks must be set to the same as EK2_IMU_MASK.

June 2023 – hilldaflyer

Program the Taranis X9D Plus to select 7 APM flight modes on the APM:Copter with voice announcements.

Mixing the logical switches to produce 6 pwm values

The mixer tab is the place to define the % weight for each logical switch. I used MAX source and then % weight as defined in the table above.

This is a screenshot of OpenTx Companion Mixer Tab with the values used for channel 5. You will notice that I added a half second delay to each of the mixes. This was unnecessary but it provides a slight delay so I have a split second to observe the change in flight modes. With the above % weights locked in, I measured the PWM values that were actually received by the APM.

 

PW

 

PW

Target PW

Values Achieved

FM 1

991

1230

<1230

991

FM 2

1231

1360

1296

1293

FM 3

1361

1490

1426

1421

FM 4

1491

1620

1556

1555

FM 5

1621

1749

1685

1683

FM 6

1750

2023

>1750

2023

I’d say that was a success. The target values were hit every time. A change of 1% weight leads to a 5 micro seconds PWM change, so these could be adjusted a bit if one wanted to do that. You now have 6 different PWM values going to your receiver on channel 5. Congratulations… Do you want to get cool? then add some voice announcements.

References

As indicated earlier, here links are a couple of setups that makes sense to me.

Sr0_ parameters¶

SR0_EXT_STAT: Extended status stream rate to ground station

Stream rate of SYS_STATUS, POWER_STATUS, MCU_STATUS, MEMINFO, CURRENT_WAYPOINT, GPS_RAW_INT, GPS_RTK (if available), GPS2_RAW (if available), GPS2_RTK (if available), NAV_CONTROLLER_OUTPUT, and FENCE_STATUS to ground station

Sr1_ parameters¶

SR1_EXT_STAT: Extended status stream rate to ground station

Stream rate of SYS_STATUS, POWER_STATUS, MCU_STATUS, MEMINFO, CURRENT_WAYPOINT, GPS_RAW_INT, GPS_RTK (if available), GPS2_RAW (if available), GPS2_RTK (if available), NAV_CONTROLLER_OUTPUT, and FENCE_STATUS to ground station

Sr2_ parameters¶

SR2_EXT_STAT: Extended status stream rate to ground station

Stream rate of SYS_STATUS, POWER_STATUS, MCU_STATUS, MEMINFO, CURRENT_WAYPOINT, GPS_RAW_INT, GPS_RTK (if available), GPS2_RAW (if available), GPS2_RTK (if available), NAV_CONTROLLER_OUTPUT, and FENCE_STATUS to ground station

Sr3_ parameters¶

SR3_EXT_STAT: Extended status stream rate to ground station

Stream rate of SYS_STATUS, POWER_STATUS, MCU_STATUS, MEMINFO, CURRENT_WAYPOINT, GPS_RAW_INT, GPS_RTK (if available), GPS2_RAW (if available), GPS2_RTK (if available), NAV_CONTROLLER_OUTPUT, and FENCE_STATUS to ground station

Sr4_ parameters¶

SR4_EXT_STAT: Extended status stream rate to ground station

Stream rate of SYS_STATUS, POWER_STATUS, MCU_STATUS, MEMINFO, CURRENT_WAYPOINT, GPS_RAW_INT, GPS_RTK (if available), GPS2_RAW (if available), GPS2_RTK (if available), NAV_CONTROLLER_OUTPUT, and FENCE_STATUS to ground station

Sr5_ parameters¶

SR5_EXT_STAT: Extended status stream rate to ground station

Stream rate of SYS_STATUS, POWER_STATUS, MCU_STATUS, MEMINFO, CURRENT_WAYPOINT, GPS_RAW_INT, GPS_RTK (if available), GPS2_RAW (if available), GPS2_RTK (if available), NAV_CONTROLLER_OUTPUT, and FENCE_STATUS to ground station

Sr6_ parameters¶

SR6_EXT_STAT: Extended status stream rate to ground station

Stream rate of SYS_STATUS, POWER_STATUS, MCU_STATUS, MEMINFO, CURRENT_WAYPOINT, GPS_RAW_INT, GPS_RTK (if available), GPS2_RAW (if available), GPS2_RTK (if available), NAV_CONTROLLER_OUTPUT, and FENCE_STATUS to ground station

Using two switches to create 6 pwm values

Most RC pilots will default to selecting the flight modes using the combination of two switches. The task of generating 6 different pulse width modulation (PWM) values can be easily accomplished using a combination of 2 switches, either one switch with two positions in combination with another three position switch or two switches with three positions each.

I decided to use two switches with three positions each (SD and SG) on my transmitter, for no other reason than the Tarnis only has one switch with only two positions (SF) and I use switches SE, SA and SB for other functions like controlling flaps, dual rate and expo on other models.

Conclusion

Being relatively new to the Taranis logic, I can’t say with any degree of certainty that all the steps above are necessary or warranted. All I know is that I understood the logic and programming, plus, it worked to produce 7 flight modes with voice announcements. If you have a suggestion, please leave a comment to help us all learn.

Sr0_ext_stat: extended status stream rate to ground station¶

Stream rate of SYS_STATUS, POWER_STATUS, MCU_STATUS, MEMINFO, CURRENT_WAYPOINT, GPS_RAW_INT, GPS_RTK (if available), GPS2_RAW (if available), GPS2_RTK (if available), NAV_CONTROLLER_OUTPUT, and FENCE_STATUS to ground station

Оцените статью
Радиокоптер.ру
Добавить комментарий