1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- #pragma once
- #include "SIM_Aircraft.h"
- #include <AP_HAL/utility/Socket.h>
- namespace SITL {
- class Gazebo : public Aircraft {
- public:
- Gazebo(const char *frame_str);
-
- void update(const struct sitl_input &input) override;
-
- static Aircraft *create(const char *frame_str) {
- return new Gazebo(frame_str);
- }
-
- void set_interface_ports(const char* address, const int port_in, const int port_out) override;
- private:
-
- struct servo_packet {
-
- float motor_speed[16];
- };
-
- struct fdm_packet {
- double timestamp;
- double imu_angular_velocity_rpy[3];
- double imu_linear_acceleration_xyz[3];
- double imu_orientation_quat[4];
- double velocity_xyz[3];
- double position_xyz[3];
- };
- void recv_fdm(const struct sitl_input &input);
- void send_servos(const struct sitl_input &input);
- void drain_sockets();
- double last_timestamp;
- SocketAPM socket_sitl;
- const char *_gazebo_address = "127.0.0.1";
- int _gazebo_port = 9002;
- static const uint64_t GAZEBO_TIMEOUT_US = 5000000;
- };
- }
|