Skip to content

Commit

Permalink
EAHRS: Add network support
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Friedman <[email protected]>
  • Loading branch information
Ryanf55 committed May 12, 2024
1 parent 3b813b1 commit 4177d8b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libraries/AP_ExternalAHRS/AP_ExternalAHRS_GSOF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ AP_ExternalAHRS_GSOF::AP_ExternalAHRS_GSOF(AP_ExternalAHRS *_frontend,

void AP_ExternalAHRS_GSOF::update_thread(void)
{
auto& network = AP::network();
[[maybe_unused]] const char *dest_ip = param.remote_ip.get_str();
network.startup_wait();
if (!port_open) {
port_open = true;
uart->begin(baudrate);
Expand Down
9 changes: 9 additions & 0 deletions libraries/AP_ExternalAHRS/AP_ExternalAHRS_GSOF.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <AP_GPS/AP_GPS.h>
#include <AP_HAL/AP_HAL.h>
#include <AP_GSOF/AP_GSOF.h>
#include <AP_Networking/AP_Networking.h>

class AP_ExternalAHRS_GSOF: public AP_ExternalAHRS_backend, public AP_GSOF
{
Expand Down Expand Up @@ -78,6 +79,14 @@ class AP_ExternalAHRS_GSOF: public AP_ExternalAHRS_backend, public AP_GSOF
void post_gnss() const;
void post_filter() const;

struct {
// The GSOF EAHRS's IP address (unicast or multicast).
AP_Networking_IPV4 remote_ip{AP_EXTERNAL_AHRS_GSOF_IP};
// // The port for streamed data.
// AP_Int32 remote_data_port{0};
// // The port for configuration command/responses.
// AP_Int32 remote_cfg_port{0};
} param;
uint32_t baudrate;
int8_t port_num;
bool port_open = false;
Expand Down
8 changes: 8 additions & 0 deletions libraries/AP_ExternalAHRS/AP_ExternalAHRS_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,12 @@

#ifndef AP_EXTERNAL_AHRS_GSOF_ENABLED
#define AP_EXTERNAL_AHRS_GSOF_ENABLED AP_EXTERNAL_AHRS_BACKEND_DEFAULT_ENABLED
#ifndef AP_EXTERNAL_AHRS_GSOF_IP
#define AP_EXTERNAL_AHRS_GSOF_IP "239.255.10.10"
#endif
#ifndef AP_EXTERNAL_AHRS_GSOF_PORT
#define AP_EXTERNAL_AHRS_GSOF_PORT 44445
#endif
#endif


0 comments on commit 4177d8b

Please sign in to comment.