User Tools

Site Tools


Sidebar

Table of contents

docs:config.h

This is an old revision of the document!


Config.h settings

Settings found in config.h are used for customizing quadcopter flight settings and a number of software settings.

Flight control settings

This settings comprise of rate control, high and low, expo, if needed to be performed by quad itself ( for stock tx) and switch config, mainly for level mode switching.

Rate

The rate is changed by the following lines in config.h file. The unit is degrees / second. The number is the rotation rate at max stick deflection, for example 360 would perform a full turn in 1 second.

// rate in deg/sec
// for acro mode
#define MAX_RATE 360.0
#define MAX_RATEYAW 360.0

Low rates are controlled by a multiplier, which is applied to the rates above. The low rates are usually used for the stock tx, as the rate hi/low channel is also set by default to work with it.

#define LOW_RATES_MULTI 0.5f

Switches (auxiliary channels)

Switches/buttons are used to control functions such as level/acro mode change, dual rates and flips.

This functions can be assigned to any channel, if using a devo or a module. The number of channels depends on radio protocol specifications.

For the stock tx, only some buttons can be used.The H8 tx supports only the rate button (called expert here) and using the trims as switches. The flip button can only be used for flips.

// level / acro mode switch

// CH_FLIP - 0 - flip
// CH_EXPERT - 1 - expert
// CH_HEADFREE - 2 - headfree
// CH_RTH - 3 - headingreturn
// CH_AUX1 - 4 - AUX1 ( gestures <<v and>>v)
// CH_PIT_TRIM - 6 - Pitch trims
// CH_RLL_TRIM - 7 - Roll trims
// CH_THR_TRIM - 8 - Throttle trims
// CH_YAW_TRIM - 9 - Yaw trims
// CH_INV 10 - Inverted mode
// CH_VID 7 -
// CH_PIC 8 -
// CH_ON - 10 - on always
// CH_OFF - 11 - off always
//
// devo can use DEVO_CHAN_5 - DEVO_CHAN_10

#define RATES CH_EXPERT

#define LEVELMODE CH_AUX1

#define STARTFLIP CH_OFF

#define LEDS_ON CH_FLIP

Special channels: Not all channels are sent from the transmitter, some channels are based in the software, currently only gesture controlled channels CH_AUX1.

Available channels depend on the radio protocol selected, the ones described are for Bayang protocol ( recomended )

Stock tx

The trim buttons do not do anything in the stock tx. To use the trims for controlling a function, set the function channel to the trim (such as CH_PIT_TRIM - pitch trims) and enable “#define USE_STOCK_TX”

Do not enable “#define USE_STOCK_TX” if you want to use a devo or tx module and the trims are set as a function!

Devo tx

In the above code the level function is set to “CH_AUX1” which is the “gestures channel”. This is the default, since it works with any tx. For a devo, you could set it to “CH_RTH” instead, for example (return home channel)

The devo channels are assigned as follows in the devo itself:

    CHANNEL1      // Aileron
    CHANNEL2,     // Elevator
    CHANNEL3,     // Throttle
    CHANNEL4,     // Rudder
    DEVO_CHAN_5     // Leds / Inverted
    DEVO_CHAN_6     // Flip
    DEVO_CHAN_7     // Still camera
    DEVO_CHAN_8     // Video camera
    DEVO_CHAN_9     // Headless
    DEVO_CHAN_10    // Return To Home
    CHANNEL11    // Calibrate - channel not implemented in silverware

Silverware also supports to set simply a channel number as numbered in DeviationTX:DEVO_CHAN_5 - DEVO_CHAN_10 for use with deviaton tx or with nrf_multipro module.

For the multimodule, use MULTI_CHAN_5 for channel 5, for example.

Other settings

Auto throttle feature:

The auto throttle will keep a constant upwards thrust as the quad leans in one direction. Used in level mode, usually.

Example: Suppose the quadcopter is at a 45 degrees angle. Because of the angle, only half the thrust will contribute to maintaining height. The other half will provide lateral acceleration. With “auto throttle” on, the software will increase throttle to compensate. As a result, the quad will maintain altitude better while maneuvering.

#define AUTO_THROTTLE

Lower throttle feature

With this option enabled, the quadcopter will lower the throttle in order to maintain better control near full throttle. Without it (default) the quadcopter will usually lean slightly in one direction at full throttle, as there may not be enough control ability. (the motors can't increase over maximum)

#define MIX_LOWER_THROTTLE
//#define MIX_INCREASE_THROTTLE

Motor filter feature

The motor filter is a 3 tap hanning fir filter that is applied to the motor output. Enabled by default, as it uses little resources.

#define MOTOR_FILTER

Throttle transient compensation feature

The TTCF feature improves throttle response of the quadcopter. The curve has been measured for 6mm motors, and it may not work the same with other motors. With this feature on, the quadcopter will react faster to throttle changes.

This feature only works on the throttle stick, it does not affect controls in any other way.

#define THROTTLE_TRANSIENT_COMPENSATION

Gyro lpf filter (software)

The software lpf filter is a custom gyro filter, additional to the hardware filter which is present in the gyro device. The hardware filter is set around 43Hz by default, but for additional vibration removal, a software filter can be added.

Changing the filters affects the tuning of the pids, it's a good idea to consider the filter before tuning.

// set only one below
//#define SOFT_LPF_1ST_023HZ
//#define SOFT_LPF_1ST_043HZ
//#define SOFT_LPF_1ST_100HZ
//#define SOFT_LPF_2ND_043HZ
#define SOFT_LPF_2ND_088HZ
//#define SOFT_LPF_4TH_088HZ
//#define SOFT_LPF_4TH_160HZ
//#define SOFT_LPF_4TH_250HZ
//#define SOFT_LPF_NONE

Gyro lpf filter (hardware)

The hardware gyro lpf filter is part of the gyro integrated circuit. It's setting changes the frequency of the internal filter. The internal filter also has a latency which may affect pid P and D terms. A lower latency may be better, however vibration will limit the usefulness of higher gyro frequencies.

// gyro filter 0 = 250hz delay 0.97mS
// gyro filter 1 = 184hz delay 2.9mS
// gyro filter 2 = 92hz delay 3.9mS
// gyro filter 3 = 41hz delay 5.9mS (Default)
// gyro filter 4 = 20hz
// gyro filter 5 = 10hz
// gyro filter 6 = 5hz
// gyro filter 7 = 3600hz delay 0.17mS

#define GYRO_LOW_PASS_FILTER 3
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
docs/config.h.1508543150.txt.gz · Last modified: 2017/10/21 01:45 by silverxxx