123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- #pragma once
- #include <AP_HAL/utility/Socket.h>
- #include "SIM_Aircraft.h"
- namespace SITL {
- class SilentWings : public Aircraft {
- public:
- SilentWings(const char *frame_str);
-
- void update(const struct sitl_input &input) override;
-
- static Aircraft *create(const char *frame_str) {
- return new SilentWings(frame_str);
- }
- private:
-
- struct PACKED fdm_packet {
- unsigned int timestamp;
- double position_latitude;
- double position_longitude;
- float altitude_msl;
- float altitude_ground;
- float altitude_ground_45;
- float altitude_ground_forward;
- float roll;
- float pitch;
- float yaw;
- float d_roll;
- float d_pitch;
- float d_yaw;
- float vx;
- float vy;
- float vz;
- float vx_wind;
- float vy_wind;
- float vz_wind;
- float v_eas;
- float ax;
- float ay;
- float az;
- float angle_of_attack;
- float angle_sideslip;
- float vario;
- float heading;
- float rate_of_turn;
- float airpressure;
- float density;
- float temperature;
- } pkt;
-
- struct {
- uint32_t last_report_ms;
- uint32_t data_count;
- uint32_t frame_count;
- } report;
- bool recv_fdm(void);
- void process_packet();
- bool interim_update();
-
-
- void set_interface_ports(const char* address, const int port_in, const int port_out) override;
-
-
- void send_servos(const struct sitl_input &input);
-
- uint32_t last_data_time_ms;
-
-
- uint32_t first_pkt_timestamp_ms;
-
-
- bool inited_first_pkt_timestamp;
-
-
- uint64_t time_base_us;
-
- SocketAPM sock;
- const char *_sw_address = "127.0.0.1";
- int _port_in = 6060;
- int _sw_port = 6070;
- bool home_initialized;
- };
- }
|