Angle mode and Horizontal mode algorithm

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
ihatetomato
Posts: 4
Joined: Fri Jul 24, 2015 6:31 pm

Angle mode and Horizontal mode algorithm

Post by ihatetomato »

Hi,
Im new to multi-copter.
im not sure if this is proper to post here,if not,i will delete this.

i find the YMFC 3d project in youtube so I made a hexacopter by using arduino mega.
here is my setting:

arduino mega board
30A ESC
900kv motor
MPU6050

but when i was coding i find that YMFC using only gyro, it can't flying really stable
(maybe that's my fault for not tuning PID well,but, that's not the point XD)
so, i want to develop an angle mode since MPU6050 has acc&gyro
but i cant find the info of angle mode algorithm

for example,in my code,
the output of esc is calculated by the formula

esc_1 = throttle - 0.5*pid_output_roll + 0.875* pid_output_pitch + pid_output_yaw;
esc_2 = throttle - pid_output_roll - 0* pid_output_pitch - pid_output_yaw;
esc_3 = throttle - 0.5*pid_output_roll - 0.875* pid_output_pitch + pid_output_yaw;
esc_4 = throttle + 0.5*pid_output_roll + 0.875* pid_output_pitch - pid_output_yaw; ;
esc_5 = throttle + pid_output_roll - 0* pid_output_pitch + pid_output_yaw;
esc_6 = throttle + 0.5*pid_output_roll - 0.875* pid_output_pitch - pid_output_yaw;

but the pid output is from only gyro data
ex:

pid_error_temp = gyro_roll_input - pid_roll_setpoint;
pid_output_roll = pid_p_gain_roll * pid_error_temp + pid_i_mem_roll + pid_d_gain_roll * (pid_error_temp - pid_last_roll_d_error);

so there is no acc. info

i wander what is the angle mode algorithm
as far as i know (from official page),
"in angle mode,the board will attempt to set pitch and roll according to the absolute angle of the input sticks."


but what is the real calculation formula ?

please help me!
thanks in advance.

Post Reply