Commit Graph

706 Commits

Author SHA1 Message Date
Andrew Tridgell 048dfee68a AP_GPS: make SBF driver more robust
this fixes a crash bug in the SBF GPS driver where a badly formed packet
could cause crc16_ccitt to reference invalid memory
2017-09-06 10:41:33 +10:00
Lucas De Marchi b62e8909c4 AP_GPS: add missing fallthrough 2017-09-01 13:45:22 -07:00
Lucas De Marchi 3414883f05 AP_GPS: remove tabs and fix coding style 2017-08-22 23:59:13 -07:00
Lucas De Marchi 8389158d76 AP_GPS: use FALLTHROUGH define
When falling through on a case switch, allow to add an empty statement
with the correct attribute to tell the compiler this behavior is
intended.
2017-08-22 23:59:13 -07:00
Peter Barker 7f59279670 AP_GPS: make time_epoch_usec const 2017-07-28 14:27:53 +01:00
Peter Barker e7ff5107fb AP_GPS: tidy mavlink message handling using switch statement 2017-07-27 12:03:25 +01:00
Peter Barker 2ad453fc89 AP_GPS: handle inject packets as part of handle_msg 2017-07-27 12:03:25 +01:00
Dr.-Ing. Amilcar Do Carmo Lucas b791fef7cb AP_GPS: Publish the number of satellites in the RTK correction messages, and the age of the RTK correction messages 2017-07-19 20:42:23 +09:00
Dr.-Ing. Amilcar Do Carmo Lucas ae47ac5a09 AP_GPS: implement missing "RTK number of satellites" and "RTK correction age" information in the GPS2_RAW MAVLink message 2017-07-19 20:42:23 +09:00
Dr.-Ing. Amilcar Do Carmo Lucas 059c213d19 AP_GPS: Improve comments and documentation (NFC) 2017-07-19 20:42:23 +09:00
Michael du Breuil 5684a5dd36 AP_GPS: Only setup state's instance field during init 2017-07-18 21:21:50 +01:00
Andrew Tridgell 82e7e44cc3 AP_GPS: fixed UAVCAN as 2nd GPS
This fixes the issue here:

  https://discuss.ardupilot.org/t/ac3-6-dev-dual-gps-issues/19172

thanks to Francisco for spotting the issue

this is tested with UAVCAN as 2nd GPS, ublox as primary
2017-07-18 18:57:55 +01:00
Peter Barker 76847a2487 AP_GPS: eliminate GCS_MAVLINK::send_statustext_all 2017-07-11 23:53:53 +01:00
Michael du Breuil cb1b9b6674 AP_GPS: Fix SBF race condition on start
Unsure what the underlying problem is, but the length of the first string in
the initilisation_blob increasing resulted in a race condition, waiting
longer before retrying the message resolves it, but we still need to identify
the underlying problem. This patch just results in the GPS working with current
configurations. Tested against AsteRx-M firmware 3.6.3
2017-07-11 09:40:02 +09:00
Eugene Shamaev 5341e51f45 AP_GPS: support for multiple instances on different interfaces 2017-07-03 11:44:32 +01:00
Peter Barker cbe9627bf5 AP_GPS: correct example 2017-06-29 15:43:38 +01:00
Peter Barker 7258cfd20b AP_GPS: check dataflash to see if we should log backend gps messages 2017-06-29 15:43:38 +01:00
Francisco Ferreira f35f0d59dd
AP_GPS: fix SBP2 driver build warnings by using memcpy
Build gave the following warnings:

../../libraries/AP_GPS/AP_GPS_SBP2.cpp: In member function ‘void AP_GPS_SBP2::_sbp_process_message()’:
../../libraries/AP_GPS/AP_GPS_SBP2.cpp:181:78: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
             last_heartbeat = *((struct sbp_heartbeat_t*)parser_state.msg_buff);
                                                                              ^
../../libraries/AP_GPS/AP_GPS_SBP2.cpp:181:28: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
             last_heartbeat = *((struct sbp_heartbeat_t*)parser_state.msg_buff);
                            ^
../../libraries/AP_GPS/AP_GPS_SBP2.cpp:186:76: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
             last_gps_time = *((struct sbp_gps_time_t*)parser_state.msg_buff);
                                                                            ^
../../libraries/AP_GPS/AP_GPS_SBP2.cpp:186:27: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
             last_gps_time = *((struct sbp_gps_time_t*)parser_state.msg_buff);
                           ^
../../libraries/AP_GPS/AP_GPS_SBP2.cpp:190:74: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
             last_vel_ned = *((struct sbp_vel_ned_t*)parser_state.msg_buff);
                                                                          ^
../../libraries/AP_GPS/AP_GPS_SBP2.cpp:190:26: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
             last_vel_ned = *((struct sbp_vel_ned_t*)parser_state.msg_buff);
                          ^
../../libraries/AP_GPS/AP_GPS_SBP2.cpp:194:74: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
             last_pos_llh = *((struct sbp_pos_llh_t*)parser_state.msg_buff);
                                                                          ^
../../libraries/AP_GPS/AP_GPS_SBP2.cpp:194:26: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
             last_pos_llh = *((struct sbp_pos_llh_t*)parser_state.msg_buff);
                          ^
../../libraries/AP_GPS/AP_GPS_SBP2.cpp:198:68: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
             last_dops = *((struct sbp_dops_t*)parser_state.msg_buff);
                                                                    ^
../../libraries/AP_GPS/AP_GPS_SBP2.cpp:198:23: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
             last_dops = *((struct sbp_dops_t*)parser_state.msg_buff);
                       ^
../../libraries/AP_GPS/AP_GPS_SBP2.cpp:202:74: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
             last_event = *((struct sbp_ext_event_t*)parser_state.msg_buff);
                                                                          ^
../../libraries/AP_GPS/AP_GPS_SBP2.cpp:202:24: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
             last_event = *((struct sbp_ext_event_t*)parser_state.msg_buff);
                        ^
2017-06-29 15:18:09 +01:00
ebethon 005dbf41a7 AP_GPS: Add SBP EXT_EVENT Message to dataflash log 2017-06-29 15:18:05 +01:00
ebethon 4779a8f1f1 AP_GPS: Rename SBR1/SBR2 to SBRH/SBRM and change format
Add (sender_id, msg_len) in SBRM message
Add index/pages in SBRH/SBRM messages
Change format to integers to avoid GCS string parsing
Decrease data size in SBRH
2017-06-29 15:14:54 +01:00
Rob Ratcliff 60c6f8ad60 AP_GPS: fix bug when injecting messages bigger than 255 bytes
Commit 5261654 changed the used injection method so change this method signature to use uint16 for message length like previous injection method did
2017-06-27 03:06:26 +01:00
Michael du Breuil 249849dfa4 AP_GPS: Add an enum for _auto_config 2017-06-21 11:44:45 +01:00
Michael du Breuil 5f8633e322 AP_GPS: Allow backends to report their lag confidences 2017-06-21 11:44:45 +01:00
priseborough 5dcfc94371 AP_GPS: Add validity boolean to GPS lag reporting 2017-06-21 11:44:45 +01:00
priseborough bd0229b7bc AP_GPS: Fix bug in calculation of blended GPS delay 2017-06-21 11:44:45 +01:00
Michael du Breuil 6c3db3939e AP_GPS: Update comment on get_rate_ms()
AP_GPS::get_rate_ms() is only meant to help the GPS backends
2017-06-12 01:06:38 +01:00
Michael du Breuil ffe701bda3 AP_GPS: Use a static assert to check that the init blob is small enough 2017-05-31 14:39:53 +01:00
Michael du Breuil 1877d09f7c AP_GPS: Don't track detection time to broadcast baud rate 2017-05-30 23:37:59 +01:00
Michael du Breuil 84598544fb AP_GPS: Don't autodetect NMEA instances 2017-05-30 23:37:59 +01:00
Michael du Breuil a1479c4138 AP_GPS: SBF report driver lag 2017-05-26 17:42:15 +01:00
Michael du Breuil 3da3ad05bf AP_GPS: SBF report velocity accuracy 2017-05-26 17:42:15 +01:00
Michael du Breuil c7a89d5aa0 AP_GPS: Set unknown DOP's to UINT16_MAX, rather then 9999
This fixes the MAVLink reporting for unknown dops, and avoids the situation where a GPS driver could report a worse DOP then we could handle.

Also corrects an apparent error in the HIL_GPS MAVLink message, where we would always select the unknown dop value rather then provided DOP.
2017-05-25 11:03:33 -07:00
Michael du Breuil 397ae00526 AP_GPS: SBF report VDOP 2017-05-24 20:03:29 +01:00
Dr.-Ing. Amilcar Do Carmo Lucas 2d5033b132 AP_GPS: Use SI units conventions in parameter units
Follow the rules from:
http://physics.nist.gov/cuu/Units/units.html
http://physics.nist.gov/cuu/Units/outside.html
and
http://physics.nist.gov/cuu/Units/checklist.html
one further constrain is that only printable (7bit) ASCII characters are allowed
2017-05-17 18:07:25 +10:00
Peter Barker e9ce3aa0ce AP_GPS: use HAL_SEMAPHORE_BLOCK_FOREVER macro 2017-05-08 10:23:03 +09:00
Dr.-Ing. Amilcar Do Carmo Lucas e31ac00f26 AP_GPS: fix spelling in comments 2017-05-08 10:08:31 +09:00
Andrew Tridgell 3687b6bdf0 AP_GPS: rename macros to avoid conflicts
these macros were also defined in NuttX in clock.h
2017-05-06 15:21:14 +10:00
Dr.-Ing. Amilcar Do Carmo Lucas 1691a39b36 AP_GPS: spell in comments 2017-05-03 08:45:08 +09:00
Dr.-Ing. Amilcar Do Carmo Lucas 5b67b33310 AP_GPS: Remove un-used AP_GPS::inject_data_all() function 2017-05-01 13:06:18 +01:00
Dr.-Ing. Amilcar Do Carmo Lucas 5261654756 AP_GPS: Only inject RTCM data to the selected GPS device defined in GPS_INJECT_TO parameter 2017-05-01 13:06:18 +01:00
Michael du Breuil 12f83ecf75 AP_GPS: SBF if RAW_DATA is enabled check that the GPS is succeeding at logging 2017-05-01 13:04:52 +01:00
Michael du Breuil d91f89d24b AP_GPS: Remove stale ublox config files
These configurations no longer (and haven't for quite awhile) matched the
desired command set or baud rates, loading them will still require the GPS
driver to tweak settings, or have AUTO_CONFIG turned off, which is a less
safe configuration.
2017-04-23 21:15:58 +01:00
Peter Barker 1ba59b446c AP_GPS: log ublox sw and hw versions on dataflash log start
This burns 41 bytes of RAM for each u-Blox GPS.
2017-04-23 21:04:17 +01:00
Peter Barker b7baca8d43 AP_GPS: move GPS type announcements into backend
See #4584
2017-04-23 21:04:17 +01:00
Peter Barker c46ea73426 AP_GPS: rename QURTGPS to QURT 2017-04-23 21:04:15 +01:00
Peter Barker 2354a0ec5a AP_GPS: ability to log GPS detection state to dataflash 2017-04-23 21:03:23 +01:00
Peter Barker 94a5e94ec9 AP_GPS: canonicalise statustext messages
Use "GPS %d" prefix, where %d is instance+1, to correspond
with parameters
2017-04-23 09:09:30 +10:00
Peter Barker 4334a92ac9 AP_GPS: remove unimplemented method declarations 2017-04-23 09:08:30 +10:00
Michael du Breuil 6f297deaf7 AP_GPS: Unify inject_data interface for all classes 2017-04-19 02:05:51 +01:00
Niels Joubert 4bf9fc071c AP_GPS: Adds SBP Version 2: Swift Navigation Piksi Multi support
This commit adds:

- New driver for SBPv2
--- Support Piksi Multi, Swift Navigation's multi-band multi-constellation GPS
--- Proper parsing of SBP flags
--- Instant response to Piksi status changes (no more timeouts)
--- Support for Piksi Multi as a Single-Point-Positioning GPS or only onboard GPS
--- Incorporates horizontal and vertical accuracy estimates, and vdop.
- Updates driver for SBPv0
--- Continue support for previous Piksi

- Dispatches correct driver based on SBP version.
2017-04-18 18:25:54 +01:00
Eugene Shamaev 8130d85b42 AP_GPS: removal of legacy UAVCAN support 2017-04-17 17:27:18 +10:00
Pierre Kancir 292fa5f413 AP_GPS: example fix travis warning
missing function declaration
implicit cast
some style fix
2017-04-13 19:56:16 +01:00
Eugene Shamaev dfe9b0e6fc AP_GPS: support for UAVCAN connected GNSS receivers 2017-04-10 22:38:12 +01:00
Michael du Breuil 6b523cbd46 AP_GPS: Fix a memory leak in QURT GPS
Fixes part of #6000
2017-04-09 16:56:00 +10:00
Jacob Walser 1b00dfb642 AP_GPS: Fix parameter metadata 2017-03-22 16:16:26 -07:00
Pierre Kancir afb488c627 AP_GPS: fix implicit conversion warning from float to double 2017-03-17 13:07:57 +01:00
Randy Mackay b82098ca44 AP_GPS: fix blended ground course
Thanks to jyl58 for finding this
2017-03-13 11:21:47 +09:00
Randy Mackay 3e628f30ff AP_GPS: fix blending when accuracy reported as 1mm
Thanks to Michael DuBreuil for suggesting the fix
2017-03-13 11:31:51 +11:00
Randy Mackay 2002827de3 AP_GPS: rename pre-arm blending health check 2017-03-13 11:31:51 +11:00
Randy Mackay e9c881c668 AP_GPS: stop blending if too many blending failures 2017-03-13 11:31:51 +11:00
Randy Mackay b7ad8da9b9 AP_GPS: minor bracketing fix
This silences a warning from eclipse
No functional change
2017-03-13 11:31:51 +11:00
Randy Mackay 5de64273ec AP_GPS: more efficient initialisation of blending arrays 2017-03-13 11:31:51 +11:00
Randy Mackay 81b20e971b AP_GPS_UBLOX: use get_rate_ms accessor 2017-03-13 11:31:51 +11:00
Randy Mackay ef1399a52f AP_GPS: fixups after peer review
This includes these changes:
RATE_MS, RATE_MS2 parameter description Range minimum reduced to 50
_blend_health_counter is reset to 0 if blending is disabled
GPS_MAX_RECEIVERS is replaced with GPS_BLENDED_INSTANCE where appropriate
simplify all_consistent functions check of number of receivers
calc_blended_weights fix for initial check of how many receivers we have
remove unnecessary setting of GPS last time when blending fails
remove RebootRequired from AUTO_SWITCH param description
2017-03-13 11:31:51 +11:00
Randy Mackay 729ce34ce3 AP_GPS: add all_consistent and blend health for use as pre-arm check 2017-03-13 11:31:51 +11:00
Randy Mackay 72dfe1127f AP_GPS: protect parameters from being accessed externally
backends become friends so they can continue to access parameters held in frontend
get_rate_ms made private because only used by frontend
Also moved static arrays higher in cpp file
2017-03-13 11:31:51 +11:00
Randy Mackay 3172657f26 AP_GPS: move constructor and complex accessors to cpp file
These functions are slightly long and make the .h file hard to read.  Also saves a small amount of flash space.
No functional change
2017-03-13 11:31:51 +11:00
Randy Mackay 0066022a7f AP_GPS: check for valid instance in highest_supported_status
highest_supported_status will always return FIX_3D for blended or invalid instance
setHIL_Accuracy checks instance is 2 or less
send_mavlink_gps2_raw uses num_instances variable directly to avoid confusion with num_sensors
2017-03-13 11:31:51 +11:00
Randy Mackay e764f0d5d0 AP_GPS: sanity check update rate
Also minor spelling and parameter documentation fix
2017-03-13 11:31:51 +11:00
priseborough 6b26bdd454 AP_GPS: Add option to blend multiple GPS receivers
Fix pre-existing bug in hard switch logic
Update GPS_AUTO_SWITCH description
protect against zero accuracy estimates returned by GPS drivers
2017-03-13 11:31:51 +11:00
Randy Mackay cd379b0e86 AP_GPS: move time_epoch calcs into proper file
The frontend implementation was in the backend file
No functional change
2017-03-13 11:31:51 +11:00
Randy Mackay a79474dcbc AP_GPS: minor comment fix
No functional change
2017-03-13 11:31:51 +11:00
Randy Mackay 201504dbae AP_GPS: remove unused get_antenna_offsets()
callers always specify an instance
2017-03-13 11:31:51 +11:00
Randy Mackay 2d0258b6a2 AP_GPS: remove unused highest_supported_status(void) 2017-03-13 11:31:51 +11:00
Randy Mackay ac86c7999b AP_GPS_MAV: set have_accuracy as boolean 2017-03-13 11:31:51 +11:00
Michael Oborne e4ff445ea7 AP_GPS_GSOF-NOVA: fix last_gps_time_ms 2017-03-09 10:41:48 -08:00
Michael du Breuil 398ff823c0 AP_GPS: Always consider ublox as configured in sitl 2017-03-07 12:43:30 +11:00
Michael du Breuil 44bcd74a57 AP_GPS: Remove dead SBF code
CID 125035
2017-03-06 15:24:22 +00:00
Michael du Breuil 7b483a1460 AP_GPS: Ublox, always quickly set the rates until we have fetched the version 2017-02-23 07:33:58 +11:00
Andrew Tridgell 3ce7e4b322 AP_GPS: fixed fake uBlox with PVT message support 2017-02-21 06:09:33 +11:00
Lucas De Marchi 9f09442548 AP_GPS: rename UNIX_OFFSET
To keep consistency with other constants and make clear the unit.
2017-02-11 01:34:09 -08:00
murata 30151c8253 Global: Define MSEC_PER_SEC, MSEC_PER_WEEK, SEC_PER_WEEK and UNIX_OFFSET. 2017-02-11 01:34:09 -08:00
Lucas De Marchi 747f15b514 AP_GPS: add casts to consider literals as doubles
Since we pass -fsingle-precision-constant to the compiler, add casts to
make literals real doubles.
2017-02-06 09:27:22 -08:00
murata b77941c4f2 AP_GPS: Delete unnecessary code. 2017-02-03 15:11:27 +09:00
Andrew Tridgell c0cc2faefd AP_GPS: disable esoteric GPS types on FMUv2 2017-01-29 16:31:06 +11:00
Francisco Ferreira 7ea0baefb1
AP_GPS: re-fix SBP fix status 2017-01-28 17:43:58 +00:00
Francisco Ferreira 512bd08326
AP_GPS: fix SBP supported status 2017-01-28 17:29:48 +00:00
priseborough 6d53ab7b76 AP_GPS: minor comment change 2017-01-27 16:57:42 +09:00
priseborough 4a490d522e AP_GPS: use standard unit descriptor for milliseconds 2017-01-27 16:57:42 +09:00
priseborough be0096e812 AP_GPS: Allow the user to specify the GPS time delay
If the user sets a non-zero value of the delay it will be used in preference over the default value for that GPS type.
If the GPS type is unknown and the parameter is set to zero, then a default delay of 1 sample period will be used (eg 200ms for 5Hz).
2017-01-27 16:57:42 +09:00
Andrew Tridgell bdc0630ccf AP_GPS: added all_configured() function
used for EKF to tell if gps_lag is valid
2017-01-27 16:57:42 +09:00
Andrew Tridgell 5d18f3a453 AP_GPS: added backend specific get_lag() function
the ublox7 and 8 seem to produce lower lag, around 120ms. Separately
we should also look at running these at 10Hz and see if that helps.
2017-01-27 16:57:42 +09:00
murata 3200f24106 AP_GPS: Unify from print or println to printf. 2017-01-27 18:20:22 +11:00
Francisco Ferreira 1fc0dbe0bd
AP_GPS: fix GSOF highest supported status 2017-01-26 00:04:32 +00:00
Michael Oborne 8e9f382240 AP_GPS_GSOF: update for new GPS_FIX's 2017-01-26 00:04:19 +00:00
Michael du Breuil 0cf41c9288 AP_GPS: Force ublox baud rate if we are allowed to config the GPS 2017-01-26 07:48:22 +09:00
Michael du Breuil 855d91145a AP_GPS: ublox - fix incorrect step ordering 2017-01-25 03:44:57 +00:00
Michael du Breuil 1c1e6e9398 AP_GPS: Support more fix types 2017-01-25 03:44:42 +00:00
Michael Oborne d05b0d5885 AP_GPS_UBLOX: add pvt message support 2017-01-25 03:34:26 +00:00
Francisco Ferreira d472fbde0c
AP_GPS: fix PX4 GPS driver leap seconds 2017-01-21 21:59:36 +00:00