Track connection to manager and receive MANUAL_CONTROL

This commit is contained in:
Marek S. Łukasiewicz 2025-02-18 12:47:35 +01:00
parent 4ddccdaf62
commit c83135a67b
2 changed files with 129 additions and 7 deletions

View file

@ -33,8 +33,25 @@ public:
Error set_parameter(const String &id, float value);
// Get current parameter value
float get_parameter(const String &id);
// Get current state of the aircraft
Transform3D get_aircraft();
// Get normalized (-1 to 1) cyclic position, where X is right, Y is pitch up
Vector2 get_cyclic();
// Get normalized (0 to 1) collective position, positive to climb
float get_collective();
// Get normalized (-1 to 1) pedals position, positive turn right
float get_pedals();
// Is there a connection to MARSH Manager
bool get_manager_connected();
// Is receiving data from flight model
bool get_model_connected();
// Called by timer
void manager_timeout();
// // Called by timer
// void model_timeout();
// Convert from global coordinates to local position x=north, y=east
// taking into account current configuration.
@ -55,6 +72,10 @@ private:
void handle_local_position(mavlink_message_t message);
void handle_attitude(mavlink_message_t message);
void handle_param(mavlink_message_t message);
void handle_manual_control(mavlink_message_t message);
void handle_heartbeat(mavlink_message_t message);
Error send_message(mavlink_message_t message);
// Do not specify specific values, to ensure PARAM_COUNT is correct
// Not an enum class on purpose, to make use more convenient, it's scoped
@ -78,10 +99,14 @@ private:
// TODO: Interpolate with some delay
Vector3 last_location;
Quaternion last_rotation;
Vector4 last_controls;
double time_passed;
Timer *heartbeat_timer;
PacketPeerUDP *socket;
bool manager_connected;
Timer *manager_timer;
};
} // namespace godot