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

#include <SIM_JSBSim.h>

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

Public Member Functions

 JSBSim (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  { FRAME_NORMAL, FRAME_ELEVON, FRAME_VTAIL }
 

Private Member Functions

bool create_templates (void)
 
bool start_JSBSim (void)
 
bool open_control_socket (void)
 
bool open_fdm_socket (void)
 
void send_servos (const struct sitl_input &input)
 
void recv_fdm (const struct sitl_input &input)
 
void check_stdout (void)
 
bool expect (const char *str)
 
void drain_control_socket ()
 

Private Attributes

SocketAPM sock_control
 
SocketAPM sock_fgfdm
 
bool initialised
 
uint16_t control_port
 
uint16_t fdm_port
 
char * jsbsim_script
 
char * jsbsim_fgout
 
int jsbsim_stdout
 
const char * jsbsim_model = "Rascal"
 
bool created_templates
 
bool started_jsbsim
 
bool opened_control_socket
 
bool opened_fdm_socket
 
enum SITL::JSBSim:: { ... }  frame
 

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_JSBSim.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
FRAME_NORMAL 
FRAME_ELEVON 
FRAME_VTAIL 

Definition at line 65 of file SIM_JSBSim.h.

Constructor & Destructor Documentation

◆ JSBSim()

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

Definition at line 39 of file SIM_JSBSim.cpp.

Referenced by create().

Here is the caller graph for this function:

Member Function Documentation

◆ check_stdout()

void SITL::JSBSim::check_stdout ( void  )
private

Definition at line 242 of file SIM_JSBSim.cpp.

Referenced by open_fdm_socket(), recv_fdm(), and start_JSBSim().

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

◆ create()

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

Definition at line 38 of file SIM_JSBSim.h.

Here is the call graph for this function:

◆ create_templates()

bool SITL::JSBSim::create_templates ( void  )
private

Definition at line 68 of file SIM_JSBSim.cpp.

Referenced by update().

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

◆ drain_control_socket()

void SITL::JSBSim::drain_control_socket ( )
private

Definition at line 435 of file SIM_JSBSim.cpp.

Referenced by update().

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

◆ expect()

bool SITL::JSBSim::expect ( const char *  str)
private

Definition at line 256 of file SIM_JSBSim.cpp.

Referenced by start_JSBSim().

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

◆ open_control_socket()

bool SITL::JSBSim::open_control_socket ( void  )
private

Definition at line 279 of file SIM_JSBSim.cpp.

Referenced by start_JSBSim(), and update().

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

◆ open_fdm_socket()

bool SITL::JSBSim::open_fdm_socket ( void  )
private

Definition at line 303 of file SIM_JSBSim.cpp.

Referenced by start_JSBSim(), and update().

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

◆ recv_fdm()

void SITL::JSBSim::recv_fdm ( const struct sitl_input input)
private

Definition at line 399 of file SIM_JSBSim.cpp.

Referenced by update().

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

◆ send_servos()

void SITL::JSBSim::send_servos ( const struct sitl_input input)
private

Definition at line 322 of file SIM_JSBSim.cpp.

Referenced by recv_fdm(), and update().

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

◆ start_JSBSim()

bool SITL::JSBSim::start_JSBSim ( void  )
private

Definition at line 166 of file SIM_JSBSim.cpp.

Referenced by update().

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

◆ update()

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

Implements SITL::Aircraft.

Definition at line 455 of file SIM_JSBSim.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ control_port

uint16_t SITL::JSBSim::control_port
private

Definition at line 51 of file SIM_JSBSim.h.

Referenced by create_templates(), and open_control_socket().

◆ created_templates

bool SITL::JSBSim::created_templates
private

Definition at line 60 of file SIM_JSBSim.h.

Referenced by create_templates().

◆ fdm_port

uint16_t SITL::JSBSim::fdm_port
private

Definition at line 52 of file SIM_JSBSim.h.

Referenced by create_templates(), and open_fdm_socket().

◆ frame

enum { ... } SITL::JSBSim::frame

Referenced by JSBSim(), and send_servos().

◆ initialised

bool SITL::JSBSim::initialised
private

Definition at line 49 of file SIM_JSBSim.h.

Referenced by update().

◆ jsbsim_fgout

char* SITL::JSBSim::jsbsim_fgout
private

Definition at line 54 of file SIM_JSBSim.h.

Referenced by create_templates(), and start_JSBSim().

◆ jsbsim_model

const char* SITL::JSBSim::jsbsim_model = "Rascal"
private

Definition at line 58 of file SIM_JSBSim.h.

Referenced by create_templates(), and JSBSim().

◆ jsbsim_script

char* SITL::JSBSim::jsbsim_script
private

Definition at line 53 of file SIM_JSBSim.h.

Referenced by create_templates(), and start_JSBSim().

◆ jsbsim_stdout

int SITL::JSBSim::jsbsim_stdout
private

Definition at line 55 of file SIM_JSBSim.h.

Referenced by check_stdout(), expect(), and start_JSBSim().

◆ opened_control_socket

bool SITL::JSBSim::opened_control_socket
private

Definition at line 62 of file SIM_JSBSim.h.

Referenced by open_control_socket().

◆ opened_fdm_socket

bool SITL::JSBSim::opened_fdm_socket
private

Definition at line 63 of file SIM_JSBSim.h.

Referenced by open_fdm_socket().

◆ sock_control

SocketAPM SITL::JSBSim::sock_control
private

Definition at line 44 of file SIM_JSBSim.h.

Referenced by drain_control_socket(), open_control_socket(), and send_servos().

◆ sock_fgfdm

SocketAPM SITL::JSBSim::sock_fgfdm
private

Definition at line 47 of file SIM_JSBSim.h.

Referenced by open_fdm_socket(), and recv_fdm().

◆ started_jsbsim

bool SITL::JSBSim::started_jsbsim
private

Definition at line 61 of file SIM_JSBSim.h.

Referenced by start_JSBSim().


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