Skip to content

Commit

Permalink
Merge pull request #392 from sparkfun/AddTipAltitudeSetting
Browse files Browse the repository at this point in the history
Add tip altitude setting
  • Loading branch information
nseidle authored Jun 26, 2024
2 parents 56c100f + 5fc762c commit 92d3f8e
Show file tree
Hide file tree
Showing 11 changed files with 318 additions and 194 deletions.
43 changes: 29 additions & 14 deletions Firmware/RTK_Everywhere/AP-Config/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@


<div class="form-group row">
<label for="antennaHeight" class="box-margin40 col-sm-3 col-5 col-form-label">Antenna
<label for="antennaHeight_mm" class="box-margin40 col-sm-3 col-5 col-form-label">Antenna
Height(mm):
<span class="tt" data-bs-placement="right"
title="Distance from the base of the antenna to the mark on the ground. This is usually the total length of the prism pole and any extensions. Amount is added to HAE before starting fixed base.">
Expand All @@ -709,22 +709,22 @@
</label>

<div class="col-sm-4 col-5">
<input type="number" class="form-control" id="antennaHeight">
<p id="antennaHeightError" class="inlineError"></p>
<input type="number" class="form-control" id="antennaHeight_mm">
<p id="antennaHeight_mmError" class="inlineError"></p>
</div>
</div>

<div class="form-group row">
<label for="antennaReferencePoint" class="box-margin40 col-5 col-form-label">Antenna
Reference Point(mm):
<label for="antennaPhaseCenter_mm" class="box-margin40 col-5 col-form-label">Antenna
Phase Center(mm):
<span class="tt" data-bs-placement="right"
title="ARP is the distance from the base of the antenna to the antenna phase center. This is usually printed on the side of the antenna and is calculated during antenna calibration. Amount is added to HAE before starting fixed base. Common ARPs: Facet L-Band (69mm) Torch(117mm)">
title="APC is the distance from the base of the antenna to the antenna phase center. This is usually printed on the side of the antenna and is calculated during antenna calibration. Amount is added to HAE before starting fixed base. Common APCs: Torch(117mm)">
<span class="icon-info-circle text-primary ms-2"></span>
</span>
</label>
<div class="col-sm-4 col-5">
<input type="number" class="form-control" id="antennaReferencePoint">
<p id="antennaReferencePointError" class="inlineError"></p>
<input type="number" class="form-control" id="antennaPhaseCenter_mm">
<p id="antennaPhaseCenter_mm" class="inlineError"></p>
</div>
</div>

Expand Down Expand Up @@ -1687,11 +1687,11 @@
</div>
</div>

<!-- --------- Tilt Config --------- -->
<!-- --------- Instrument Config --------- -->
<div class="d-grid gap-2">
<button class="btn btn-primary mt-3 toggle-btn" id="tiltConfig" type="button" data-toggle="collapse"
data-target="#collapseTiltConfig" aria-expanded="false" aria-controls="collapseTiltConfig">
Tilt Configuration <i id="tiltCaret" class="caret-icon bi icon-caret-down"></i>
Instrument Configuration <i id="tiltCaret" class="caret-icon bi icon-caret-down"></i>
</button>
</div>
<div class="collapse" id="collapseTiltConfig">
Expand All @@ -1708,17 +1708,32 @@
</span>
</div>

<div id="poleLengthConfig">
<div id="antennaHeight_mConfig">
<div class="form-group row">
<label for="tiltPoleLength" class="col-sm-4 col-6 col-form-label">Pole Length (m):
<label for="antennaHeight_m" class="col-sm-4 col-6 col-form-label">Antenna Height (a.k.a. Pole Length) (m):
<span class="tt" data-bs-placement="right"
title="This is the length of the pole only, no additional ARP should be included. Default: 1.8m">
<span class="icon-info-circle text-primary ms-2"></span>
</span>
</label>
<div class="col-sm-4 col-6">
<input type="number" class="form-control" id="tiltPoleLength">
<p id="tiltPoleLengthError" class="inlineError"></p>
<input type="number" class="form-control" id="antennaHeight_m">
<p id="antennaHeight_mError" class="inlineError"></p>
</div>
</div>
</div>

<div id="antennaPhaseCenter_mmConfig">
<div class="form-group row">
<label for="antennaPhaseCenter_mm" class="col-sm-4 col-6 col-form-label">Antenna Phase Center (mm):
<span class="tt" data-bs-placement="right"
title="This is the distance between the ARP and the antenna phase center. Default: 116mm">
<span class="icon-info-circle text-primary ms-2"></span>
</span>
</label>
<div class="col-sm-4 col-6">
<input type="number" class="form-control" id="antennaPhaseCenter_mm">
<p id="antennaPhaseCenter_mmError" class="inlineError"></p>
</div>
</div>
</div>
Expand Down
54 changes: 22 additions & 32 deletions Firmware/RTK_Everywhere/AP-Config/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ function parseIncoming(msg) {
ge("enablePointPerfectCorrections").dispatchEvent(new CustomEvent('change'));
ge("enableExternalPulse").dispatchEvent(new CustomEvent('change'));
ge("enableEspNow").dispatchEvent(new CustomEvent('change'));
ge("antennaReferencePoint").dispatchEvent(new CustomEvent('change'));
ge("antennaPhaseCenter_mm").dispatchEvent(new CustomEvent('change'));
ge("enableLogging").dispatchEvent(new CustomEvent('change'));
ge("enableARPLogging").dispatchEvent(new CustomEvent('change'));
ge("enableAutoFirmwareUpdate").dispatchEvent(new CustomEvent('change'));
Expand All @@ -439,7 +439,6 @@ function parseIncoming(msg) {
dhcpEthernet();
updateLatLong();
updateCorrectionsPriorities();
tiltCompensationBoxes();
}
}

Expand Down Expand Up @@ -642,8 +641,8 @@ function validateFields() {
clearElement("fixedLatText", 40.09029479);
clearElement("fixedLongText", -105.18505761);
clearElement("fixedAltitude", 1560.089);
clearElement("antennaHeight", 0);
clearElement("antennaReferencePoint", 0);
clearElement("antennaHeight_mm", 0);
clearElement("antennaPhaseCenter_mm", 0);
}
else {
clearElement("observationSeconds", 60);
Expand All @@ -653,8 +652,8 @@ function validateFields() {
clearElement("fixedLatText", 40.09029479);
clearElement("fixedLongText", -105.18505761);
clearElement("fixedAltitude", 1560.089);
clearElement("antennaHeight", 0);
clearElement("antennaReferencePoint", 0);
clearElement("antennaHeight_mm", 0);
clearElement("antennaPhaseCenter_mm", 0);

checkElementValue("fixedEcefX", -7000000, 7000000, "Must be -7000000 to 7000000", "collapseBaseConfig");
checkElementValue("fixedEcefY", -7000000, 7000000, "Must be -7000000 to 7000000", "collapseBaseConfig");
Expand All @@ -668,8 +667,8 @@ function validateFields() {
checkLatLong(); //Verify Lat/Long input type
checkElementValue("fixedAltitude", -11034, 8849, "Must be -11034 to 8849", "collapseBaseConfig");

checkElementValue("antennaHeight", -15000, 15000, "Must be -15000 to 15000", "collapseBaseConfig");
checkElementValue("antennaReferencePoint", -200.0, 200.0, "Must be -200.0 to 200.0", "collapseBaseConfig");
checkElementValue("antennaHeight_mm", -15000, 15000, "Must be -15000 to 15000", "collapseBaseConfig");
checkElementValue("antennaPhaseCenter_mm", -200.0, 200.0, "Must be -200.0 to 200.0", "collapseBaseConfig");
}
}

Expand Down Expand Up @@ -1321,13 +1320,13 @@ document.addEventListener("DOMContentLoaded", (event) => {
show("geodeticConfig");

if ((platformPrefix == "Facet mosaic") || (platformPrefix == "Facet v2")) {
ge("antennaReferencePoint").value = 61.4;
ge("antennaPhaseCenter_mm").value = 61.4;
}
else if (platformPrefix == "Torch") {
ge("antennaReferencePoint").value = 116.2;
ge("antennaPhaseCenter_mm").value = 116.2;
}
else {
ge("antennaReferencePoint").value = 0.0;
ge("antennaPhaseCenter_mm").value = 0.0;
}
}
});
Expand Down Expand Up @@ -1450,11 +1449,11 @@ document.addEventListener("DOMContentLoaded", (event) => {
adjustHAE();
});

ge("antennaHeight").addEventListener("change", function () {
ge("antennaHeight_mm").addEventListener("change", function () {
adjustHAE();
});

ge("antennaReferencePoint").addEventListener("change", function () {
ge("antennaPhaseCenter_mm").addEventListener("change", function () {
adjustHAE();
});

Expand Down Expand Up @@ -1621,21 +1620,21 @@ function addGeodetic() {
checkElementString("nicknameGeodetic", 1, 49, "Must be 1 to 49 characters", "collapseBaseConfig");
checkLatLong();
checkElementValue("fixedAltitude", -11034, 8849, "Must be -11034 to 8849", "collapseBaseConfig");
checkElementValue("antennaHeight", -15000, 15000, "Must be -15000 to 15000", "collapseBaseConfig");
checkElementValue("antennaReferencePoint", -200.0, 200.0, "Must be -200.0 to 200.0", "collapseBaseConfig");
checkElementValue("antennaHeight_mm", -15000, 15000, "Must be -15000 to 15000", "collapseBaseConfig");
checkElementValue("antennaPhaseCenter_mm", -200.0, 200.0, "Must be -200.0 to 200.0", "collapseBaseConfig");

if (errorCount == 0) {
//Check name against the list
var index = 0;
for (; index < recordsGeodetic.length; ++index) {
var parts = recordsGeodetic[index].split(' ');
if (ge("nicknameGeodetic").value == parts[0]) {
recordsGeodetic[index] = nicknameGeodetic.value + ' ' + fixedLatText.value + ' ' + fixedLongText.value + ' ' + fixedAltitude.value + ' ' + antennaHeight.value + ' ' + antennaReferencePoint.value;
recordsGeodetic[index] = nicknameGeodetic.value + ' ' + fixedLatText.value + ' ' + fixedLongText.value + ' ' + fixedAltitude.value + ' ' + antennaHeight_mm.value + ' ' + antennaPhaseCenter_mm.value;
break;
}
}
if (index == recordsGeodetic.length)
recordsGeodetic.push(nicknameGeodetic.value + ' ' + fixedLatText.value + ' ' + fixedLongText.value + ' ' + fixedAltitude.value + ' ' + antennaHeight.value + ' ' + antennaReferencePoint.value);
recordsGeodetic.push(nicknameGeodetic.value + ' ' + fixedLatText.value + ' ' + fixedLongText.value + ' ' + fixedAltitude.value + ' ' + antennaHeight_mm.value + ' ' + antennaPhaseCenter_mm.value);
}

updateGeodeticList();
Expand All @@ -1661,13 +1660,13 @@ function adjustHAE() {
if (haeMethod == 1) {
ge("fixedHAEAPC").disabled = false;
ge("fixedAltitude").disabled = true;
hae = Number(ge("fixedHAEAPC").value) - (Number(ge("antennaHeight").value) / 1000 + Number(ge("antennaReferencePoint").value) / 1000);
hae = Number(ge("fixedHAEAPC").value) - (Number(ge("antennaHeight_mm").value) / 1000 + Number(ge("antennaPhaseCenter_mm").value) / 1000);
ge("fixedAltitude").value = hae.toFixed(3);
}
else {
ge("fixedHAEAPC").disabled = true;
ge("fixedAltitude").disabled = false;
hae = Number(ge("fixedAltitude").value) + (Number(ge("antennaHeight").value) / 1000 + Number(ge("antennaReferencePoint").value) / 1000);
hae = Number(ge("fixedAltitude").value) + (Number(ge("antennaHeight_mm").value) / 1000 + Number(ge("antennaPhaseCenter_mm").value) / 1000);
ge("fixedHAEAPC").value = hae.toFixed(3);
}
}
Expand All @@ -1693,8 +1692,8 @@ function loadGeodetic() {
}
}
ge("fixedAltitude").value = parts[numParts - 3];
ge("antennaHeight").value = parts[numParts - 2];
ge("antennaReferencePoint").value = parts[numParts - 1];
ge("antennaHeight_mm").value = parts[numParts - 2];
ge("antennaPhaseCenter_mm").value = parts[numParts - 1];

$("input[name=markRadio][value=1]").prop('checked', false);
$("input[name=markRadio][value=2]").prop('checked', true);
Expand All @@ -1705,8 +1704,8 @@ function loadGeodetic() {
clearError("fixedLatText");
clearError("fixedLongText");
clearError("fixedAltitude");
clearError("antennaHeight");
clearError("antennaReferencePoint");
clearError("antennaHeight_mm");
clearError("antennaPhaseCenter_mm");
}
else {
console.log("stationGeodetic split error");
Expand Down Expand Up @@ -1924,15 +1923,6 @@ function udpBoxes() {
}
}

function tiltCompensationBoxes() {
if (ge("enableTiltCompensation").checked == true) {
show("poleLengthConfig");
}
else {
hide("poleLengthConfig");
}
}

function dhcpEthernet() {
if (ge("ethernetDHCP").checked == true) {
hide("fixedIPSettingsConfigEthernet");
Expand Down
20 changes: 12 additions & 8 deletions Firmware/RTK_Everywhere/Begin.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Begin.ino
radio, etc.
------------------------------------------------------------------------------*/

#include <esp_mac.h> // required - exposes esp_mac_type_t values
#include <esp_mac.h> // required - exposes esp_mac_type_t values

//----------------------------------------
// Constants
Expand Down Expand Up @@ -141,7 +141,7 @@ void beginBoard()
present.button_powerHigh = true; // Button is pressed when high
present.beeper = true;
present.gnss_to_uart = true;
present.antennaReferencePoint_mm = 115.7;
present.antennaPhaseCenter_mm = 115.7;
present.needsExternalPpl = true; // Uses the PointPerfect Library
present.galileoHasCapable = true;

Expand Down Expand Up @@ -835,9 +835,9 @@ void beginInterrupts()
if (present.ethernet_ws5500 == true)
{
DMW_if systemPrintf("pin_Ethernet_Interrupt: %d\r\n", pin_Ethernet_Interrupt);
pinMode(pin_Ethernet_Interrupt, INPUT); // Prepare the interrupt pin
pinMode(pin_Ethernet_Interrupt, INPUT); // Prepare the interrupt pin
// TODO: figure out how to handle NTP mode and timestamp the arrival of UDP NTP requests
//attachInterrupt(pin_Ethernet_Interrupt, ethernetISR, FALLING); // Attach the interrupt
// attachInterrupt(pin_Ethernet_Interrupt, ethernetISR, FALLING); // Attach the interrupt
}
#endif // COMPILE_ETHERNET
}
Expand All @@ -848,22 +848,22 @@ void tickerBegin()
if (pin_bluetoothStatusLED != PIN_UNDEFINED)
{
ledcAttach(pin_bluetoothStatusLED, pwmFreq, pwmResolution);
ledcWrite(pin_bluetoothStatusLED, 255); // Turn on BT LED at startup
//Attach happens in bluetoothStart()
ledcWrite(pin_bluetoothStatusLED, 255); // Turn on BT LED at startup
// Attach happens in bluetoothStart()
}

if (pin_gnssStatusLED != PIN_UNDEFINED)
{
ledcAttach(pin_gnssStatusLED, pwmFreq, pwmResolution);
ledcWrite(pin_gnssStatusLED, 0); // Turn off GNSS LED at startup
ledcWrite(pin_gnssStatusLED, 0); // Turn off GNSS LED at startup
gnssLedTask.detach(); // Turn off any previous task
gnssLedTask.attach(1.0 / gnssTaskUpdatesHz, tickerGnssLedUpdate); // Rate in seconds, callback
}

if (pin_batteryStatusLED != PIN_UNDEFINED)
{
ledcAttach(pin_batteryStatusLED, pwmFreq, pwmResolution);
ledcWrite(pin_batteryStatusLED, 0); // Turn off battery LED at startup
ledcWrite(pin_batteryStatusLED, 0); // Turn off battery LED at startup
batteryLedTask.detach(); // Turn off any previous task
batteryLedTask.attach(1.0 / batteryTaskUpdatesHz, tickerBatteryLedUpdate); // Rate in seconds, callback
}
Expand Down Expand Up @@ -1114,6 +1114,10 @@ void beginSystemState()

if (settings.enablePointPerfectCorrections)
systemState = STATE_KEYS_STARTED; // Begin process for getting new keys

//If the setting is not set, override with default
if (settings.antennaPhaseCenter_mm == 0.0)
settings.antennaPhaseCenter_mm = present.antennaPhaseCenter_mm;
}
else
{
Expand Down
10 changes: 4 additions & 6 deletions Firmware/RTK_Everywhere/Tasks.ino
Original file line number Diff line number Diff line change
Expand Up @@ -477,13 +477,11 @@ void processUart1Message(SEMP_PARSE_STATE *parse, uint16_t type)
}
}

if (tiltIsCorrecting() == true)
// Handle LLA compensation due to tilt or outputTipAltitude setting
if (type == RTK_NMEA_PARSER_INDEX)
{
if (type == RTK_NMEA_PARSER_INDEX)
{
parse->buffer[parse->length++] = '\0'; // Null terminate string
tiltApplyCompensation((char *)parse->buffer, parse->length);
}
parse->buffer[parse->length++] = '\0'; // Null terminate string
nmeaApplyCompensation((char *)parse->buffer, parse->length);
}

// Determine where to send RTCM data
Expand Down
Loading

0 comments on commit 92d3f8e

Please sign in to comment.