First thing was to get the GPS and SD datalogging tested. We are using an Adafruit Ultimate GPS, which worked great for HAB flights, but we cannot seem to get decent resolution for ground work. I am using ladyada's parser, but am using the integer vars for better accuracy that the floats provide. I have decimal degrees, am getting seven decimal places on both lat and long, and am pretty confident that they are mostly real digits. I have the unit set to both fix and update at 5Hz. I tried to enable waas, but never saw it enter that mode. When I let the unit start up, it will get up to about 10 sats and an hdop of under 1.0 in 10 minutes or so, and if I grab some stationary data and plot it I see a scatter plot of a meter or two radius, which is not bad -- there is a larger lat/long offset, but that is easy to fix in excel before plotting.
But the gps problem is dynamic. My first test was to let the gps get happy for a half hour or so, having decent stationary data, and then simply walk it around the yard. What I got was a worthless skewed path, roughly in the shape of my walk, but smeared in both axes. We ran another test today, driving the car around the perimeter of a basketball court in a park (see attached). The plotted data, using the handy http://www.gpsvisualizer.com/map_input tool (not the kml version), kinda showed the rectangle, but distorted and skewed 50 feet north and 100 feet west. Pretty worthless for being able to use any fixes during driving for navigation, imho.
My first question: how are you guys using gps waypoints to guide you? Do I just need a different gps unit? I used this one since I had a couple, they worked reliably in extreme conditions, I got familiar enough to control them and even wrote my own parser for a pic. But the data just seems to be crap for an AGV. I could easily correct at start time for the offset, but the path just seems too distorted for nav. I even considered a second stationary unit, a homebrew dgps if you will, sending updates to the AGV over an xbee link, but while that may remove some sat-propogation-distortion from the path, I am neither convinced it is worth the hassle, or really have time for it now. But I would love to hear what you guys are doing with gps for nav.
So, having pretty much decided to rely on gps only for nice timestamps every 200ms on the sd card log, we moved on to a compass. We are using a HMC5883 magna, corrected for declination, and it worked pretty well in open air. Not so much on the truck chassis. As we rotated the truck by 360 we saw something like 220 to 290 degrees at any point. Hmm. Pretty strong magnets in that motor. Taking a cue from others, we mounted the mag 12" up on a post and the readings are pretty decent now. Thought we might be just able to add a fixed deviation -- it is a bit more non-linear, but easy enough to interpolate the four quadrants to clean it up for a good heading. So I got that going for me.
Hi Thomas:
Thanks for the input. Regarding the waas issue, I sent this:
// --- to get waas dgps:
GPS.sendCommand("$PMTK313,1*2E\r\n"); // PMTK_API_SET_SBAS_ENABLED to enable search for SBAS satellite
GPS.sendCommand("$PMTK513,1*28\r\n"); // PMTK_DT_SBAS_ENABLED to enabled
GPS.sendCommand("$PMTK301,2*2E\r\n"); // PMTK_API_SET_DGPS_MODE to enable WAAS as DGPS Source
I did not send PMTK_API_SET_DGPS_MODE, so maybe that is it -- will try it when I get a chance. Yes, 5Hz is the max rate according to the docs. 5Hz is also the max fix rate, so what is the point of a 10Hz update rate? Twice the log size with redundant records? I dunno. I set rate with:
// ----- set the gps update and fix rates (uncomment one rate pair):
// --- 1 Hz rate:
//#define PMTK_SET_NMEA_UPDATE "$PMTK220,1000*1F"
//#define PMTK_API_SET_FIX_CTL "$PMTK300,1000,0,0,0,0*1C"
// --- or 5 Hz rate:
#define PMTK_SET_NMEA_UPDATE "$PMTK220,200*2C"
#define PMTK_API_SET_FIX_CTL "$PMTK300,200,0,0,0,0*2F"
//
GPS.sendCommand(PMTK_SET_NMEA_UPDATE);
GPS.sendCommand(PMTK_API_SET_FIX_CTL);
I will also look into the static threshold/PMTK_API_SET_STATIC_NAV_THD thing.
As for the precision, I am using the lib-provided 32-bit ints (GPS.latitude_fixed/GPS.longitude_fixed) to avoid the float rounding. These were added to the adafruit lib by someone not too long ago, so if you have an earlier lib it may just have floats. I peel off chars and format it to decimal minutes, getting seven digits after the radix. I build it as a string since it goes into a csv file record, but I am not currently using it for nav (could just use the original ints for nav). I'd be interested in the code you have -- does this forum pm?
// ----- only if we have a fix (GPS.fix is true if RMC-status is 'A', and GPS.fixquality is from GGA:
if( GPS.fix || GPS.fixquality )
{
// --- latitude field (orig DDMM.MMMM, now +/-DD.DDDDDDD):
if (GPS.lat == 'S')
currentLat = "-";
else
currentLat = "";
// put int32 number into a string:
ltoa(GPS.latitude_fixed, tmpCharArray, 10);
// first two chars are degrees, plus add radix:
currentLat += String(tmpCharArray[0]) + String(tmpCharArray[1]) + '.';
// chars three to null are minutes:
for (i=2; i<15; i++)
{
if (tmpCharArray[i])
currentLat += String(tmpCharArray[i]);
else
break;
}
dataString += currentLat; // add to log record
dataString += ",";
(etc. lon is the same except that the first three chars are degrees)
I see lots of folks seem to like the ublox. Will need to try one, but won't have time for this project. Why is PPS critical? They all seem to have a PPS output. Sounds like I need to learn a bunch more about gps to really know what is going on.
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/39536f84-ecf4-4ed3-8b20-d8aeed740e72%40googlegroups.com.
how does a gyro or accelerometer assist in (not particularly fast) nav
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/e0c86179-a83e-4390-9e68-d6fa1e4c31ea%40googlegroups.com.
Just a few pics intended to be attached to my previous post. Apparently google does not mind a 100GB pic, as long as the res is less than or equal to 2000x2000.
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/cbd1a6c6-72cb-4986-902e-abcd25b98dc6%40googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "diyrovers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/diyrovers/HZnFWfNStGg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/2993845d-c830-452e-8391-c209171fcedb%40googlegroups.com.
Hi Thomas:
Yes, I was walking straight around the court perimeter on the line, and then straight up the center. Path still a bit distorted but looks usable so we will try some gps waypoint driving, use the compass for heading, and see how the distance compares to the expected gps point differences. Baby steps.
Though I have used these adafruit (GlobalTop MT3339-based) ultimate gps units before, I have never needed to dig into the setup commands much until now. So who exactly is MediaTek? Do they provide the gps core and companies like GlobalTop wrap a controller around it? It seems like multiple vendors use the mediatek parts, but only expose a subset of the commands based on what they want to provide, as I have found that the manual for the globaltop unit (adafuit) does not have commands I have found in other manuals such as from Linx, Sanav, and Quectel.
A lot of misinformation out there as well, such as folks sending DT commands that will be ignored (which I now realize are query message responses as you pointed out), and sending commands that work for gps unit X but not on Y. Anyway, I think I have the adafruit unit set up correctly now. I added the AIC command, though it is said to be enabled by default (not all the defaults are defined, so I wanted to send everything that I may need). I disabled the nav speed, though I believe that was the default anyway. For WAAS, it indeed needs both PMTK301 and PMTK313, and may indeed need to be limited to 5Hz max rate, but 5Hz works for me anyway. I set PMTK319 to "integrity mode" -- do you know what that does and if it is necessary or advantageous? So here is my adafruit setup:
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/a7658fff-e78e-4b94-8f63-5fba7a6c5af7%40googlegroups.com.
// Compute matrix to convert deltaLLA to NED float lat, alt; lat = homeLocation.Latitude / 10.0e6f * DEG2RAD; alt = homeLocation.Altitude; T[0] = alt+6.378137E6f; T[1] = cosf(lat)*(alt+6.378137E6f); T[2] = -1.0f;
/**
* @brief Convert the GPS LLA position into NED coordinates
* @note this method uses a taylor expansion around the home coordinates
* to convert to NED which allows it to be done with all floating
* calculations
* @param[in] Current lat-lon coordinates on WGS84 ellipsoid, altitude referenced to MSL geoid (likely EGM 1996, but no guarantees)
* @param[out] NED frame coordinates
* @returns 0 for success, -1 for failure
*/
float T[3];
static int32_t getNED(GPSPositionData * gpsPosition, float * NED)
{
float dL[3] = {(gpsPosition->Latitude - homeLocation.Latitude) / 10.0e6f * DEG2RAD,
(gpsPosition->Longitude - homeLocation.Longitude) / 10.0e6f * DEG2RAD,
(gpsPosition->Altitude - homeLocation.Altitude)};
NED[0] = T[0] * dL[0];
NED[1] = T[1] * dL[1];
NED[2] = T[2] * dL[2];
return 0;
}
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/fc13eee0-4c44-44f1-85ce-16b1468ca685%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/CAJgyHGOT_-miDbERFvDXz7-ucg82x8ujF1Jy%2BzvMBeCgbbDbiw%40mail.gmail.com.
higher end MCUs like Cortex-M4F have only FPU support for "single" precision
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/d4e2bd3c-a50d-4832-a38e-db0879f1f27e%40googlegroups.com.
higher end MCUs like Cortex-M4F have only FPU support for "single" precisionTrue. That FPU can still be used to accelerate the software support for 64-bit doubles.
Given that you'll only be doing a dozen of those double operations per sample, and only sample a handful of times per second, spread across the hundred megahertz clock frequency, the cost in CPU cycles isn't particularly taxing..
Then again, an Intel Quark, with full Pentium instruction set (thus including x87,) is < $10 in singles. And the Edison even contains a full dual-core Atom, plus a Quark...If you can pay the slightly higher power draw (2-3 watts) these chips seem very nice for math :-)
if it could be done in single precision, why not just use single precision
I personally find it more fun to get a 80MHz Cortex-M4F do the same thing
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/d913bb17-2df7-4341-978a-a601f0f73b80%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/fd412a26-5e1b-4703-8e1a-659863909f7e%40googlegroups.com.
You can subtract your 3D center from the 32-bit integer ECEF coordinates first
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/CA%2Bm0WZ%2B%3DZC6bnA%2BwLmOCokvwtFCwRUsMVUEZJcdL%3D3YTou3vVg%40mail.gmail.com.
if at waypoint, get_distance_and_bearing_to_next_gps_waypoint(waypoint)
if (not at waypoint yet, which is within a meter)
{
get bearing error (wpBearingError = wpBearing - compassHeading, and then correct for -180 to +180)
update steering servo with rules
}
void get_distance_and_bearing_to_next_gps_waypoint(uint8_t waypoint)
{
// --- calc deltas from current location to next waypoint (in degrees*1e7):
deltaH = GPS.longitude_fixed - gpsWaypoint[waypoint].lon32; // positive = east (we don't have negative signs included)
deltaV = gpsWaypoint[waypoint].lat32 - GPS.latitude_fixed; // positive = north
//
// --- calc distance to next waypoint (in meters):
// deltas are multiplied by meters/degree*1e7 (horiz and vert conversion is specific to local latitude)
wpDistance = sqrt ( sq(METERS_PER_DEG7_HORIZ * (float)(deltaH)) + sq(METERS_PER_DEG7_VERT * (float)(deltaV)) ) ;
//
// --- calc bearing to next waypoint (in degrees):
wpBearing = (uint16_t)( atan2 ( deltaV, deltaH ) * 57.296 ); // 180/pi = 57.296, so now is -180 to 180 deg
wpBearing = 90 - wpBearing; // now -90 to 270 (NE, SE, and SW quadrants ok)
if (wpBearing < 0) // correct for NW quadrant
wpBearing += 360;
}
--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/d75aa6c7-dd21-4d93-bb86-e653c45ebf2e%40googlegroups.com.
Jon,
that is a nagging problem for me. Other than a hot-air-ballon with a camera, what feasable approaches are there ?
Is there perhaps a beacon commercially available that could be use for simple triangulation ?
- Thomaa
You received this message because you are subscribed to a topic in the Google Groups "diyrovers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/diyrovers/HZnFWfNStGg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to diyrovers+...@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/CAJgyHGOtyAakXcS00CJiAFrWPbdieoEPFaMChwB8oFGU4sk4ig%40mail.gmail.com.