Gathiyo / arducopter

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

Using gps->ground_course in calc_loiter function #268

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Jason et al. a possible bug in the calc_loiter function:

float temp = radians((float)g_gps->ground_course/100.0);

If you get the ground course of the GPS while in loiter you will probably get 
wrong results, ground course in GPS is reliable only when travelling at speed > 
5 km/h. How can you get it while Loitering?
You should use the mag sensor, as it is the best option while almost still)

You then use this to calculate rate error:

x_actual_speed = (float)g_gps->ground_speed * sin(temp);
...
and calculate PI on it.
y_rate_error = y_target_speed - y_actual_speed; 
nav_lat = g.pi_nav_lat.get_pi(y_rate_error, dTnav);

This probably explains why the copter flies around. When it reaches a decent 
speed, it gets the correct bearing and then  heads to the correct location, 
resulting in a sort of circle.
Please correct me if I'm wrong.
Emile

Original issue reported on code.google.com by emile.ca...@gmail.com on 23 Oct 2011 at 4:54

GoogleCodeExporter commented 8 years ago
Can you repost your new function in it's entirety?  I'm having a bit of trouble 
following. Thanks
Jason

Original comment by jasonshort on 23 Oct 2011 at 5:00

GoogleCodeExporter commented 8 years ago
I'll try to implement and I will post my result tomorrow.

Original comment by emile.ca...@gmail.com on 23 Oct 2011 at 9:46

GoogleCodeExporter commented 8 years ago
What I don't follow is how you know which orientation the quad is vs the GPS. 
If the GPS says it's moving 1 m/s ground speed, how do you know which way it's 
moving without the GPS Heading? The compass could be any value on a quad.
Jason

Original comment by jasonshort on 24 Oct 2011 at 5:10

GoogleCodeExporter commented 8 years ago

Original comment by jasonshort on 7 Jan 2012 at 5:35