APM:Libraries
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
SITL::XPlane Class Reference

#include <SIM_XPlane.h>

Inheritance diagram for SITL::XPlane:
[legend]
Collaboration diagram for SITL::XPlane:
[legend]

Public Member Functions

 XPlane (const char *home_str, const char *frame_str)
 
void update (const struct sitl_input &input)
 
- Public Member Functions inherited from SITL::Aircraft
 Aircraft (const char *home_str, const char *frame_str)
 
void set_speedup (float speedup)
 
void set_instance (uint8_t _instance)
 
void set_autotest_dir (const char *_autotest_dir)
 
virtual void set_interface_ports (const char *address, const int port_in, const int port_out)
 
void fill_fdm (struct sitl_fdm &fdm)
 
void smooth_sensors (void)
 
float get_rate_hz (void) const
 
const Vector3fget_gyro (void) const
 
const Vector3fget_velocity_ef (void) const
 
const Vector3fget_velocity_air_ef (void) const
 
const Matrix3fget_dcm (void) const
 
const Vector3fget_mag_field_bf (void) const
 
virtual float gross_mass () const
 
const Locationget_location () const
 
const Vector3fget_position () const
 
void get_attitude (Quaternion &attitude) const
 

Static Public Member Functions

static Aircraftcreate (const char *home_str, const char *frame_str)
 
- Static Public Member Functions inherited from SITL::Aircraft
static double rand_normal (double mean, double stddev)
 
static bool parse_home (const char *home_str, Location &loc, float &yaw_degrees)
 

Private Types

enum  {
  FramRate = 0, Times = 1, SimStats = 2, Speed = 3,
  Gload = 4, AtmosphereWeather = 5, AtmosphereAircraft = 6, SystemPressures = 7,
  Joystick1 = 8, Joystick2 = 9, ArtStab = 10, FlightCon = 11,
  WingSweep = 12, Trim = 13, Brakes = 14, AngularMoments = 15,
  AngularVelocities = 16, PitchRollHeading = 17, AoA = 18, MagCompass = 19,
  LatLonAlt = 20, LocVelDistTraveled = 21, ThrottleCommand = 25, Mixture = 29,
  CarbHeat = 30, EngineRPM = 37, PropRPM = 38, PropPitch = 39,
  Generator = 58
}
 

Private Member Functions

bool receive_data (void)
 
void send_dref (const char *name, float value)
 
void send_data (const struct sitl_input &input)
 
void select_data (uint64_t usel_mask, uint64_t sel_mask)
 

Private Attributes

const char * xplane_ip = "127.0.0.1"
 
uint16_t xplane_port = 49000
 
uint16_t bind_port = 49001
 
SocketAPM socket_in {true}
 
SocketAPM socket_out {true}
 
uint64_t time_base_us
 
uint32_t last_data_time_ms
 
Vector3f position_zero
 
Vector3f accel_earth
 
float throttle_sent = -1
 
bool connected = false
 
uint32_t xplane_frame_time
 
struct {
   uint32_t   last_report_ms
 
   uint32_t   data_count
 
   uint32_t   frame_count
 
report
 
float last_flap
 
bool heli_frame
 
uint64_t unselected_mask
 
const float throttle_magic = 0.000123f
 
const float throttle_magic_scale = 1.0e6
 

Additional Inherited Members

- Protected Types inherited from SITL::Aircraft
enum  { GROUND_BEHAVIOR_NONE = 0, GROUND_BEHAVIOR_NO_MOVEMENT, GROUND_BEHAVIOR_FWD_ONLY, GROUND_BEHAVIOR_TAILSITTER }
 
- Protected Member Functions inherited from SITL::Aircraft
float ground_height_difference () const
 
virtual bool on_ground () const
 
float hagl () const
 
void update_position (void)
 
void update_mag_field_bf (void)
 
void time_advance ()
 
void setup_frame_time (float rate, float speedup)
 
void adjust_frame_time (float rate)
 
void sync_frame_time (void)
 
void add_noise (float throttle)
 
uint64_t get_wall_time_us (void) const
 
void update_dynamics (const Vector3f &rot_accel)
 
void update_wind (const struct sitl_input &input)
 
float filtered_idx (float v, uint8_t idx)
 
float filtered_servo_angle (const struct sitl_input &input, uint8_t idx)
 
float filtered_servo_range (const struct sitl_input &input, uint8_t idx)
 
void extrapolate_sensors (float delta_time)
 
- Protected Attributes inherited from SITL::Aircraft
SITLsitl
 
Location home
 
Location location
 
float ground_level
 
float home_yaw
 
float frame_height
 
Matrix3f dcm
 
Vector3f gyro
 
Vector3f gyro_prev
 
Vector3f ang_accel
 
Vector3f velocity_ef
 
Vector3f wind_ef
 
Vector3f velocity_air_ef
 
Vector3f velocity_air_bf
 
Vector3f position
 
float mass
 
Vector3f accel_body
 
float airspeed
 
float airspeed_pitot
 
float battery_voltage = -1.0f
 
float battery_current = 0.0f
 
float rpm1 = 0
 
float rpm2 = 0
 
uint8_t rcin_chan_count = 0
 
float rcin [8]
 
float range = -1.0f
 
float turbulence_azimuth = 0.0f
 
float turbulence_horizontal_speed = 0.0f
 
float turbulence_vertical_speed = 0.0f
 
Vector3f mag_bf
 
uint64_t time_now_us
 
const float gyro_noise
 
const float accel_noise
 
float rate_hz
 
float achieved_rate_hz
 
float target_speedup
 
uint64_t frame_time_us
 
float scaled_frame_time_us
 
uint64_t last_wall_time_us
 
uint8_t instance
 
const char * autotest_dir
 
const char * frame
 
bool use_time_sync = true
 
float last_speedup = -1.0f
 
AP_Int8 * ahrs_orientation
 
enum SITL::Aircraft:: { ... }  ground_behavior
 
bool use_smoothing
 
AP_Terrain * terrain
 
const float FEET_TO_METERS = 0.3048f
 
const float KNOTS_TO_METERS_PER_SECOND = 0.51444f
 

Detailed Description

Definition at line 30 of file SIM_XPlane.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
FramRate 
Times 
SimStats 
Speed 
Gload 
AtmosphereWeather 
AtmosphereAircraft 
SystemPressures 
Joystick1 
Joystick2 
ArtStab 
FlightCon 
WingSweep 
Trim 
Brakes 
AngularMoments 
AngularVelocities 
PitchRollHeading 
AoA 
MagCompass 
LatLonAlt 
LocVelDistTraveled 
ThrottleCommand 
Mixture 
CarbHeat 
EngineRPM 
PropRPM 
PropPitch 
Generator 

Definition at line 80 of file SIM_XPlane.h.

Constructor & Destructor Documentation

◆ XPlane()

SITL::XPlane::XPlane ( const char *  home_str,
const char *  frame_str 
)

Definition at line 35 of file SIM_XPlane.cpp.

Referenced by create().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ create()

static Aircraft* SITL::XPlane::create ( const char *  home_str,
const char *  frame_str 
)
inlinestatic

Definition at line 38 of file SIM_XPlane.h.

Here is the call graph for this function:

◆ receive_data()

bool SITL::XPlane::receive_data ( void  )
private

Definition at line 101 of file SIM_XPlane.cpp.

Referenced by create(), and update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ select_data()

void SITL::XPlane::select_data ( uint64_t  usel_mask,
uint64_t  sel_mask 
)
private

Definition at line 59 of file SIM_XPlane.cpp.

Referenced by create(), and receive_data().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_data()

void SITL::XPlane::send_data ( const struct sitl_input input)
private

Definition at line 357 of file SIM_XPlane.cpp.

Referenced by create(), and update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_dref()

void SITL::XPlane::send_dref ( const char *  name,
float  value 
)
private

Definition at line 446 of file SIM_XPlane.cpp.

Referenced by create(), and send_data().

Here is the caller graph for this function:

◆ update()

void SITL::XPlane::update ( const struct sitl_input input)
virtual

Implements SITL::Aircraft.

Definition at line 461 of file SIM_XPlane.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ accel_earth

Vector3f SITL::XPlane::accel_earth
private

Definition at line 58 of file SIM_XPlane.h.

Referenced by receive_data().

◆ bind_port

uint16_t SITL::XPlane::bind_port = 49001
private

Definition at line 50 of file SIM_XPlane.h.

Referenced by XPlane().

◆ connected

bool SITL::XPlane::connected = false
private

Definition at line 60 of file SIM_XPlane.h.

Referenced by receive_data().

◆ data_count

uint32_t SITL::XPlane::data_count

Definition at line 64 of file SIM_XPlane.h.

◆ frame_count

uint32_t SITL::XPlane::frame_count

Definition at line 65 of file SIM_XPlane.h.

◆ heli_frame

bool SITL::XPlane::heli_frame
private

Definition at line 70 of file SIM_XPlane.h.

Referenced by receive_data(), send_data(), and XPlane().

◆ last_data_time_ms

uint32_t SITL::XPlane::last_data_time_ms
private

Definition at line 56 of file SIM_XPlane.h.

Referenced by receive_data().

◆ last_flap

float SITL::XPlane::last_flap
private

Definition at line 67 of file SIM_XPlane.h.

Referenced by send_data().

◆ last_report_ms

uint32_t SITL::XPlane::last_report_ms

Definition at line 63 of file SIM_XPlane.h.

◆ position_zero

Vector3f SITL::XPlane::position_zero
private

Definition at line 57 of file SIM_XPlane.h.

Referenced by receive_data().

◆ report

struct { ... } SITL::XPlane::report

Referenced by receive_data(), and update().

◆ socket_in

SocketAPM SITL::XPlane::socket_in {true}
private

Definition at line 52 of file SIM_XPlane.h.

Referenced by receive_data(), and XPlane().

◆ socket_out

SocketAPM SITL::XPlane::socket_out {true}
private

Definition at line 53 of file SIM_XPlane.h.

Referenced by receive_data(), select_data(), send_data(), and send_dref().

◆ throttle_magic

const float SITL::XPlane::throttle_magic = 0.000123f
private

Definition at line 75 of file SIM_XPlane.h.

Referenced by receive_data(), and send_data().

◆ throttle_magic_scale

const float SITL::XPlane::throttle_magic_scale = 1.0e6
private

Definition at line 76 of file SIM_XPlane.h.

Referenced by receive_data().

◆ throttle_sent

float SITL::XPlane::throttle_sent = -1
private

Definition at line 59 of file SIM_XPlane.h.

Referenced by receive_data(), and send_data().

◆ time_base_us

uint64_t SITL::XPlane::time_base_us
private

Definition at line 55 of file SIM_XPlane.h.

Referenced by receive_data().

◆ unselected_mask

uint64_t SITL::XPlane::unselected_mask
private

Definition at line 72 of file SIM_XPlane.h.

Referenced by receive_data(), and select_data().

◆ xplane_frame_time

uint32_t SITL::XPlane::xplane_frame_time
private

Definition at line 61 of file SIM_XPlane.h.

Referenced by receive_data().

◆ xplane_ip

const char* SITL::XPlane::xplane_ip = "127.0.0.1"
private

Definition at line 48 of file SIM_XPlane.h.

Referenced by receive_data(), and XPlane().

◆ xplane_port

uint16_t SITL::XPlane::xplane_port = 49000
private

Definition at line 49 of file SIM_XPlane.h.

Referenced by receive_data(), and XPlane().


The documentation for this class was generated from the following files: