-
Notifications
You must be signed in to change notification settings - Fork 7.7k
GNSS RTK: Add basic integration #90890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
cfe352e
12ee24b
4150517
b29e100
2e6cd07
cfb5257
bf73af2
6045fcf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,31 @@ | ||||||
/* | ||||||
* Copyright (c) 2025 Croxel Inc. | ||||||
* Copyright (c) 2025 CogniPilot Foundation | ||||||
* | ||||||
* SPDX-License-Identifier: Apache-2.0 | ||||||
*/ | ||||||
|
||||||
#ifndef ZEPHYR_INCLUDE_GNSS_RTK_DECODER_H_ | ||||||
#define ZEPHYR_INCLUDE_GNSS_RTK_DECODER_H_ | ||||||
|
||||||
#include <stdint.h> | ||||||
#include <stddef.h> | ||||||
|
||||||
/** | ||||||
* @brief Get an RTK frame from buffer | ||||||
* | ||||||
* Used by RTK clients to extract frames from a data-buffer. | ||||||
* | ||||||
* @param[in] buf Buffer holding encoded data. | ||||||
* @param[in] buf_len Buffer length. | ||||||
* @param[out] data Pointer to the decoded frame. | ||||||
* @param[out] data_len Length of the decoded frame | ||||||
* | ||||||
* @return Zero if successful. | ||||||
* @return -ENOENT if no frames have been decoded successfully. | ||||||
* @return Other negative error code if decoding failed. | ||||||
*/ | ||||||
int gnss_rtk_decoder_frame_get(uint8_t *buf, size_t buf_len, | ||||||
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.
Suggested change
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. This was intentionally left as a mutable array because I was considering there may be some encoded frames with byte stuffing, hence leaving the option for the API to do things behind this API call. It is not certainly the case with the only one implementation (RTCM3), but I'd prefer keep it this way unless you feel strongly about enforcing it until an implementation that requires it comes by. 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 guess I am just confused by the fact of having two functions named exactly the same but having different signatures 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. Should be consistent now. Removed stray header file under |
||||||
uint8_t **data, size_t *data_len); | ||||||
|
||||||
#endif /* ZEPHYR_INCLUDE_GNSS_RTK_DECODER_H_ */ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (c) 2023 Trackunit Corporation | ||
* Copyright (c) 2025 Croxel Inc. | ||
* Copyright (c) 2025 CogniPilot Foundation | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#ifndef ZEPHYR_INCLUDE_GNSS_RTK_RTK_H_ | ||
#define ZEPHYR_INCLUDE_GNSS_RTK_RTK_H_ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include <stdint.h> | ||
#include <stddef.h> | ||
|
||
struct gnss_rtk_data { | ||
const uint8_t *data; | ||
size_t len; | ||
}; | ||
|
||
typedef void (*gnss_rtk_data_callback_t)(const struct device *dev, | ||
const struct gnss_rtk_data *data); | ||
|
||
struct gnss_rtk_data_callback { | ||
const struct device *dev; | ||
gnss_rtk_data_callback_t callback; | ||
}; | ||
|
||
#if CONFIG_GNSS_RTK | ||
#define GNSS_RTK_DATA_CALLBACK_DEFINE(_dev, _callback) \ | ||
static const STRUCT_SECTION_ITERABLE(gnss_rtk_data_callback, \ | ||
_gnss_rtk_data_callback__##_callback) = { \ | ||
.dev = _dev, \ | ||
.callback = _callback, \ | ||
} | ||
#else | ||
#define GNSS_RTK_DATA_CALLBACK_DEFINE(_dev, _callback) | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* ZEPHYR_INCLUDE_GNSS_RTK_RTK_H_ */ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright (c) 2025 Croxel Inc. | ||
* Copyright (c) 2025 CogniPilot Foundation | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#ifndef ZEPHYR_INCLUDE_GNSS_RTK_PUBLISH_H_ | ||
#define ZEPHYR_INCLUDE_GNSS_RTK_PUBLISH_H_ | ||
|
||
#include <stdint.h> | ||
#include <stddef.h> | ||
#include <zephyr/gnss/rtk/rtk.h> | ||
|
||
/* Internal function used by RTK clients to publish data-correction. */ | ||
void gnss_rtk_publish_data(const struct gnss_rtk_data *data); | ||
|
||
#endif /* ZEPHYR_INCLUDE_GNSS_RTK_PUBLISH_H_ */ |
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.
The cast to
const void *
may conflict with the expectedconst struct ubx_frame *
parameter ofubx_f9p_msg_send
. Use(const struct ubx_frame *)data->data
to avoid pointer-type mismatch warnings.Copilot uses AI. Check for mistakes.
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 don't think we should cast this to an UBX frame, as it's an RTCM3 msg. See commit:
modem: ubx: Change request buffer to be void