Skip to content
January 15, 2011 / ygramulqc

OSP Quadrocopter ACC/stable mode

Today I did my first outdoor testflight with the newly implemented ACC/stable-mode. ACC means it uses a accelerator sensor to level the quadrocopter if nick/roll stick is in middle position. Another mode is Heading Hold (HH) which means the copter hold its attitude if nick/roll stick is in middle position. For the HH mode only gyros are nessesary and the copter do not need to know where the bottom is. On the OSP you can switch between both modes while flying.

This is an easy and basic implementation of the ACC mode. Fusion of the gyro and acc sensor values are done with the following code.

int angle_diff_nick=IMU_CalcData.acc_angle_nick-CTRL_FlightParams.reserved[ACC_TRIM_NICK]-IMU_CalcData.angle_nick;
angle_diff_nick*=CTRL_FlightParams.approach_speed;
angle_diff_nick/=1000;
IMU_CalcData.angle_nick+=angle_diff_nick;

A pd controller is responsible to get the correct attitude.


perror_nick = (-real_nick * CTRL_FlightParams.K_stick_nick) + IMU_CalcData.angle_nick;
derror_nick = perror_nick - old_error_nick;
CTRL_InternalOut.nick= (CTRL_FlightParams.Kp_nick*perror_nick)+(CTRL_FlightParams.Kd_nick*derror_nick);
old_error_nick = perror_nick;

And here is the video of the first outdoor testflight.

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

%d bloggers like this: