Control Scheme

Since I’ll be using a PS3/Ouya controller for the UAV I have to come up with an alternative way to control the throttle since the left stick is centered.

This is what I came up with:

 enum class Throttle_Mode : uint8_t
 {
 RATE, //throttle rate of change, per second. 
 STABLE, //-1 .. 1 are offsets from current throttle. 
 ASSISTED, //climb speed, meters per second
 };
 

In RATE mode, the user controls the throttle rate of change. When centered, the UAV will keep the current throttle. Stick up/down will increase/decrease the throttle with a rate proportional to how much the stick is moved.

In STABLE mode the user can offset the current throttle with a value that depends on the stick. Centering the stick will revert to the initial throttle.

ASSISTED mode is basically altitude hold, and the stick controls the rate of ascend/descend in meters per second based on a configured range of speeds.

The advantage of these modes is that switching from one to the other is always consistent without any risk, since a centered stick – in all modes – means no change to the throttle.

Pitch/Roll are controlled by this:

enum class Pitch_Roll_Mode : uint8_t
 {
 RATE, //angle rate of change - radians per second
 STABLE, //angle from horizontal. zero means horizontal
 ASSISTED, //speed, meters per second
 };
 

RATE is the classic rate mode where the sticks control the rotation rate of the UAV.

In STABLE mode the sticks control the angle with the horizontal and once released, the UAV returns to horizontal.

ASSISTED mode is position hold. The user controls the forward/backwards and lateral speed in m/s in this mode.

Again, transitions are well defined and safe.

For now yaw is always in rate mode.

This simplified the input code quite a bit by treating ALT_HOLD and POSITION_HOLD as input modes instead as flight modes.

Let’s see where this leads. Tonight I’ll have the UAV fly in the simulator.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s