2015-05-02 05:09:30 -03:00
|
|
|
/*
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
parent class for aircraft simulators
|
|
|
|
*/
|
|
|
|
|
2015-10-22 11:04:23 -03:00
|
|
|
#pragma once
|
2015-05-02 07:28:57 -03:00
|
|
|
|
2022-04-22 13:25:41 -03:00
|
|
|
#if AP_SIM_ENABLED
|
|
|
|
|
2015-08-11 03:28:46 -03:00
|
|
|
#include <AP_Math/AP_Math.h>
|
2015-05-02 05:09:30 -03:00
|
|
|
|
2015-10-22 10:58:33 -03:00
|
|
|
#include "SITL.h"
|
2018-07-31 09:33:23 -03:00
|
|
|
#include "SITL_Input.h"
|
|
|
|
#include "SIM_Sprayer.h"
|
|
|
|
#include "SIM_Gripper_Servo.h"
|
|
|
|
#include "SIM_Gripper_EPM.h"
|
2019-01-08 21:39:44 -04:00
|
|
|
#include "SIM_Parachute.h"
|
2018-08-03 07:52:20 -03:00
|
|
|
#include "SIM_Precland.h"
|
2019-09-28 08:32:57 -03:00
|
|
|
#include "SIM_RichenPower.h"
|
2022-01-06 21:36:48 -04:00
|
|
|
#include "SIM_Loweheiser.h"
|
2021-06-28 19:24:15 -03:00
|
|
|
#include "SIM_FETtecOneWireESC.h"
|
2020-08-03 00:24:27 -03:00
|
|
|
#include "SIM_I2C.h"
|
2019-10-07 04:30:22 -03:00
|
|
|
#include "SIM_Buzzer.h"
|
2020-10-24 17:38:02 -03:00
|
|
|
#include "SIM_Battery.h"
|
2019-06-26 23:37:34 -03:00
|
|
|
#include <Filter/Filter.h>
|
2021-04-24 21:33:58 -03:00
|
|
|
#include "SIM_JSON_Master.h"
|
2024-04-28 00:21:41 -03:00
|
|
|
#include "ServoModel.h"
|
2024-07-11 09:25:32 -03:00
|
|
|
#include "SIM_GPIO_LED_1.h"
|
2024-07-10 21:26:42 -03:00
|
|
|
#include "SIM_GPIO_LED_2.h"
|
|
|
|
#include "SIM_GPIO_LED_3.h"
|
|
|
|
#include "SIM_GPIO_LED_RGB.h"
|
2016-09-21 17:46:12 -03:00
|
|
|
|
2015-10-22 10:04:42 -03:00
|
|
|
namespace SITL {
|
|
|
|
|
2015-05-02 05:09:30 -03:00
|
|
|
/*
|
|
|
|
parent class for all simulator types
|
|
|
|
*/
|
2015-10-22 10:15:34 -03:00
|
|
|
class Aircraft {
|
2015-05-02 05:09:30 -03:00
|
|
|
public:
|
2019-08-15 01:01:24 -03:00
|
|
|
Aircraft(const char *frame_str);
|
|
|
|
|
|
|
|
// called directly after constructor:
|
2019-08-15 03:53:35 -03:00
|
|
|
virtual void set_start_location(const Location &start_loc, const float start_yaw);
|
2015-05-02 05:09:30 -03:00
|
|
|
|
2015-05-02 08:41:33 -03:00
|
|
|
/*
|
|
|
|
set simulation speedup
|
|
|
|
*/
|
|
|
|
void set_speedup(float speedup);
|
2021-02-01 12:37:57 -04:00
|
|
|
float get_speedup() const { return target_speedup; }
|
2015-05-02 08:41:33 -03:00
|
|
|
|
2015-05-10 08:01:49 -03:00
|
|
|
/*
|
|
|
|
set instance number
|
|
|
|
*/
|
|
|
|
void set_instance(uint8_t _instance) {
|
|
|
|
instance = _instance;
|
|
|
|
}
|
|
|
|
|
2015-05-25 00:04:46 -03:00
|
|
|
/*
|
|
|
|
set directory for additional files such as aircraft models
|
|
|
|
*/
|
|
|
|
void set_autotest_dir(const char *_autotest_dir) {
|
|
|
|
autotest_dir = _autotest_dir;
|
|
|
|
}
|
|
|
|
|
2016-12-16 12:18:04 -04:00
|
|
|
/* Create and set in/out socket for extenal simulator */
|
|
|
|
virtual void set_interface_ports(const char* address, const int port_in, const int port_out) {};
|
2016-09-21 17:46:12 -03:00
|
|
|
|
2015-05-02 05:09:30 -03:00
|
|
|
/*
|
|
|
|
step the FDM by one time step
|
|
|
|
*/
|
|
|
|
virtual void update(const struct sitl_input &input) = 0;
|
|
|
|
|
2019-08-15 03:53:35 -03:00
|
|
|
void update_model(const struct sitl_input &input);
|
|
|
|
|
2023-10-31 05:09:11 -03:00
|
|
|
void update_home();
|
|
|
|
|
2015-05-02 05:09:30 -03:00
|
|
|
/* fill a sitl_fdm structure from the simulator state */
|
2016-07-19 08:38:16 -03:00
|
|
|
void fill_fdm(struct sitl_fdm &fdm);
|
2015-05-02 05:09:30 -03:00
|
|
|
|
2016-07-19 08:38:16 -03:00
|
|
|
/* smooth sensors to provide kinematic consistancy */
|
|
|
|
void smooth_sensors(void);
|
2016-12-19 05:48:27 -04:00
|
|
|
|
2015-11-18 21:20:01 -04:00
|
|
|
/* return normal distribution random numbers */
|
|
|
|
static double rand_normal(double mean, double stddev);
|
|
|
|
|
2015-11-16 00:10:29 -04:00
|
|
|
// get frame rate of model in Hz
|
2016-12-19 05:48:27 -04:00
|
|
|
float get_rate_hz(void) const { return rate_hz; }
|
2015-12-31 23:15:06 -04:00
|
|
|
|
|
|
|
const Vector3f &get_gyro(void) const {
|
|
|
|
return gyro;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Vector3f &get_velocity_ef(void) const {
|
|
|
|
return velocity_ef;
|
|
|
|
}
|
|
|
|
|
2024-04-28 04:11:56 -03:00
|
|
|
// return TAS airspeed in earth frame
|
2016-04-19 22:48:37 -03:00
|
|
|
const Vector3f &get_velocity_air_ef(void) const {
|
|
|
|
return velocity_air_ef;
|
|
|
|
}
|
2016-12-19 05:48:27 -04:00
|
|
|
|
2015-12-31 23:15:06 -04:00
|
|
|
const Matrix3f &get_dcm(void) const {
|
|
|
|
return dcm;
|
|
|
|
}
|
2016-06-17 00:46:12 -03:00
|
|
|
|
|
|
|
const Vector3f &get_mag_field_bf(void) const {
|
|
|
|
return mag_bf;
|
|
|
|
}
|
2016-10-27 03:12:09 -03:00
|
|
|
|
2018-07-31 09:33:23 -03:00
|
|
|
float gross_mass() const { return mass + external_payload_mass; }
|
2016-10-27 03:12:09 -03:00
|
|
|
|
2019-07-18 14:36:52 -03:00
|
|
|
virtual void set_config(const char* config) {
|
|
|
|
config_ = config;
|
|
|
|
}
|
|
|
|
|
2023-10-31 05:09:11 -03:00
|
|
|
// return simulation origin:
|
|
|
|
const Location &get_origin() const { return origin; }
|
2019-07-18 14:36:52 -03:00
|
|
|
|
2017-08-01 04:10:23 -03:00
|
|
|
const Location &get_location() const { return location; }
|
|
|
|
|
2021-07-10 03:10:54 -03:00
|
|
|
// get position relative to home
|
|
|
|
Vector3d get_position_relhome() const;
|
2020-08-04 00:47:24 -03:00
|
|
|
|
2024-04-26 05:47:28 -03:00
|
|
|
// get air density in kg/m^3
|
|
|
|
float get_air_density(float alt_amsl) const;
|
|
|
|
|
2020-08-04 00:47:24 -03:00
|
|
|
// distance the rangefinder is perceiving
|
|
|
|
float rangefinder_range() const;
|
2018-03-07 21:25:44 -04:00
|
|
|
|
|
|
|
void get_attitude(Quaternion &attitude) const {
|
|
|
|
attitude.from_rotation_matrix(dcm);
|
|
|
|
}
|
|
|
|
|
2018-08-03 07:52:20 -03:00
|
|
|
const Location &get_home() const { return home; }
|
|
|
|
float get_home_yaw() const { return home_yaw; }
|
|
|
|
|
2019-10-07 04:30:22 -03:00
|
|
|
void set_buzzer(Buzzer *_buzzer) { buzzer = _buzzer; }
|
2018-07-31 09:33:23 -03:00
|
|
|
void set_sprayer(Sprayer *_sprayer) { sprayer = _sprayer; }
|
2019-01-08 21:39:44 -04:00
|
|
|
void set_parachute(Parachute *_parachute) { parachute = _parachute; }
|
2019-09-28 08:32:57 -03:00
|
|
|
void set_richenpower(RichenPower *_richenpower) { richenpower = _richenpower; }
|
2023-10-20 01:56:40 -03:00
|
|
|
void set_adsb(class ADSB *_adsb) { adsb = _adsb; }
|
2022-01-06 21:36:48 -04:00
|
|
|
#if AP_SIM_LOWEHEISER_ENABLED
|
|
|
|
void set_loweheiser(Loweheiser *_loweheiser) { loweheiser = _loweheiser; }
|
|
|
|
#endif
|
2021-06-28 19:24:15 -03:00
|
|
|
void set_fetteconewireesc(FETtecOneWireESC *_fetteconewireesc) { fetteconewireesc = _fetteconewireesc; }
|
2020-09-22 22:03:38 -03:00
|
|
|
void set_ie24(IntelligentEnergy24 *_ie24) { ie24 = _ie24; }
|
2018-07-31 09:33:23 -03:00
|
|
|
void set_gripper_servo(Gripper_Servo *_gripper) { gripper = _gripper; }
|
|
|
|
void set_gripper_epm(Gripper_EPM *_gripper_epm) { gripper_epm = _gripper_epm; }
|
2018-08-03 07:52:20 -03:00
|
|
|
void set_precland(SIM_Precland *_precland);
|
2020-08-03 00:24:27 -03:00
|
|
|
void set_i2c(class I2C *_i2c) { i2c = _i2c; }
|
2023-01-22 03:35:53 -04:00
|
|
|
#if AP_TEST_DRONECAN_DRIVERS
|
|
|
|
void set_dronecan_device(DroneCANDevice *_dronecan) { dronecan = _dronecan; }
|
|
|
|
#endif
|
2021-06-08 02:24:39 -03:00
|
|
|
float get_battery_voltage() const { return battery_voltage; }
|
2023-09-03 22:59:43 -03:00
|
|
|
float get_battery_temperature() const { return battery.get_temperature(); }
|
2021-06-08 02:24:39 -03:00
|
|
|
|
2023-10-20 01:56:40 -03:00
|
|
|
ADSB *adsb;
|
|
|
|
|
2015-05-02 05:09:30 -03:00
|
|
|
protected:
|
2021-07-30 07:17:35 -03:00
|
|
|
SIM *sitl;
|
2021-07-10 03:10:54 -03:00
|
|
|
// origin of position vector
|
|
|
|
Location origin;
|
|
|
|
// home location
|
2015-05-02 05:09:30 -03:00
|
|
|
Location home;
|
2019-08-15 03:53:35 -03:00
|
|
|
bool home_is_set;
|
2015-05-02 05:09:30 -03:00
|
|
|
Location location;
|
|
|
|
|
|
|
|
float ground_level;
|
2015-11-23 18:14:47 -04:00
|
|
|
float home_yaw;
|
2015-05-02 05:09:30 -03:00
|
|
|
float frame_height;
|
2018-07-31 09:33:23 -03:00
|
|
|
Matrix3f dcm; // rotation matrix, APM conventions, from body to earth
|
|
|
|
Vector3f gyro; // rad/s
|
|
|
|
Vector3f velocity_ef; // m/s, earth frame
|
|
|
|
Vector3f wind_ef; // m/s, earth frame
|
2024-04-28 04:11:56 -03:00
|
|
|
Vector3f velocity_air_ef; // velocity relative to airmass, earth frame (true airspeed)
|
2018-07-31 09:33:23 -03:00
|
|
|
Vector3f velocity_air_bf; // velocity relative to airmass, body frame
|
2021-06-20 23:59:02 -03:00
|
|
|
Vector3d position; // meters, NED from origin
|
2018-07-31 09:33:23 -03:00
|
|
|
float mass; // kg
|
2020-09-22 19:44:18 -03:00
|
|
|
float external_payload_mass; // kg
|
|
|
|
Vector3f accel_body{0.0f, 0.0f, -GRAVITY_MSS}; // m/s/s NED, body frame
|
2024-04-28 04:11:56 -03:00
|
|
|
float airspeed; // m/s, EAS airspeed
|
|
|
|
float airspeed_pitot; // m/s, EAS airspeed, as seen by fwd pitot tube
|
|
|
|
float battery_voltage;
|
2020-09-22 19:44:18 -03:00
|
|
|
float battery_current;
|
2021-02-08 08:13:19 -04:00
|
|
|
float local_ground_level; // ground level at local position
|
2021-05-17 21:25:12 -03:00
|
|
|
bool lock_step_scheduled;
|
2021-07-10 03:10:54 -03:00
|
|
|
uint32_t last_one_hz_ms;
|
2020-10-24 17:38:02 -03:00
|
|
|
|
|
|
|
// battery model
|
|
|
|
Battery battery;
|
|
|
|
|
2022-08-18 04:18:32 -03:00
|
|
|
uint32_t motor_mask;
|
|
|
|
float rpm[32];
|
2020-09-22 19:44:18 -03:00
|
|
|
uint8_t rcin_chan_count;
|
2020-07-25 13:04:49 -03:00
|
|
|
float rcin[12];
|
2021-12-11 00:18:13 -04:00
|
|
|
|
|
|
|
virtual float rangefinder_beam_width() const { return 0; }
|
|
|
|
virtual float perpendicular_distance_to_rangefinder_surface() const;
|
2015-05-02 05:09:30 -03:00
|
|
|
|
2018-12-04 01:53:15 -04:00
|
|
|
struct {
|
|
|
|
// data from simulated laser scanner, if available
|
|
|
|
struct vector3f_array points;
|
|
|
|
struct float_array ranges;
|
|
|
|
} scanner;
|
2020-07-17 20:37:34 -03:00
|
|
|
|
|
|
|
// Rangefinder
|
2022-10-02 05:21:54 -03:00
|
|
|
float rangefinder_m[SITL_NUM_RANGEFINDERS];
|
2020-07-17 20:37:34 -03:00
|
|
|
|
2020-08-15 12:35:50 -03:00
|
|
|
// Windvane apparent wind
|
|
|
|
struct {
|
|
|
|
float speed;
|
|
|
|
float direction;
|
|
|
|
} wind_vane_apparent;
|
|
|
|
|
2016-12-19 05:48:27 -04:00
|
|
|
// Wind Turbulence simulated Data
|
2020-09-22 19:44:18 -03:00
|
|
|
float turbulence_azimuth;
|
|
|
|
float turbulence_horizontal_speed; // m/s
|
|
|
|
float turbulence_vertical_speed; // m/s
|
2016-11-13 20:41:06 -04:00
|
|
|
|
2016-12-19 05:48:27 -04:00
|
|
|
Vector3f mag_bf; // local earth magnetic field vector in Gauss, earth frame
|
2016-06-17 00:46:12 -03:00
|
|
|
|
2015-05-02 05:09:30 -03:00
|
|
|
uint64_t time_now_us;
|
|
|
|
|
2020-09-22 19:44:18 -03:00
|
|
|
const float gyro_noise = radians(0.1f);
|
|
|
|
const float accel_noise = 0.3f;
|
|
|
|
float rate_hz = 1200.0f;
|
2015-05-02 05:09:30 -03:00
|
|
|
float target_speedup;
|
2015-05-02 09:13:02 -03:00
|
|
|
uint64_t frame_time_us;
|
2015-05-02 05:09:30 -03:00
|
|
|
uint64_t last_wall_time_us;
|
2020-06-04 05:07:26 -03:00
|
|
|
uint32_t last_fps_report_ms;
|
2023-09-20 22:23:11 -03:00
|
|
|
float achieved_rate_hz; // achieved speedup rate
|
2020-06-04 06:00:40 -03:00
|
|
|
int64_t sleep_debt_us;
|
|
|
|
uint32_t last_frame_count;
|
2015-05-10 08:01:49 -03:00
|
|
|
uint8_t instance;
|
2015-05-25 00:04:46 -03:00
|
|
|
const char *autotest_dir;
|
2015-06-01 20:08:55 -03:00
|
|
|
const char *frame;
|
2015-11-19 02:11:13 -04:00
|
|
|
bool use_time_sync = true;
|
2017-03-01 11:29:53 -04:00
|
|
|
float last_speedup = -1.0f;
|
2019-07-18 14:36:52 -03:00
|
|
|
const char *config_ = "";
|
2024-04-28 00:21:41 -03:00
|
|
|
float eas2tas = 1.0;
|
|
|
|
float air_density = SSL_AIR_DENSITY;
|
2015-05-02 05:09:30 -03:00
|
|
|
|
2017-11-22 23:26:01 -04:00
|
|
|
// allow for AHRS_ORIENTATION
|
|
|
|
AP_Int8 *ahrs_orientation;
|
2019-12-11 20:11:03 -04:00
|
|
|
enum Rotation last_imu_rotation;
|
2020-01-13 13:47:52 -04:00
|
|
|
AP_Float* custom_roll;
|
|
|
|
AP_Float* custom_pitch;
|
|
|
|
AP_Float* custom_yaw;
|
2018-07-31 09:33:23 -03:00
|
|
|
|
2019-04-10 22:55:04 -03:00
|
|
|
enum GroundBehaviour {
|
2016-12-19 05:48:27 -04:00
|
|
|
GROUND_BEHAVIOR_NONE = 0,
|
2016-07-19 01:42:31 -03:00
|
|
|
GROUND_BEHAVIOR_NO_MOVEMENT,
|
|
|
|
GROUND_BEHAVIOR_FWD_ONLY,
|
2017-02-11 07:30:42 -04:00
|
|
|
GROUND_BEHAVIOR_TAILSITTER,
|
2016-07-19 01:42:31 -03:00
|
|
|
} ground_behavior;
|
2016-07-19 08:38:16 -03:00
|
|
|
|
|
|
|
bool use_smoothing;
|
2024-04-28 00:21:41 -03:00
|
|
|
bool disable_origin_movement;
|
2016-12-19 05:48:27 -04:00
|
|
|
|
2016-11-22 20:09:33 -04:00
|
|
|
float ground_height_difference() const;
|
2016-07-19 01:42:31 -03:00
|
|
|
|
2017-03-06 13:52:47 -04:00
|
|
|
virtual bool on_ground() const;
|
2015-05-02 05:09:30 -03:00
|
|
|
|
2016-11-22 20:19:02 -04:00
|
|
|
// returns height above ground level in metres
|
2016-12-19 05:48:27 -04:00
|
|
|
float hagl() const; // metres
|
2016-11-22 20:19:02 -04:00
|
|
|
|
2015-05-02 05:09:30 -03:00
|
|
|
/* update location from position */
|
|
|
|
void update_position(void);
|
|
|
|
|
2016-06-17 00:46:12 -03:00
|
|
|
/* update body frame magnetic field */
|
|
|
|
void update_mag_field_bf(void);
|
|
|
|
|
2015-05-02 05:09:30 -03:00
|
|
|
/* advance time by deltat in seconds */
|
2017-03-03 06:23:40 -04:00
|
|
|
void time_advance();
|
2015-05-02 05:09:30 -03:00
|
|
|
|
|
|
|
/* setup the frame step time */
|
|
|
|
void setup_frame_time(float rate, float speedup);
|
|
|
|
|
|
|
|
/* adjust frame_time calculation */
|
|
|
|
void adjust_frame_time(float rate);
|
|
|
|
|
|
|
|
/* try to synchronise simulation time with wall clock time, taking
|
|
|
|
into account desired speedup */
|
|
|
|
void sync_frame_time(void);
|
|
|
|
|
|
|
|
/* add noise based on throttle level (from 0..1) */
|
|
|
|
void add_noise(float throttle);
|
|
|
|
|
2020-02-18 09:42:25 -04:00
|
|
|
/* return a monotonic wall clock time in microseconds */
|
2015-05-02 05:09:30 -03:00
|
|
|
uint64_t get_wall_time_us(void) const;
|
|
|
|
|
2016-01-01 00:11:55 -04:00
|
|
|
// update attitude and relative position
|
|
|
|
void update_dynamics(const Vector3f &rot_accel);
|
|
|
|
|
2016-04-19 22:48:37 -03:00
|
|
|
// update wind vector
|
|
|
|
void update_wind(const struct sitl_input &input);
|
2016-06-17 02:25:23 -03:00
|
|
|
|
2016-10-25 05:54:56 -03:00
|
|
|
// return filtered servo input as -1 to 1 range
|
|
|
|
float filtered_servo_angle(const struct sitl_input &input, uint8_t idx);
|
|
|
|
float filtered_servo_range(const struct sitl_input &input, uint8_t idx);
|
2024-04-28 00:21:41 -03:00
|
|
|
void filtered_servo_setup(uint8_t idx, uint16_t pwm_min, uint16_t pwm_max, float deflection_deg);
|
2016-12-19 05:48:27 -04:00
|
|
|
|
2017-10-20 21:57:59 -03:00
|
|
|
// extrapolate sensors by a given delta time in seconds
|
|
|
|
void extrapolate_sensors(float delta_time);
|
2018-07-31 09:33:23 -03:00
|
|
|
|
|
|
|
// update external payload/sensor dynamic
|
|
|
|
void update_external_payload(const struct sitl_input &input);
|
|
|
|
|
2017-11-27 06:45:23 -04:00
|
|
|
void add_shove_forces(Vector3f &rot_accel, Vector3f &body_accel);
|
2019-04-10 22:55:04 -03:00
|
|
|
void add_twist_forces(Vector3f &rot_accel);
|
2017-11-27 06:45:23 -04:00
|
|
|
|
2024-07-12 03:18:16 -03:00
|
|
|
#if AP_SIM_SLUNGPAYLOAD_ENABLED
|
|
|
|
// add body-frame force due to slung payload
|
|
|
|
void add_slungpayload_forces(Vector3f &body_accel);
|
|
|
|
#endif
|
|
|
|
|
2019-05-26 06:56:10 -03:00
|
|
|
// get local thermal updraft
|
2021-06-20 23:59:02 -03:00
|
|
|
float get_local_updraft(const Vector3d ¤tPos);
|
2019-05-26 06:56:10 -03:00
|
|
|
|
2024-04-28 04:11:56 -03:00
|
|
|
// update EAS speeds
|
|
|
|
void update_eas_airspeed();
|
|
|
|
|
2024-06-07 00:43:50 -03:00
|
|
|
// clamp support
|
|
|
|
class Clamp {
|
|
|
|
public:
|
|
|
|
bool clamped(class Aircraft&, const struct sitl_input &input); // true if the vehicle is currently clamped down
|
|
|
|
private:
|
|
|
|
bool currently_clamped;
|
|
|
|
bool grab_attempted; // avoid warning multiple times about missed grab
|
|
|
|
} clamp;
|
|
|
|
|
2015-05-05 08:28:38 -03:00
|
|
|
private:
|
2020-09-22 19:44:18 -03:00
|
|
|
uint64_t last_time_us;
|
|
|
|
uint32_t frame_counter;
|
2016-01-04 16:20:05 -04:00
|
|
|
uint32_t last_ground_contact_ms;
|
2020-09-22 19:44:18 -03:00
|
|
|
#if defined(__CYGWIN__) || defined(__CYGWIN64__)
|
|
|
|
const uint32_t min_sleep_time{20000};
|
|
|
|
#else
|
|
|
|
const uint32_t min_sleep_time{5000};
|
|
|
|
#endif
|
2016-06-17 02:25:23 -03:00
|
|
|
|
2016-07-19 08:38:16 -03:00
|
|
|
struct {
|
|
|
|
Vector3f accel_body;
|
|
|
|
Vector3f gyro;
|
|
|
|
Matrix3f rotation_b2e;
|
2021-06-20 23:59:02 -03:00
|
|
|
Vector3d position;
|
2016-07-19 08:38:16 -03:00
|
|
|
Vector3f velocity_ef;
|
|
|
|
uint64_t last_update_us;
|
|
|
|
Location location;
|
|
|
|
} smoothing;
|
2016-10-25 05:54:56 -03:00
|
|
|
|
2024-04-28 00:21:41 -03:00
|
|
|
ServoModel servo_filter[16];
|
2018-07-31 09:33:23 -03:00
|
|
|
|
2019-10-07 04:30:22 -03:00
|
|
|
Buzzer *buzzer;
|
2018-07-31 09:33:23 -03:00
|
|
|
Sprayer *sprayer;
|
|
|
|
Gripper_Servo *gripper;
|
|
|
|
Gripper_EPM *gripper_epm;
|
2019-01-08 21:39:44 -04:00
|
|
|
Parachute *parachute;
|
2019-09-28 08:32:57 -03:00
|
|
|
RichenPower *richenpower;
|
2022-01-06 21:36:48 -04:00
|
|
|
#if AP_SIM_LOWEHEISER_ENABLED
|
|
|
|
Loweheiser *loweheiser;
|
|
|
|
#endif
|
2021-06-28 19:24:15 -03:00
|
|
|
FETtecOneWireESC *fetteconewireesc;
|
|
|
|
|
2020-09-22 22:03:38 -03:00
|
|
|
IntelligentEnergy24 *ie24;
|
2018-08-03 07:52:20 -03:00
|
|
|
SIM_Precland *precland;
|
2020-08-03 00:24:27 -03:00
|
|
|
class I2C *i2c;
|
2023-01-22 03:35:53 -04:00
|
|
|
#if AP_TEST_DRONECAN_DRIVERS
|
|
|
|
DroneCANDevice *dronecan;
|
|
|
|
#endif
|
2024-07-10 21:26:42 -03:00
|
|
|
|
|
|
|
|
2024-07-11 09:25:32 -03:00
|
|
|
#if AP_SIM_GPIO_LED_1_ENABLED
|
|
|
|
GPIO_LED_1 sim_led1{8}; // pin to match sitl.h
|
|
|
|
#endif
|
2024-07-10 21:26:42 -03:00
|
|
|
#if AP_SIM_GPIO_LED_2_ENABLED
|
|
|
|
GPIO_LED_2 sim_led2{13, 14}; // pins to match sitl.h
|
|
|
|
#endif
|
|
|
|
#if AP_SIM_GPIO_LED_3_ENABLED
|
|
|
|
GPIO_LED_3 sim_led3{13, 14, 15}; // pins to match sitl.h
|
|
|
|
#endif
|
|
|
|
#if AP_SIM_GPIO_LED_RGB_ENABLED
|
|
|
|
GPIO_LED_RGB sim_ledrgb{8, 9, 10}; // pins to match sitl.h
|
|
|
|
#endif
|
|
|
|
|
2015-05-02 05:09:30 -03:00
|
|
|
};
|
2015-05-02 07:28:57 -03:00
|
|
|
|
2015-10-22 10:04:42 -03:00
|
|
|
} // namespace SITL
|
2022-04-22 13:25:41 -03:00
|
|
|
|
|
|
|
#endif // AP_SIM_ENABLED
|