Commit Graph

213 Commits

Author SHA1 Message Date
Ricardo de Almeida Gonzaga 4047fb63fc AP_GPS: Fix typos 2016-05-13 19:20:06 -03:00
dgrat 41661f815f AP_Math: Replace the pythagorous* functions with a variadic template
The new function can deal with a variable number of function parameters.
Additionally, I renamed the functions to norm(), because this is the
standard name used in several other projects.
2016-05-10 11:41:26 -03:00
Andrew Tridgell 428923b4b1 AP_GPS: use 3D velocity for uBlox
this makes uBlox use the 3D velocity for ground course and speed,
ensuring we use a consistent value everywhere (so same vector in EKF
as in navigation)
2016-05-07 18:27:23 +10:00
Andrew Tridgell b424c49bc7 AP_GPS: change ground course to be in degrees
more accuracy for replay
2016-05-07 18:27:21 +10:00
Michael du Breuil 2538c17ee0 AP_GPS: add fetching of gps configuration failure reasons 2016-04-13 11:24:01 -03:00
Michael Oborne 92106a944f AP_GPS_UBLOX: add data injection support 2016-03-18 15:51:32 +11:00
Andrew Tridgell 04bac8a446 AP_GPS: removed duplicate dataflash write of ublox version 2016-02-24 14:26:57 +11:00
Tom Pittenger 18163bd01f AP_GPS_UBLOX: save cfg only when needed
added GPS_SAVE_CFG param option 2
2016-02-12 15:33:18 -08:00
Michael du Breuil 55e64b3622 AP_GPS: u-blox: copy paste typo in a #else 2016-02-12 15:33:08 -08:00
Michael du Breuil 217a06322b AP_GPS: u-blox: don't throw 5hz update warnings if no fix
5hz update warnings are only valid if you have a fix, without a fix it adds load
to the GPS without any benefit. Our _5hz time messages are depenend upon GPS fix
time which isn't available yet
2016-02-12 15:32:41 -08:00
Michael du Breuil 4251ee0e4b AP_GPS: u-blox verify ublox settings
The ublox driver will now continuosly poll for the settings from the GPS and correct any that are found to be in correct.
This status is then reported to the arming library as an additional arming check, allowing the user to be sure that the
gps is correctly configured before using it. If a user has a GPS2 configured that is not present they will fail the arming
checks until after they have disabled the second GPS.

2 new parameters were introduced as well:
  -GPS_AUTO_CONFIG: Will not request any configuration packets to attempt to change them. (If the packet is recieved then
    a update will be sent to it, but in testing this scenario never occured. This is set to 1 or 0 to change the setting.
    (Defaults to 1 enabling auto config)
  -GPS_GNSS_MODE2: Behaves the same way as GPS_GNSS_MODE but only applies to the second GPS.

GPS drivers are now allowed 2 seconds of non responsiveness before being unloaded
2016-02-12 00:37:04 -08:00
Peter Barker ede7ffedfc AP_GPS: correct #if from UBLOX_DEBUG to UBLOX_DEBUGGING 2016-01-30 12:48:39 -02:00
Aaron Wang Shi 800c142ac0 BH: Support UBLOX GPS M8N 2015-12-21 15:54:30 +11:00
Caio Marcelo de Oliveira Filho c33b86a783 AP_GPS: use millis/micros/panic functions 2015-11-20 12:30:48 +09:00
Randy Mackay 36c0beb918 GPS_UBlox: reorder init to resolve compiler warning
Also removed duplicate init of noReceivedHdop
2015-11-16 15:09:17 +09:00
Siddharth Bharat Purohit 5e2382ea09 AP_GPS:UBLOX: send save cfg msg once per 5s and 5 times only 2015-11-10 15:16:55 +11:00
Siddharth Bharat Purohit 360c09f9bd AP_GPS_UBLOX: send cfg save msg only once every 1 second 2015-11-10 15:16:55 +11:00
Jonathan Challinger bc708f9808 AP_GPS: add SAVE_CFG parameter make ublox config saving optional 2015-11-10 15:16:55 +11:00
Jonathan Challinger e82df48631 AP_GPS: save configuration to non-volatile memory in UBlox GPS 2015-11-10 15:16:55 +11:00
Lucas De Marchi 20c6ffc5e3 Replace use of UARTDriver::printf_P() with UARTDriver::printf()
This also starts to show warnings on places that were already using
wrong printf format strings.
2015-10-30 14:35:25 +09:00
Lucas De Marchi 2c38e31c93 Remove use of PSTR
The PSTR is already define as a NOP for all supported platforms. It's
only needed for AVR so here we remove all the uses throughout the
codebase.

This was automated with a simple python script so it also converts
places which spans to multiple lines, removing the matching parentheses.

AVR-specific places were not changed.
2015-10-30 14:35:04 +09:00
Michael du Breuil 75c0644b9a AP_GPS: Use state.instance instead of trying to track instance numbers inside of the ublox driver 2015-09-23 20:42:42 -07:00
Andy Piper 5adb6d2b89 AP_GPS: Support UBX messages for dual UBLOX GPS setups.
Add extra DOP information to UBX precision messages.
2015-09-23 20:41:50 -07:00
Andrew Tridgell 6fbe88ba3a AP_GPS: improved fake ublox to give enough for EKF health 2015-09-14 11:36:15 +10:00
Andrew Tridgell d07d2f3a46 AP_GPS: removed UBX3 message
replaced by GPA and GPA2 messages
2015-09-09 15:01:45 +10:00
Michael du Breuil 0e3a188f6f AP_GPS: Read the vdop information from a ublox GPS 2015-09-09 11:38:12 +10:00
Andrew Tridgell 2c7a113790 AP_GPS: ensure all GPS drivers give headings as 0..360 degrees
this prevents inconsistency between interfaces, and fixes a MAVLink
reporting bug with UAVCAN GPS
2015-08-31 08:24:35 +10:00
Tom Pittenger 816d1f0e1b AP_GPS: resolve compiler warning re init order 2015-08-25 13:51:33 +09:00
Michael du Breuil 4f9fbc5aa7 AP_GPS: Fix a bound error when calculating GNSS minimum channels.
This is really just calculating the hamming weight of the GNSS_MODE bitmask, but I don't know if the APM compiler could handle the GCC intrinsic that could calculate it faster, and this is done so rarely there isn't a significant penalty to using the for loop.
2015-08-13 15:15:20 +10:00
Gustavo Jose de Sousa 67db430583 AP_GPS: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-11 16:28:43 +10:00
Michael du Breuil c29b19f768 AP_GPS: Fix a typo on spelling received 2015-08-08 13:22:04 +09:00
Michael du Breuil bc26eaab63 AP_GPS: Ublox: fall back to the DOP if hDOP hasn't come in yet
Provides a stable fallback, and can be considered fairly safe from the perspective that it provides a worse value then the hDOP under almost all scenarios.
2015-08-07 21:21:48 +10:00
Andrew Tridgell 087e729748 AP_GPS: re-enable SBAS config on APM2 for uBlox 2015-07-30 11:04:31 +10:00
Andrew Tridgell b6beeb6f2f AP_GPS: save some memory and code space on APM2 for ublox
don't include structures we don't need for low end CPUs
2015-07-30 08:46:20 +10:00
Michael du Breuil 5c9d248407 AP_GPS: Fix copy/paste error in ublox (uncovered by coverity) 2015-07-28 18:01:02 +09:00
Michael du Breuil 09fef505e0 AP_GPS: With a ublox driver, accept a packet if it will fit in the buffer 2015-07-22 21:31:10 +10:00
Michael du Breuil 22b16b4532 AP_GPS: Enable selecting what GNSS system to use if the reciever supports it
Ublox 7 and 8 seires use a UBX-CFG-GNSS message to enable satellite constellations. The default value does not enable any additional ones, and any constellations the reciever doesn't report knowing about are not configured.
2015-07-22 21:31:10 +10:00
Michael du Breuil 47592a1953 AP_GPS: Raise the baud rate on a ublox GPS if using RAW logging
the implementation leaves an easy path forward for providing a different startup blob for all the GPS's if raw logging is enabled
2015-07-22 21:31:09 +10:00
Randy Mackay 7d2fe3cc2b AP_GPS_UBlox: remove unused member 2015-07-14 15:02:15 +09:00
Randy Mackay 2c33250bee AP_GPS_UBlox: send_next_rate_update always runs all steps
Moving the if, endif checks within the case statement ensures the state
machine goes through all 10 states
2015-07-14 15:02:13 +09:00
Randy Mackay 4b015d2091 AP_GPS: remove compiler warnings 2015-07-14 15:02:10 +09:00
Randy Mackay df3a04e284 AP_GPS: reduce fake Ublox hdop to 130 2015-07-14 15:02:08 +09:00
Andy Piper 5ccc58ffb4 AP_GPS: Read actual hDOP value from UBLOX messages
Before we were reading the position DOP and calling it hDOP. Since the
other drivers actualy read hDOP it seem best to do the same.
Fixes issue 462.
2015-07-14 15:02:03 +09:00
Michael du Breuil a382ce2b0c AP_GPS: Add support for logging ublox RXM-RAWX messages
Can only record 32 satellites raw info before memory corruption occurs. (And raised the limit on normal RXM-RAW messages to 22)
2015-06-30 09:05:49 +10:00
mirkix 38a8a772f8 AP_GPS: Add fix status 3D+DGPS 2015-06-30 09:00:31 +10:00
Andrew Tridgell 9a7b283322 AP_GPS: fixed enable of RXM_RAW on uBlox on Pixhawk
if version detection was disabled this would never trigger
2015-06-02 16:52:08 +10:00
Peter Barker 4d67ccb338 AP_GPS: use 64-bit timestamps for dataflash logs 2015-05-27 11:54:16 +10:00
Micheal Knight ee85d37ee2 AP_GPS: added logging of RXM_RAW messages for UBlox
this will allow for post-flight RTK processing of DF logs
2015-05-05 13:25:34 +10:00
Staroselskii Georgii 4a3e61f4e4 AP_GPS: turn UBlox autodetection only for NavIO 2015-04-14 10:45:49 +10:00
Staroselskii Georgii 47a336d192 AP_GPS: added Ublox' hardware generation autodetection 2015-04-14 10:45:49 +10:00
Jonathan Challinger 2293070a5b AP_GPS: Add uBlox accuracy metrics interface and logging 2014-11-06 07:38:41 +11:00
Jonathan Challinger 6848897999 AP_GPS: Add agcCnt to UBX1 message 2014-10-29 08:18:04 +11:00
Andrew Tridgell 15470bd81b AP_GPS: added GPS_MIN_ELEV parameter
allows setting of satellite elevation mask in degrees
2014-09-04 14:46:10 +10:00
Andrew Tridgell 840a4dee1e AP_GPS: added GPS_SBAS_MODE parameter
allows SBAS to be enabled/disabled
2014-09-04 14:46:10 +10:00
Andrew Tridgell 60e501d5ab AP_GPS: moved UBX log headers to DataFlash
headers were not always being written
2014-08-19 10:08:15 +10:00
Jonathan Challinger 0bb7b8e938 AP_GPS: Fix bug that causes permanent lag if we miss a message 2014-04-29 15:35:46 +10:00
Andrew Tridgell b0fd94f18e AP_GPS: initialise a variable in uBlox driver 2014-04-23 18:15:53 +10:00
Andrew Tridgell 5a7afbf2cd AP_GPS: prevent writing GPS log headings multiple times 2014-04-20 21:44:14 +10:00
Andrew Tridgell 21c205a57e AP_GPS: cope with different MON-HW message size in u-Blox Neo7 2014-04-03 10:55:05 +11:00
Andrew Tridgell 8779ffe088 AP_GPS: flush pending config strings when uBlox starts 2014-04-01 06:38:25 +11:00
Andrew Tridgell 368daf89f1 AP_GPS: new GPS API
This is a complete rewrite of the GPS driver structure, with a static
main driver and separate backend drivers. This will allow proper
support for multiple GPSes, and will allow parameters to be set on the
GPS object
2014-04-01 06:38:23 +11:00
Andrew Tridgell 2dd92832dc AP_GPS: support multiple AP_GPS_Auto drivers
move all static variables into a dynamically allocated structure in
the AUTO driver which gets freed when we have found a GPS type
2014-04-01 06:38:23 +11:00
Andrew Tridgell 5630bb1ef6 AP_GPS: added detailed hardware status logging for uBlox
this gives us noise, jamming and RF information from the uBlox
protocol. This will hopefully allow a more detailed investigation of
antenna choices and RF interference
2014-03-24 12:02:37 +11:00
Andrew Tridgell ff73773de4 AP_GPS: try harder to get 5Hz updates from a uBlox
check for getting at least one 5Hz update every 15s
2013-11-05 15:18:25 +11:00
Andrew Tridgell 744819cec8 AP_GPS: added fake time to fake GPS lock 2013-10-24 14:22:48 +11:00
Andrew Tridgell 6f5ac1d553 AP_GPS: added support for GPS time in week/millisec
also adds time_epoch_usec() for MAVLink SYSTEM_TIME
2013-10-24 14:22:47 +11:00
Andrew Tridgell 25d3e5b7e9 AP_GPS: changed fake GPS fix to have a latitude/longitude
Pair-Programmed-With: Randy Mackay <rmackay9@yahoo.com>
2013-10-11 16:06:35 +11:00
Andrew Tridgell 7a9ed0a5a1 AP_GPS: fixed warning 2013-10-03 12:21:08 +10:00
Andrew Tridgell 5489097476 AP_GPS: update the UBLOX rates async from the start
this saves a bit of startup time
2013-10-03 12:21:07 +10:00
Andrew Tridgell cee8a017ab AP_GPS: added UBLOX_FAKE_3DLOCK debugging option
useful when unable to get 3D lock
2013-10-03 12:21:07 +10:00
Andrew Tridgell 34f7f88190 AP_GPS: check for corret GPS solution rates in flight and fix
if the GPS is giving us data at less than 300ms intervals then re-send
the configuration messages to try to kick it into the right rates

Pair-Programmed-With: Randy Mackay <rmackay9@yahoo.com>
2013-10-03 12:21:07 +10:00
Andrew Tridgell 5484b97419 AP_GPS: reset _fix_count to 0 on nav settings update
this makes it run every 20s exactly
2013-09-04 13:18:00 +10:00
Andrew Tridgell 879d44f930 AP_GPS: use the mask bits to only set dynamic model
this ensures we don't try to change any other CFG_NAV5 settings
2013-09-04 13:17:20 +10:00
Andrew Tridgell 97b7130bb9 libraries: update license header to GPLv3
we switched to GPLv3 a long time ago, but neglected to update the
per-file license headers
2013-08-30 13:01:39 +10:00
Andrew Tridgell 7dbb898264 AP_GPS: switch fields to add units suffix
altitude -> altitude_cm
ground_speed -> ground_speed_cm
ground_course -> ground_course_cd

this helps prevent unit mixups
2013-07-10 14:04:22 +10:00
Andrew Tridgell edfebc1f29 AP_GPS: fixed indent-tabs-mode 2013-05-30 09:52:21 +10:00
Andrew Tridgell b3ec5187f2 AP_GPS: fixed uninitialied variable bugs found with valgrind 2013-04-17 23:02:13 +10:00
Andrew Tridgell a5c3051929 AP_GPS: fixed initialisation error in uBlox driver
found with valgrind
2013-04-12 14:25:46 +10:00
Randy Mackay 93f7e61b66 UBLOX GPS: fix MSG_SOL typo
"status" was used instead of "solution"
2013-03-27 11:42:05 +09:00
Randy Mackay 27309a553f GPS: fixes after review
Ensure 3D fix before returning velocity_down
UBLOX: restore check of fix_status as part of determining 2D or 3D fix
SIRF: add missing brackets on fix type check
2013-03-27 11:41:54 +09:00
Randy Mackay d7454bb09e GPS: add 2D fix type 2013-03-27 11:41:39 +09:00
Andrew Tridgell 3f6eb87f23 AP_GPS: fixed uBlox Debug() macro 2013-03-20 15:42:07 +11:00
Andrew Tridgell 252d11ccfa AP_GPS: initialise _step to zero in all drivers
new() does not zero-fill memory
2013-01-12 16:04:23 +11:00
Andrew Tridgell f93a7d50eb AP_GPS: fixed debug code 2013-01-07 11:06:53 +11:00
Andrew Tridgell f7e5f88199 AP_GPS: make UBLOX driver a bit more robust 2013-01-05 20:39:31 +11:00
Andrew Tridgell 18db7b2efd GPS: move _port setting to init()
this is needed to avoid constructor ordering dependencies
2012-12-20 14:52:32 +11:00
Pat Hickey 9ed023aeb4 AP_GPS: Builds under AP_HAL. Not tested. 2012-12-20 14:51:25 +11:00
Andrew Tridgell 984b1086cb AP_GPS_UBLOX: ask for nav settings every 20 seconds
this ensures we don't run with the wrong nav settings on a uBlox if
we get a bad checksum on the initial nav settings message
2012-11-05 14:58:40 +11:00
Andrew Tridgell 59b44816ec GPS: replaced the GPS auto-detect mechanism
the old mechanism wasted most of the input bytes, and chewed a lot of
CPU, making it impractical to do GPS detection for a GPS attached
after startup

The new code is async, and detects a GPS by looking for a fully formed
packet with the right checksum for each GPS type
2012-09-17 14:45:47 +10:00
uncrustify 6c885df832 uncrustify libraries/AP_GPS/AP_GPS_UBLOX.cpp 2012-08-21 19:19:52 -07:00
rmackay9 8a29f47ce0 AP_GPS: replaced "int" with "int16_t" and "long" with "int32_t" 2012-08-18 16:35:38 +09:00
Andrew Tridgell 2d47bd0386 GPS: support getting raw velocity values from a UBlox
this may give better velocity numbers than the value from COG
2012-08-15 20:06:35 +10:00
Andrew Tridgell 819b6459b2 GPS-UBlox: removed duplicate config messages
these were left over from debugging
2012-07-19 15:23:15 +10:00
Andrew Tridgell 70f18289c5 GPS: fixed auto-config of UBlox setup with no UBX messages
if a UBlox is configured for NMEA only, with no UBX messages at all
then it would never trigger the GPS_AUTO detection. This adds a UBX
config message to the init strings that enables the NAV_SOL message
2012-06-15 15:53:27 +10:00
Andrew Tridgell 514be604a5 GPS: added auto-configuration of UBlox GPS
the Ublox will now auto-configure for 5Hz with just the messages we
want. It also supports setting the navigation engine type
2012-06-10 16:34:13 +10:00
Andrew Tridgell 296e651b30 GPS: fixed the UBLOX parser to handle unknown messages
the parser was broken in several ways:

 1) when it received an unknown message it didn't update the ck_a and ck_b fields, so it
    thought the message had a bad checksum, which meant it got out of protocol sync

 2) the read() method would return false if the last message from the GPS was of an unknown type. 
    So we relied on the last msg always being one that we understand and want

 3) the parser considered any valid UBLOX message to be 'new data', whereas we only actually get 
    a new fix when we get box a new position and velned message

 4) the total message size per update is more than 128 bytes, but the serial port was opened 
    with only a 128 byte buffer, so we got corruption regularly
2012-06-08 16:42:02 +10:00
Andrew Tridgell 0f0cbce22f GPS: fixed a race condition in the ublox driver
the status update comes as a separate message from the lat/lon
2012-06-04 14:47:58 +10:00
James Goppert 14d27b1e4c Cleaned up AP_GPS formatting. 2011-10-28 14:52:50 -04:00
deweibel@gmail.com 8d7e7ff58e revert gps lib to 2602
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2608 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-06-21 01:38:31 +00:00
deweibel@gmail.com 5b9e7eff9d clean up idleTimeout
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2606 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-06-21 01:20:39 +00:00
deweibel@gmail.com b53b749fc7 Fix initialization of idleTimeout
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2602 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-06-20 21:11:45 +00:00
deweibel@gmail.com 20cdf7c698 Add hDOP for ublox gps driver
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2241 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-05-11 02:54:43 +00:00
deweibel e620eb1326 Change MediaTek timestamps to millisecond Time of Day
Add epoch method to return timestamp epoch.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1589 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-01 23:50:36 +00:00
DrZiplok@gmail.com 8da4a29d58 Add support for the DIYD MTK v1.6 firmware
Nuke AP_GPS_IMU, as nothing is using it anymore.
Simplify the handling of no GPS/no fix detection.
Fix prototypes for ::init and ::read.
Update AP_GPS_Auto and corresponding example, nearly ready for primetime.
Use uint8_t rather than byte.
Strip some _error() calls to save space.  More could still go.



git-svn-id: https://arducopter.googlecode.com/svn/trunk@1246 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-24 06:35:09 +00:00
james.goppert aa115aea68 AP_GPS libs now recover from disconnect or failed initialization.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1188 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-19 13:24:29 +00:00
DrZiplok@gmail.com 0a94520682 Add support for automatically detecting the connected GPS and configuring accordingly.
Note that this is currently disabled as changes need to be made to APM to support it.

Tested with MTK, u-blox and SiRF GPS'.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@671 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-10-17 06:06:04 +00:00
paulbmather@gmail.com 079dd3c617 Changes to accommodate blinking lights and loss of GPS commands. Tested with NMEA, uBlox, Sirf and MTK. Does not function correctly with rmack's changes to APM_Compass posted 10/17/2010 (I don't know why).
git-svn-id: https://arducopter.googlecode.com/svn/trunk@669 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-10-17 04:07:46 +00:00
DrZiplok@gmail.com c981b7d0b0 Rework the u-blox driver.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@422 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-06 22:31:18 +00:00
DrZiplok@gmail.com 7e345e027c Push server-native line endings.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@418 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-06 20:16:50 +00:00
DrZiplok@gmail.com 96a80f1c66 Cleanup.
Teach AP_GPS about FastSerial (in the few places it needs to know) and about Stream everywhere else.

Do some minor code cleanup.

Tested with Mega and uBlox.  Some issues (e.g. reporting 0 satelites) remain.



git-svn-id: https://arducopter.googlecode.com/svn/trunk@404 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-06 09:20:44 +00:00
jasonshort 4f02edac51 New GPS Lib
git-svn-id: https://arducopter.googlecode.com/svn/trunk@342 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-08-29 22:08:33 +00:00
jasonshort 241b710001 updates - Ublox now working
git-svn-id: https://arducopter.googlecode.com/svn/trunk@313 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-08-25 17:32:55 +00:00
jasonshort 2c6e096a3b New Libraries
git-svn-id: https://arducopter.googlecode.com/svn/trunk@286 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-08-24 04:13:27 +00:00