A bug in AC3.1 inertial navigation code?

There may be a mistake in calculation of inertial navigation.

This issue I've posted on ardupilot.com forum on APM:Copter>>3.1, but so far there is still no replies, so I post it again here with the hope that someone can give me an explanation.
In AP_InertialNav::correct_with_baro() because of the delay of 150 ms from baro we should calculate error using historical estimates about 15 samples ago (exactly the delay then is something between 140 and 149 ms). With the cyclic buffer of 15 samples it means the oldest sample or the sample at the _head index.
However, I read in the code that hist_position_base_z = _hist_position_estimate_z.peek(14).
In AP_Buffer.cpp there is j = _head+position; here position =14. For simplicity we can imagine that if _head = 0 then j =14 and in the end it returns _buff[14], that is the latest sample not the oldest one. The same issue can be seen with correct_with_GPS().
Can anyone in the development team give an explanation?

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • In that commit I don't see the fix for correct_with_baro(). In the commit we've checked if buffer if buffer is full then get the delayed sample at the front, otherwise get the current sample. If the buffer is not full it's true that we can't get the delay, but we don't know either that between the sample at the front and the current sample which one is closer to the point of sensor reading. So IMHO we don't need to check that buffer is full or not, just take the sample at the front.

    Another issue is that when we discard the samples because dt is big then we need to reset position_error. With GPS there is no problem because there is a clearing position error if GPS updates stop arriving in 300ms but for baro there no such a reset.

  • Hi, this bug has been fixed since this commit was made:

    https://github.com/diydrones/ardupilot/commit/e23135faa1fab89822c56...

  • IMO for the cyclic buffer with the number of samples = size = 15, the delay is 15 samples, so if now we get the baro data, it means that the inertial calculation for that data was 15 samples ago, or it should be at the beginning of the buffer, the sample at index _head. But as I've showed in the concrete example, instead of returning the sample at the _head (_buff[0]), the sample at the tail is returned (_buff[14]). The same miscalculation can be seen in GPS delay compensation.

  • Developer

    Hmm, really?  I heard a similar report (perhaps the opposite) in AC3.0.1 from neurocopter and we fixed it for AC3.1.

    Of course it's possible that it was correct for AC3.0.1, neurocopter was wrong and I agreed with him and made it incorrect but I did look at it pretty closely at that time and tried feeding in a particular value to make sure that the delayed value was what was coming out.

  • It seems that no one wants to reply. May I ask from Randy, an expert in this field in my view, that what does he think about this issue, am I right or wrong?

  • There's still no replies at all. I'd like to know at least the viewpoint from anyone in the development team. I don't know the 3rd order complementary filter algorithm and highly appreciate if anyone can provide the link to that algorithm description.

This reply was deleted.

Activity

Chris Anderson liked Zara Mae Pickering's profile
May 21
Azjeg liked Azjeg's profile
Apr 27
DIY Robocars via Twitter
RT @chr1sa: Donkeycar 4.4 released with tons of new features, including path learning (useful with GPS outdoors), better Web and Lidar supp…
Nov 27, 2022
DIY Robocars via Twitter
RT @NXP: We are already biting our nails in anticipation of the #NXPCupEMEA challenge! 😉 Did you know there are great cash prizes to be won…
Nov 24, 2022
DIY Robocars via Twitter
RT @gclue_akira: レースまであと3日。今回のコースは激ムズかも。あと一歩 #jetracer https://t.co/GKcEjImQ3t
Nov 24, 2022
DIY Robocars via Twitter
UC Berkeley's DIY robocar program https://roar.berkeley.edu/
Nov 24, 2022
DIY Robocars via Twitter
RT @chr1sa: The next @DIYRobocars autonomous car race at @circuitlaunch will be on Sat, Dec 10. Thrills, spills and a Brazilian BBQ. Fun…
Nov 24, 2022
DIY Robocars via Twitter
RT @arthiak_tc: Donkey car platform ... Still training uses behavioral cloning #TCXpo #diyrobocar @OttawaAVGroup https://t.co/PHBYwlFlnE
Nov 20, 2022
DIY Robocars via Twitter
RT @emurmur77: Points for style. @donkeycar racing in @diyrobocars at @UCSDJacobs thanks @chr1sa for taking the video. https://t.co/Y2hMyj1…
Nov 20, 2022
DIY Robocars via Twitter
RT @SmallpixelCar: Going to @diyrobocars race at @UCSDJacobs https://t.co/Rrf9vDJ8TJ
Nov 8, 2022
DIY Robocars via Twitter
RT @SmallpixelCar: Race @diyrobocars at @UCSDJacobs thanks @chr1sa for taking the video. https://t.co/kK686Hb9Ej
Nov 8, 2022
DIY Robocars via Twitter
RT @PiWarsRobotics: Presenting: the Hacky Racers Robotic Racing Series in collaboration with #PiWars. Find out more and register your inter…
Oct 23, 2022
DIY Robocars via Twitter
RT @Hacky_Racers: There will be three classes at this event: A4, A2, and Hacky Racer! A4 and A2 are based around UK paper sizing and existi…
Oct 23, 2022
DIY Robocars via Twitter
Oct 23, 2022
DIY Robocars via Twitter
Oct 19, 2022
DIY Robocars via Twitter
Oct 18, 2022
More…