|
| 1 | +/* |
| 2 | + Send UBX binary commands to enable RTCM sentences on Ublox ZED-F9P module |
| 3 | + By: Nathan Seidle |
| 4 | + SparkFun Electronics |
| 5 | + Date: January 9th, 2019 |
| 6 | + License: MIT. See license file for more information but you can |
| 7 | + basically do whatever you want with this code. |
| 8 | +
|
| 9 | + This example shows how to query the module for RELPOS information in the NED frame. |
| 10 | + It assumes you already have RTCM correction data being fed to the receiver. |
| 11 | +
|
| 12 | + Feel like supporting open source hardware? |
| 13 | + Buy a board from SparkFun! |
| 14 | + ZED-F9P RTK2: https://www.sparkfun.com/products/15136 |
| 15 | + NEO-M8P RTK: https://www.sparkfun.com/products/15005 |
| 16 | + SAM-M8Q: https://www.sparkfun.com/products/15106 |
| 17 | +
|
| 18 | + Hardware Connections: |
| 19 | + Plug a Qwiic cable into the GPS and a RedBoard Qwiic or BlackBoard |
| 20 | + If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425) |
| 21 | + Open the serial monitor at 115200 baud to see the output |
| 22 | +*/ |
| 23 | + |
| 24 | +#include <Wire.h> //Needed for I2C to GPS |
| 25 | + |
| 26 | +#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_Ublox_GPS |
| 27 | +SFE_UBLOX_GPS myGPS; |
| 28 | + |
| 29 | +void setup() |
| 30 | +{ |
| 31 | + Serial.begin(115200); |
| 32 | + while (!Serial); //Wait for user to open terminal |
| 33 | + Serial.println("Ublox Base station example"); |
| 34 | + |
| 35 | + Wire.begin(); |
| 36 | + Wire.setClock(400000); //Increase I2C clock speed to 400kHz |
| 37 | + |
| 38 | + if (myGPS.begin() == false) //Connect to the Ublox module using Wire port |
| 39 | + { |
| 40 | + Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing.")); |
| 41 | + while (1); |
| 42 | + } |
| 43 | +} |
| 44 | + |
| 45 | +void loop() |
| 46 | +{ |
| 47 | + if (myGPS.getRELPOSNED() == true) |
| 48 | + { |
| 49 | + Serial.print("relPosN: "); |
| 50 | + Serial.println(myGPS.relPosInfo.relPosN, 4); |
| 51 | + Serial.print("relPosE: "); |
| 52 | + Serial.println(myGPS.relPosInfo.relPosE, 4); |
| 53 | + Serial.print("relPosD: "); |
| 54 | + Serial.println(myGPS.relPosInfo.relPosD, 4); |
| 55 | + |
| 56 | + Serial.print("accN: "); |
| 57 | + Serial.println(myGPS.relPosInfo.accN, 4); |
| 58 | + Serial.print("accE: "); |
| 59 | + Serial.println(myGPS.relPosInfo.accE, 4); |
| 60 | + Serial.print("accD: "); |
| 61 | + Serial.println(myGPS.relPosInfo.accD, 4); |
| 62 | + |
| 63 | + Serial.print("gnssFixOk: "); |
| 64 | + if (myGPS.relPosInfo.gnssFixOk == true) |
| 65 | + Serial.println("x"); |
| 66 | + else |
| 67 | + Serial.println(""); |
| 68 | + |
| 69 | + Serial.print("diffSolution: "); |
| 70 | + if (myGPS.relPosInfo.diffSoln == true) |
| 71 | + Serial.println("x"); |
| 72 | + else |
| 73 | + Serial.println(""); |
| 74 | + |
| 75 | + Serial.print("relPosValid: "); |
| 76 | + if (myGPS.relPosInfo.relPosValid == true) |
| 77 | + Serial.println("x"); |
| 78 | + else |
| 79 | + Serial.println(""); |
| 80 | + |
| 81 | + Serial.print("carrier Solution Type: "); |
| 82 | + if (myGPS.relPosInfo.carrSoln == 0) |
| 83 | + Serial.println("None"); |
| 84 | + else if (myGPS.relPosInfo.carrSoln == 1) |
| 85 | + Serial.println("Float"); |
| 86 | + else if (myGPS.relPosInfo.carrSoln == 2) |
| 87 | + Serial.println("Fixed"); |
| 88 | + |
| 89 | + Serial.print("isMoving: "); |
| 90 | + if (myGPS.relPosInfo.isMoving == true) |
| 91 | + Serial.println("x"); |
| 92 | + else |
| 93 | + Serial.println(""); |
| 94 | + |
| 95 | + Serial.print("refPosMiss: "); |
| 96 | + if (myGPS.relPosInfo.refPosMiss == true) |
| 97 | + Serial.println("x"); |
| 98 | + else |
| 99 | + Serial.println(""); |
| 100 | + |
| 101 | + Serial.print("refObsMiss: "); |
| 102 | + if (myGPS.relPosInfo.refObsMiss == true) |
| 103 | + Serial.println("x"); |
| 104 | + else |
| 105 | + Serial.println(""); |
| 106 | + } |
| 107 | + else |
| 108 | + Serial.println("RELPOS request failed"); |
| 109 | + |
| 110 | + delay(4000); |
| 111 | +} |
0 commit comments