[Dprglist] Compass heading using gyroscopes?

David Anderson davida at smu.edu
Sat May 16 23:02:18 PDT 2020


Fellow itinerant dabblers and madmen:

The jBot outdoor robot uses a 3 axis magnetometer as a sort of 3D 
compass, so that it doesn't have to remain level, as part of the Kalman 
filter that fuses the gyros and accelerometers.  It works remarkably 
well, and for all practical purposes it eliminates the odometry drift in 
theta, the robot's heading.    The Holy Grail.

The RCAT robot doesn't use a magnetic heading sensor.  In fact, it 
really doesn't use the CH6 IMU at all, but rather only the IMU's raw Z 
axis rate gyro.  The robot does the rest of the processing.

Basically it is sampling the rate gyro every time it generates a wheel 
odometry-based theta measurement.   Here's a graph showing the rate of 
the wheel theta in blue and the sampled gyro rate (scaled) in red.  The 
robot is driving back and forth between two way points.

http://www.geology.smu.edu/dpa-www/robo/rcat/wheel_and_gyro_theta_rate.png

That is the value that gets integrated to produce the robot's heading.  
It's the heading, the accumulated theta,  that drifts over time and 
needs correction, whether gyro or wheel generated.

My observation was that most buildings are orthogonal with rooms and 
hallways organized at right angles and rectangular with corners.  So the 
idea is that such corners could serve as landmarks where the robot could 
learn what the X/Y coordinates were and how far away the two walls are 
using it's sonar, and subsequently use that landmark to correct odometry 
errors.

The new algorithm for aligning with the wall scans along in the 
direction of the shorter of the two sonars looking for two readings that 
are equal, to a tenth of an inch.  When it finds that it scans left and 
right 5 degrees to see if the surface is really flat and the robot is 
really normal to it.  Else it's rejected, and a  new search started in a 
different location. The algorithm also monitors for the left/right 
oscillations that signal the robot is trapped in a local minimum, like 
when it's pointed into a corner, and again starts a new search.  If the 
surface is flat and the robot is normal to it, the robot's theta is 
corrected to the normal angle, and the distance X or Y is read.

In the RCAT video there was only one landmark, made with my office door 
as one wall and some cardboard taped to a desk leg for the other.   The 
robot is first initialized in that corner, so it squares up with and 
measures the distance to the two walls, and saves the location and 
distances.    Then it runs around for a while.  It could be doing any 
task, collecting soda cans or whatever.  In this video it is doing 
perimeter following.  After a while --- 3 minutes in the video --- a 
timer expires and the robot stops whatever it is doing and enables 
navigation with the nearest (in this case the only) landmark as it's 
destination.

When it gets to the landmark, it again squares up and measures the 
distance to the two walls, and uses that to correct it's location and 
theta, as compared to the saved values.  If it's off less than 6 inches, 
meaning the waypoint is underneath the robot, it makes a happy sound.  
If it's off more than 12 inches, it makes a sad sound and recalibrates 
the Z axis rate gyro, which takes about 5 seconds.  In the video the 
robot does this sequence several time, alternating left and right (and 
random) perimeter following.

Here is a similar video except I also let the robot run out into the 
hallway.   The whole thing takes place inside of a 30x40 foot bounding 
box, also implemented with odometry,  to keep the robot from wandering off.

For some reason my web server has stopped streaming video, so you have 
to wait on a down load in order to view it.

http://www.geology.smu.edu/dpa-www/robo/mpeg/rcat-odom-01.mpg

regards,
dpa


On 05/16/2020 09:19 PM, Karim Virani wrote:
> Hey Murray,
>
> In my earlier forays into robotics I was similarly fixated on compass 
> heading. Even for indoor situations. I've been down that road and 
> learned a bit through my failures. In a purely pragmatic way I would 
> say give up now. Learn from the pain of those who have traveled before 
> you. Turn back from this mire.
>
> I haven't noticed anything that indicates whether you are thinking 
> indoor vs. outdoor. But simply by the scale of the robots you are 
> working on I'll assume indoors. Indoors is an untrustworthy 
> environment for working with a mems compass or any kind of compass 
> really. Even if you have it on a mast. This is why I advise turning 
> off the compass of the BNO055. All it can really do is inject 
> uncertainty into the system. Transient anomaly filtering is usually 
> good. But what if your robot comes to rest in an anomaly or just 
> spends some time there? Can you predict how that will challenge the 
> sensor's fusion? Do you have map of the anomalies in your space? Can 
> you take the time to build one?
>
> Magnetic heading is also pretty much not helpful indoors. How exactly 
> does it help you to navigate knowing which way the robot is pointed 
> vs. the magnetic north and south poles of the planet? Heading is 
> important, but one based on an arbitrary local coordinate system is 
> more than enough. And from that point a good imu and good odometry are 
> enough to carry you a long way. Get these capabilities thoroughly 
> implemented and you'll have a good sense of where you are relative to 
> your starting point. This still has nothing to do with navigation, 
> just relative location history.
>
> Over the longer term (minutes vs. seconds), correction of drift can 
> happen by referencing known landmarks or using a positioning system. 
> Methods and technologies abound for various environments. Have fun 
> spending money exploring these - I do. But I wouldn't recommend going 
> down that road until I had decent location history implemented and 
> thoroughly tested.
>
> It didn't appear as if David's RCAT used any of the sonic landmarks in 
> the room to correct drift during the run? It does look like it used 
> the corner it started in to calculate the final X & Y drift. If it 
> achieved that accuracy without correction on carpet over that 
> duration, then he has an extremely dialed in solution. Kinda like we 
> expect, but that doesn't make it any less impressive. I'd like to hear 
> if a compass was used, necessary or even helpful in that test.
>
> Outside is different. Especially for drones and ships. Even with a 
> goodly mast, I'd still be cautious with a compass on a small rover - 
> though modern IMU's have fairly good secret sauce for filtering 
> anomalies. And outdoors "compass" heading is quite relevant. Though 
> latitudes, longitudes, headings and bearings are relative to the 
> current rotational axis of the earth (maybe/probably still measured 
> celestially - let's not get into a precession discussion) and not the 
> faster drifting magnetic axis. But hey, we are outside. Why not look 
> into GPS at this point? Most code libraries tagged as "navigation" 
> kind of assume they are being used in an outdoor context and with 
> access to GPS data.
>
> Every bit of the universe is moving with respect to every other bit. 
> The point is we can arbitrarily choose the coordinate system that has 
> the most practical value and support behind it for our application. 
> Indoors you don't need to worry about great circles and the obliquity 
> of the earth. Most of us are happy to just get around that next 
> corner. It's a different problem and can have a simpler solution. 
> Indoors, figure out where you are and then calculating heading to 
> where you want to be is just Trig.
>
> Now with all that said. Ignore my earlier advice. Don't be the burnt 
> (or should I say sodden) and hopeless victim of the compass like I am. 
> Be its ruler. Become the first person to use indoor magnetic anomalies 
> to improve a SLAM algorithm...
>
> Cheers, Karim
> ps. strike everything I've said and do what you want. These are just 
> the random mutterings of an itinerant dabbler and madman.
>
> On Sat, May 16, 2020 at 4:36 PM David Anderson via DPRGlist 
> <dprglist at lists.dprg.org <mailto:dprglist at lists.dprg.org>> wrote:
>
>     Howdy DPRG,
>
>     Maybe it's not clear that the video of RCAT I showed at the
>     monthly meeting is actually a superset of the four corners contest
>     methodology to which Doug refers. Sometimes things are not as
>     obvious as I think they are. To wit:
>
>     The four corners contest is actually the University of Michigan
>     Bench Mark (UMBmark) odometry calibration method developed by J.
>     Borenstien.
>
>     http://www-personal.umich.edu/~johannb/Papers/umbmark.pdf
>     <http://www-personal.umich.edu/%7Ejohannb/Papers/umbmark.pdf>
>
>     The concept is to drive around a large square, clockwise and
>     counter-clockwise, while tracking the robot's position with
>     odometry, and stop at the starting point and measure the
>     difference between the stopping point and the starting point. 
>     This shows how much the odometry is in error and in which 
>     direction, and allows calibration of the odometry constants and
>     also the potential difference in size between the two wheels of a
>     differentially driven robot.   The DPRG uses this calibration
>     method as a contest.
>
>     Here is a paper I wrote about how I used the UMBMark to calibrate
>     the RCAT robot as an example:
>
>     http://www.geology.smu.edu/dpa-www/robo/rcat/calibrate.html
>
>     The video of RCAT I showed earlier this month does the same thing
>     except: 1) the route taken is MUCH longer than a 10 foot square
>     (hence the errors should be larger),  2) the route taken involves
>     many, many turns, not just four nice ninety degree turns as in the
>     contest, so again the errors should be much  larger,  3)  the
>     route taken is not symmetrical, is different for each run, and is
>     not known in advance,  4) the robot itself measures the error
>     between the starting and ending point using it's sonars, as
>     Borenstien suggests in his paper, and 5) the robot corrects its
>     position and pose for the next run each  time after measuring
>     those errors.
>
>     As I have opined before, robot contests are easy compared to the
>     real world!
>
>     So the robot is turned loose to do whatever tasks it has been
>     assigned, in the case of the video it was to do perimeter
>     following, and at the end of three minutes or whatever the timeout
>     is set for, it stops what it is doing wherever it is and enables
>     navigation to seek its way back to the starting point, or to
>     wherever it thinks the starting point now is.
>
>     With those behaviors the RCAT robot can, after a three minute run
>     as seen on the video, return to within a few inches of the
>     starting point repeatedly.  This means that the locations that the
>     robot is tracking during it's run are accurate to within a few
>     inches or less FOR THE ENTIRE RUN.
>
>     In all humility this is virtuosic perfomance from that little
>     robot, which may not be apparent if one does not understand what
>     it is doing and what the implications are.
>
>     cheers,
>
>     dpa
>
>
>
>     On 05/15/2020 02:18 PM, Doug Paradis via DPRGlist wrote:
>>     Murray,
>>         John's points are very valid. You can get a feel for the
>>     accuracy needed on an indoor robot by marking a point on your
>>     robot and the floor of your test space. Travel a square that is
>>     375 cm (~12 ft) on side, with a total travel distance of 1500 cm
>>     (48 ft), and mark where your robot ends on the floor using the
>>     mark on the robot, and measure the distance it is off. This is a
>>     short description of a DPRG Four Corner contest (see:
>>     https://www.dprg.org/wp-content/uploads/2018/09/four_corners-201804303.pdf).
>>     Typical performance a winning robot is sub - 12 mm, the 2nd and
>>     3rd place robots sub - 75.mm <http://75.mm>. Often in the past
>>     only encoders were used for navigation (i.e., no gyro).Now
>>     usually a gyro is used for heading. Several years ago John S.
>>     used a unique sonic trilateration system to achieve a 17.5 mm
>>     error, at the time a club record. Similar competitions by other
>>     clubs have about the same outcomes.
>>
>>     Regards,
>>     Doug P.
>>
>>     On Fri, May 15, 2020 at 4:36 AM Murray Altheim via DPRGlist
>>     <dprglist at lists.dprg.org <mailto:dprglist at lists.dprg.org>> wrote:
>>
>>         Hi John,
>>
>>         A one degree error may be two inches after ten feet, but I'll
>>         be reading
>>         that heading continuously so over that ten feet wouldn't
>>         things tend to
>>         balance out?
>>
>>         I don't disagree but I think you may be missing my ultimate
>>         point: that
>>         even with low accuracy a robot will still have "a behaviour"
>>         and that is
>>         plenty good enough for my purposes, which are not competitive
>>         but rather
>>         the exploration of an indoor environment using a
>>         Behaviour-Based System,
>>         basically following along the research path set by Rodney
>>         Brooks et al.
>>
>>         I am aware of the difference between resolution and accuracy,
>>         and having
>>         both a higher resolution and a higher accuracy would improve
>>         the robot's
>>         ability to navigate accurately -- certainly -- and I'm hardly
>>         against
>>         that; it's just that I'll be satisfied with much less. As I
>>         described
>>         previously, something akin to a determining which point on a
>>         16 or 32-
>>         point compass rose is fine. If I can get better accuracy I
>>         might explore
>>         navigating according to a bearing but I have no requirement
>>         for that at
>>         this point. Maybe in the future... it's an interesting
>>         journey either way.
>>
>>         Cheers,
>>
>>         Murray
>>
>>         On 15/05/20 8:00 pm, John Swindle via DPRGlist wrote:
>>         > A quick note: A one-degree error is two inches after ten
>>         feet. Not
>>         > good enough for small robot navigation unless something is
>>         constantly
>>         > providing better pointing accuracy. Even for the contests,
>>         if the robot
>>         > depends on that amount of error, it would miss the goal in
>>         6 Can, might
>>         > hit the cone in Square Dance, etc. Outdoors, the accuracy
>>         has to be a
>>         > lot better. I think you will be very unhappy with 11.25 degree
>>         > resolution. And be careful that resolution and accuracy are
>>         not the
>>         > same thing.
>>         >
>>         > Later,
>>         > John Swindle
>>         ...........................................................................
>>         Murray Altheim <murray18 at altheim dot com>                
>>            = =  ===
>>         http://www.altheim.com/murray/                              
>>              ===  ===
>>                       = =  ===
>>              In the evening
>>              The rice leaves in the garden
>>              Rustle in the autumn wind
>>              That blows through my reed hut.
>>                     -- Minamoto no Tsunenobu
>>
>>         _______________________________________________
>>         DPRGlist mailing list
>>         DPRGlist at lists.dprg.org <mailto:DPRGlist at lists.dprg.org>
>>         http://lists.dprg.org/listinfo.cgi/dprglist-dprg.org
>>
>>
>>
>>     _______________________________________________
>>     DPRGlist mailing list
>>     DPRGlist at lists.dprg.org <mailto:DPRGlist at lists.dprg.org>
>>     http://lists.dprg.org/listinfo.cgi/dprglist-dprg.org
>
>     _______________________________________________
>     DPRGlist mailing list
>     DPRGlist at lists.dprg.org <mailto:DPRGlist at lists.dprg.org>
>     http://lists.dprg.org/listinfo.cgi/dprglist-dprg.org
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dprg.org/pipermail/dprglist-dprg.org/attachments/20200517/05680b06/attachment-0001.html>


More information about the DPRGlist mailing list