itsmejithu / arducopter

Automatically exported from code.google.com/p/arducopter
0 stars 0 forks source link

Yaw error of 180 when passing through vertical pitch or high angle turns #456

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Using Arducoper 2.7 on APM2 in ACRO mode

Problem 1: Yaw through vertical (file attached)

What steps will reproduce the problem?
1. Holding the quad in hand in ACRO mode.
2. Increase pitch angle past vertical (this can be done by force or by pitch 
input).
3. Hold on tight as the autopilot puts the quad into full Yaw.

What is the expected output?

When using pitch input to go through a loop the quad should smoothly go through 
360 degrees to return to the starting attitude.

What do you see instead?

The quad rotates using the pitch input until it passes through vertical. Full 
Yaw is applied by the autopilot to initiate a 180 degree yaw. The quad 
continues to rotate in pitch until it passes through vertical again repeating 
the yawing process. The quad then continues to rotate in pitch to it's original 
attitude.

Problem 2: High banking turn

1. In ACRO mode while holding quad in hand.
2. Roll to 90 degrees.
3. Pull up in pitch.
4. Hold on tight as the quad attempts to yaw the nose vertical.

What is the expected output?

Quad should rotate in it's pitch axis requiring very little yaw input to turn.

What do you see instead?

Yaw must be applied to stop the nose from rotating to vertical as the turn is 
started.

What version of the product are you using? On what operating system?

Using Arducoper 2.7 on APM2

Please provide any additional information below.

Suggestions

1. Yaw from the compass might be being returned in the ground axis and not 
translated to the aircraft axis before being fed into the control loop (if this 
is a maths problem). The observations would be consistent with using only the 
heading angle of the magnetometer rather than translating the mag vectors to 
quaternions ect.

2. Only use the compass to do calibration of Yaw when Pitch is < 45 degrees 
like in Stabalise. Reset the compass reference when entering this zone and 
start feedback again.(If this is caused by the magnetic compass reference) But 
this won't fix Problem 2.

Effects.

In ACRO mode loops are impossible without disabling the magnetometer.

Fast turns in any mode feel wrong because the harder you bank the more rudder 
you need to add to stop the quad rotating the nose away from the turn.

Original issue reported on code.google.com by LeonardT...@gmail.com on 29 Jul 2012 at 7:25

Attachments:

GoogleCodeExporter commented 8 years ago
Perhaps the simplest option would be to disable magnetometer feedback when the 
angle is greater than 45 degrees from vertical then reinitialize the feedback 
at the heading when the angle drops back under 45 degrees.

The second problem could then be addressed by updating the desired heading by 
the rotation of the copter around the earth Z axis caused by the rotation about 
copters X, Y and Z axis instead of just the copters Z axis.

Original comment by LeonardT...@gmail.com on 29 Jul 2012 at 11:30

GoogleCodeExporter commented 8 years ago
I think we need to add something like this to the Yaw_Hold code. Sorry if the 
formatting doesn't come out right.

case YAW_HOLD: 
                        if(g.rc_4.control_in != 0){    
                                g.rc_4.servo_out = get_acro_yaw(g.rc_4.control_in);    
                                yaw_stopped = false;   
                                yaw_timer = 150;        
}else if (abs(ahrs.roll_sensor) > 4500 || abs(ahrs.pitch_sensor) > 4500 )
        g.rc_4.servo_out = get_acro_yaw(0);    
        yaw_stopped = false;   
        yaw_timer = 50; // just for some settling time but could be 1 

                        }else if (!yaw_stopped){       
                                g.rc_4.servo_out = get_acro_yaw(0);    
                                yaw_timer--;   
                                if((yaw_timer == 0) || (fabs(omega.z) < .17)){ 
                                        yaw_stopped = true;    
                                        nav_yaw = ahrs.yaw_sensor;     
                                }      
                        }else{ 
                                // reset target yaw to current yaw if the motors are disarmed or throttle is zero       
                                // Note: we do not want to reset yaw if failsafe has been triggered even though throttle maybe zero (in fact, normally throttle is zero in failsafe)    
                                if(motors.armed() == false || ((g.rc_3.control_in == 0) && (control_mode <= ACRO) && !failsafe))        
                                        nav_yaw = ahrs.yaw_sensor;     
                                g.rc_4.servo_out = get_stabilize_yaw(nav_yaw); 
                        }      
                        return;
                        break;

Original comment by LeonardT...@gmail.com on 2 Aug 2012 at 8:46

GoogleCodeExporter commented 8 years ago
It's not a compass issue as such, the copter knows what it's heading is but 
when it's up-side-down it tries to correct it by rotating the copter in the 
wrong direction...so, yes indeed..our yaw control code doesn't not work 
properly when you're up-side-down so I've updated the status to Accepted.

Original comment by rmackay...@gmail.com on 16 Aug 2012 at 4:12

GoogleCodeExporter commented 8 years ago
The release note to 2.8.1 says the issue is fixed
"Rate controller targets moved to body frames (yaw control now works properly 
when copter is inverted) (Leonard/Randy)"

Original comment by Benny.Si...@gmail.com on 19 Jan 2013 at 11:39

GoogleCodeExporter commented 8 years ago
Issue closed. 
If you find this is an error please report it in the new issues list
https://github.com/diydrones/ardupilot/issues?labels=ArduCopter&page=1&state=ope
n

Original comment by Benny.Si...@gmail.com on 19 Jan 2013 at 11:39