Owne / ardupilot-mega

Automatically exported from code.google.com/p/ardupilot-mega
0 stars 0 forks source link

GPS Location Errors in Xplane HIL #288

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Build and run APM2.0 in HIL mode
2.Load a mission using mission planner(if a mission not already loaded)
3.Start HKGCS via APM port 3.
4.Start Xplane and Planner simulation link, recorder on HK
5.Take off and switch to auto.
6.Watch the mission fly

What is the expected output? What do you see instead?
I expect to see a path following the mission loaded into APM.
I see the path take random jumps into the distance for one point and then 
resume the path. The APM reacts to the momentary path error.

This also seems related to the APM jumping to the next WP without completing 
the current WP command. E.g. in the example shown, WP1 is missed. It should be 
directly over the intersection of 28L and 1R

What version of the product are you using? On what operating system?
APM2.0, APM Planner 0.4.4087.15718, XPlane 9.62

Please provide any additional information below.
Attached images show the mission route and the HK playback image.
WP File:
------------------------------------------------------------
#define WP_RADIUS 30 // What is the minimum distance to reach a waypoint?
#define LOITER_RADIUS 50    // How close to Loiter?
#define HOLD_CURRENT_ALT 0  // 1 = hold the current altitude, 0 = use the 
defined altitude to for RTL
#define ALT_TO_HOLD 75

float mission[][5] = {
{NAV_LOITER_TURNS,1,75,37.6179695,-122.3733596},
{NAV_LOITER_TURNS,2,100,37.6211662,-122.3647766},
{NAV_LOITER_TURNS,2,100,37.6261291,-122.3758621},
{NAV_LOITER_TURNS,2,100,37.6213684,-122.385292},
{NAV_LOITER_TURNS,2,100,37.6101531,-122.3831405},
{NAV_LOITER_TURNS,2,75,37.6017532,-122.3711776},
{NAV_LOITER_TURNS,2,75,37.6072616,-122.3476104},
};
-----------------------------------------------------------------

Original issue reported on code.google.com by philcole...@gmail.com on 13 Mar 2011 at 6:53

GoogleCodeExporter commented 8 years ago
The missed WPs may also be related to the heading change in the turns. I 
originally tried figure-8 paths in the missions and found most WPs were missed. 
I haven't the fig 8s after the 2.0 beta release.
The above mission will sometimes skip loiter turns. It nearly always misses WP1 
in the manner shown above.

Original comment by philcole...@gmail.com on 13 Mar 2011 at 7:01

GoogleCodeExporter commented 8 years ago
Hi Phil,

I am aware of this issue, although I have never been able to duplicate it.  It 
is not clear if the issue is on the APM side or the ArduPilotSim side....  At 
any rate it appears to be simply a case of the HIL reported GPS location to 
occasionally glitch to some other value.  The other user reporting this said it 
always glitched to the home location.  That does not appear to be what I see in 
your pictures, however, so that is at least a helpful clue.

Original comment by dewei...@gmail.com on 14 Mar 2011 at 9:46

GoogleCodeExporter commented 8 years ago
The far ends of the jump seem to be a constant offset from the path. In the 
example shown, I traced them to a sequence of points over Pacifica.

If there is a trace file stored away somewhere I could send that. I tried to 
find where HK keeps its log files, but they're hidden somewhere non-obvious. 
Next time I'll try to grab an APM log - we should see the errored coordinates 
in that.

I might be able to get a serial trace as well, but I suspect the bogus data is 
coming either from Xplane itself, of the data is mangled in the Planner 
simulator app. I don't know how to trace the Xplane output data. I did try to 
use the perl adapter a few months ago, but couldn't get it to work. 

I don't remember seeing this issue with 1.02 and the older Planner versions. 
It's been the same Xplane version all along.

Original comment by philcole...@gmail.com on 15 Mar 2011 at 1:40

GoogleCodeExporter commented 8 years ago
I have seen this as well. i did do some tracking back into it and it only 
happens east west, no idea why though, what i send to the apm and what i get 
back from the apm differ.

Original comment by Meee...@gmail.com on 15 Mar 2011 at 11:26

GoogleCodeExporter commented 8 years ago
Still present in 2.01.
Looking at the errors, they seem to be ~8 minute jumps in longitude in my case 
(from SFO to Pacifica), so I'm guessing it's something like a truncation or 
rounding thing involved in type conversions or casting between DMS and decimal 
degrees/minutes or similar without actually looking at the code. I have the 
planner source building and running, so I may take a look if it's too wet to 
fly this weekend.

Original comment by philcole...@gmail.com on 23 Mar 2011 at 8:55

GoogleCodeExporter commented 8 years ago
i think this is related to issue 303

Original comment by Meee...@gmail.com on 29 Mar 2011 at 8:32

GoogleCodeExporter commented 8 years ago
I updated APM and library to 2529 and 1829. I have the ADC and FastSerial 
changes. It's still pretty much the same.

Original comment by philcole...@gmail.com on 29 Mar 2011 at 3:21

GoogleCodeExporter commented 8 years ago
ok i have tracked it back to something in the planner. somehow the big/little 
endian is being stuffed up.

Original comment by Meee...@gmail.com on 1 Apr 2011 at 12:22

GoogleCodeExporter commented 8 years ago

Original comment by Meee...@gmail.com on 1 Apr 2011 at 12:22

GoogleCodeExporter commented 8 years ago
ok i have identified the problem and will fix later tonight.
this is a value that causes a problem 
float value = 11.3532705f;
hex 0xffa63541
converting this to 0x4135a6ff is causing the problem because 0xff is invalid 
for a float.
0x4135a6ff is actualy NaN
the work around will be to convert 0xff to 0xfe

Original comment by Meee...@gmail.com on 1 Apr 2011 at 4:31

GoogleCodeExporter commented 8 years ago
OK latest planner should fix this, all endian stuff is now swaped properly. no 
workarounds.

Original comment by Meee...@gmail.com on 2 Apr 2011 at 3:15

GoogleCodeExporter commented 8 years ago
That seems to have fixed it. Planner Build 0.4.4110.29954
Thanks.

Original comment by philcole...@gmail.com on 4 Apr 2011 at 12:43

GoogleCodeExporter commented 8 years ago

Original comment by Meee...@gmail.com on 4 Apr 2011 at 5:50