This repository was archived by the owner on Jun 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Add Iono correction #16
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| /* | ||
| * Copyright (C) 2016 Swift Navigation Inc. | ||
| * Contact: Dmitry Tatarinov <[email protected]> | ||
| * | ||
| * This source is subject to the license found in the file 'LICENSE' which must | ||
| * be be distributed together with this source. All other rights reserved. | ||
| * | ||
| * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, | ||
| * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED | ||
| * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| */ | ||
|
|
||
| #include <assert.h> | ||
| #include <string.h> | ||
| #include <ch.h> | ||
|
|
||
| #include "iono.h" | ||
| #include "signal.h" | ||
|
|
||
| static MUTEX_DECL(iono_mutex); | ||
|
|
||
| static ionosphere_t iono_params; | ||
| static bool iono_params_decoded_flag = false; | ||
|
|
||
| /** Stores ionospheric parameters | ||
| * \param params pointer to ionospheric parameters to be stored | ||
| */ | ||
| void gps_iono_params_store(const ionosphere_t *params) | ||
| { | ||
| assert(params != NULL); | ||
| chMtxLock(&iono_mutex); | ||
| memcpy(&iono_params, params, sizeof(ionosphere_t)); | ||
| iono_params_decoded_flag = true; | ||
| chMtxUnlock(&iono_mutex); | ||
| } | ||
|
|
||
| /** Reads ionospheric parameters | ||
| * \param params pointer to ionospheric | ||
| * \return 1 if iono parameters available otherwise 0 | ||
| */ | ||
| u8 gps_iono_params_read(ionosphere_t *params) | ||
| { | ||
| u8 result = 0; | ||
| assert(params != NULL); | ||
| chMtxLock(&iono_mutex); | ||
| if (iono_params_decoded_flag) { | ||
| memcpy(params, &iono_params, sizeof(ionosphere_t)); | ||
| result = 1; | ||
| } | ||
| chMtxUnlock(&iono_mutex); | ||
| return result; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| /* | ||
| * Copyright (C) 2016 Swift Navigation Inc. | ||
| * Contact: Dmitry Tatarinov <[email protected]> | ||
| * | ||
| * This source is subject to the license found in the file 'LICENSE' which must | ||
| * be be distributed together with this source. All other rights reserved. | ||
| * | ||
| * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, | ||
| * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED | ||
| * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| */ | ||
|
|
||
| #ifndef SRC_IONO_H_ | ||
| #define SRC_IONO_H_ | ||
|
|
||
| #include <libswiftnav/common.h> | ||
| #include <libswiftnav/ionosphere.h> | ||
|
|
||
| void gps_iono_params_store(const ionosphere_t *params); | ||
| u8 gps_iono_params_read(ionosphere_t *params); | ||
|
|
||
| #endif /* SRC_IONO_H_ */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,6 @@ | |
| * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED | ||
| * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| */ | ||
|
|
||
| #include <stdio.h> | ||
| #include <string.h> | ||
|
|
||
|
|
@@ -23,6 +22,7 @@ | |
| #include <libswiftnav/dgnss_management.h> | ||
| #include <libswiftnav/baseline.h> | ||
| #include <libswiftnav/linear_algebra.h> | ||
| #include <libswiftnav/troposphere.h> | ||
|
|
||
| #define memory_pool_t MemoryPool | ||
| #include <ch.h> | ||
|
|
@@ -43,6 +43,7 @@ | |
| #include "signal.h" | ||
| #include "system_monitor.h" | ||
| #include "main.h" | ||
| #include "iono.h" | ||
| #include "sid_set.h" | ||
|
|
||
| /* Maximum CPU time the solution thread is allowed to use. */ | ||
|
|
@@ -433,6 +434,9 @@ static void sol_thd_sleep(systime_t *deadline, systime_t interval) | |
| static THD_WORKING_AREA(wa_solution_thread, 8000); | ||
| static void solution_thread(void *arg) | ||
| { | ||
| /* The flag is true when we have a fix */ | ||
| bool soln_flag = false; | ||
|
|
||
| (void)arg; | ||
| chRegSetThreadName("solution"); | ||
|
|
||
|
|
@@ -534,6 +538,20 @@ static void solution_thread(void *arg) | |
| continue; | ||
| } | ||
|
|
||
| /* check if we have a solution, if yes calc iono and tropo correction */ | ||
| if (soln_flag) { | ||
| ionosphere_t i_params; | ||
| ionosphere_t *p_i_params = &i_params; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd just use
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. p_i_params is used as a flag and can be set to NULL. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, ok. |
||
| /* get iono parameters if available */ | ||
| if(!gps_iono_params_read(p_i_params)) { | ||
| p_i_params = NULL; | ||
| } | ||
| calc_iono_tropo(n_ready_tdcp, nav_meas_tdcp, | ||
| position_solution.pos_ecef, | ||
| position_solution.pos_llh, | ||
| p_i_params); | ||
| } | ||
|
|
||
| dops_t dops; | ||
| /* Calculate the SPP position | ||
| * disable_raim controlled by external setting. Defaults to false. */ | ||
|
|
@@ -548,11 +566,15 @@ static void solution_thread(void *arg) | |
| log_warn("PVT solver: %s (code %d)", pvt_err_msg[-pvt_ret-1], pvt_ret); | ||
| ); | ||
|
|
||
| soln_flag = false; | ||
|
|
||
| /* Send just the DOPs and exit the loop */ | ||
| solution_send_sbp(0, &dops, clock_jump); | ||
| continue; | ||
| } | ||
|
|
||
| soln_flag = true; | ||
|
|
||
| if (pvt_ret == 1) | ||
| log_warn("calc_PVT: RAIM repair"); | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just use
&i_paramsdirectly.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p_i_params is used as a flag and can be set to NULL.