FlightGear next
FGJSBsim Class Reference

FGFS / JSBSim interface (aka "The Bus"). More...

#include <JSBSim.hxx>

Inherits FGInterface.

Public Member Functions

 FGJSBsim (double dt)
 Constructor.
 
 ~FGJSBsim ()
 Destructor.
 
void init () override
 
void resume () override
 
void suspend () override
 
void unbind () override
 
void update (double dt) override
 
bool copy_to_JSBsim ()
 copy FDM state to LaRCsim structures
 
bool copy_from_JSBsim ()
 copy FDM state from LaRCsim structures
 
Position Parameter Set
void set_Latitude (double lat)
 Set geocentric latitude.
 
void set_Longitude (double lon)
 Set longitude.
 
void set_Altitude (double alt)
 Set altitude Note: this triggers a recalculation of AGL altitude.
 
Velocity Parameter Set
void set_V_calibrated_kts (double vc)
 Sets calibrated airspeed Setting this will trigger a recalc of the other velocity terms.
 
void set_Mach_number (double mach)
 Sets Mach number.
 
void set_Velocities_Local (double north, double east, double down)
 Sets velocity in N-E-D coordinates.
 
void set_Velocities_Body (double u, double v, double w)
 Sets aircraft velocity in stability frame.
 
void set_Euler_Angles (double phi, double theta, double psi)
 Euler Angle Parameter Set.
 
Flight Path Parameter Set
void set_Climb_Rate (double roc)
 Sets rate of climb.
 
void set_Gamma_vert_rad (double gamma)
 Sets the flight path angle in radians.
 
- Public Member Functions inherited from FGInterface
 FGInterface ()
 
 FGInterface (double dt)
 
virtual ~FGInterface ()
 
void bind () override
 Bind getters and setters to properties.
 
void init () override
 
void unbind () override
 Unbind any properties bound to this FDM.
 
void update (double dt) override
 Update the state of the FDM (i.e.
 
bool readState (SGIOChannel *io)
 
bool writeState (SGIOChannel *io)
 
bool get_inited () const
 
void set_inited (bool value)
 
bool get_bound () const
 
void common_init ()
 Initialize the state of the FDM.
 
virtual void property_associations (std::function< void(const std::string &from, const std::string &to)> fn)
 
virtual void set_AltitudeAGL (double altagl)
 
virtual void set_Latitude_deg (double lat)
 
virtual void set_Longitude_deg (double lon)
 
void set_V_north (double north)
 
void set_V_east (double east)
 
void set_V_down (double down)
 
virtual void set_uBody (double uBody)
 
virtual void set_vBody (double vBody)
 
virtual void set_wBody (double wBody)
 
virtual void set_Phi (double phi)
 
virtual void set_Theta (double theta)
 
virtual void set_Psi (double psi)
 
virtual void set_Phi_deg (double phi)
 
virtual void set_Theta_deg (double theta)
 
virtual void set_Psi_deg (double psi)
 
virtual void set_Static_pressure (double p)
 
virtual void set_Static_temperature (double T)
 
virtual void set_Density (double rho)
 
virtual void set_Velocities_Local_Airmass (double wnorth, double weast, double wdown)
 
double get_Dx_cg () const
 
double get_Dy_cg () const
 
double get_Dz_cg () const
 
double get_V_dot_north () const
 
double get_V_dot_east () const
 
double get_V_dot_down () const
 
double get_U_dot_body () const
 
double get_V_dot_body () const
 
double get_W_dot_body () const
 
double get_A_X_cg () const
 
double get_A_Y_cg () const
 
double get_A_Z_cg () const
 
double get_A_X_pilot () const
 
double get_A_Y_pilot () const
 
double get_A_Z_pilot () const
 
double get_N_X_cg () const
 
double get_N_Y_cg () const
 
double get_N_Z_cg () const
 
double get_Nlf (void) const
 
double get_V_north () const
 
double get_V_east () const
 
double get_V_down () const
 
double get_uBody () const
 
double get_vBody () const
 
double get_wBody () const
 
double get_V_north_rel_ground () const
 
double get_V_east_rel_ground () const
 
double get_V_down_rel_ground () const
 
double get_V_north_airmass () const
 
double get_V_east_airmass () const
 
double get_V_down_airmass () const
 
double get_U_body () const
 
double get_V_body () const
 
double get_W_body () const
 
double get_V_rel_wind () const
 
double get_V_true_kts () const
 
double get_V_ground_speed () const
 
double get_V_ground_speed_kt () const
 
void set_V_ground_speed_kt (double ground_speed)
 
double get_V_equiv_kts () const
 
double get_V_calibrated_kts () const
 
double get_P_body () const
 
double get_Q_body () const
 
double get_R_body () const
 
double get_Phi_dot () const
 
double get_Theta_dot () const
 
double get_Psi_dot () const
 
double get_Phi_dot_degps () const
 
double get_Theta_dot_degps () const
 
double get_Psi_dot_degps () const
 
double get_Latitude_dot () const
 
double get_Longitude_dot () const
 
double get_Radius_dot () const
 
double get_Lat_geocentric () const
 
double get_Lon_geocentric () const
 
double get_Radius_to_vehicle () const
 
const SGGeod & getPosition () const
 
const SGGeoc & getGeocPosition () const
 
const SGVec3d & getCartPosition () const
 
double get_Latitude () const
 
double get_Longitude () const
 
double get_Altitude () const
 
double get_Altitude_AGL (void) const
 
double get_Track (void) const
 
double get_Path (void) const
 
double get_Latitude_deg () const
 
double get_Longitude_deg () const
 
double get_Phi () const
 
double get_Theta () const
 
double get_Psi () const
 
double get_Phi_deg () const
 
double get_Theta_deg () const
 
double get_Psi_deg () const
 
double get_Alpha () const
 
double get_Alpha_deg () const
 
double get_Beta () const
 
double get_Beta_deg () const
 
double get_Gamma_vert_rad () const
 
double get_Density () const
 
double get_Mach_number () const
 
double get_Static_pressure () const
 
double get_Total_pressure () const
 
double get_Dynamic_pressure () const
 
double get_Static_temperature () const
 
double get_Total_temperature () const
 
double get_Sea_level_radius () const
 
double get_Earth_position_angle () const
 
double get_Runway_altitude () const
 
double get_Runway_altitude_m () const
 
double get_Climb_Rate () const
 
double get_ground_elev_ft () const
 
bool prepare_ground_cache_m (double startSimTime, double endSimTime, const double pt[3], double rad)
 
bool prepare_ground_cache_ft (double startSimTime, double endSimTime, const double pt[3], double rad)
 
bool is_valid_m (double *ref_time, double pt[3], double *rad)
 
bool is_valid_ft (double *ref_time, double pt[3], double *rad)
 
double get_cat_m (double t, const double pt[3], double end[2][3], double vel[2][3])
 
double get_cat_ft (double t, const double pt[3], double end[2][3], double vel[2][3])
 
bool get_body_m (double t, simgear::BVHNode::Id id, double bodyToWorld[16], double linearVel[3], double angularVel[3])
 
bool get_agl_m (double t, const double pt[3], double max_altoff, double contact[3], double normal[3], double linearVel[3], double angularVel[3], simgear::BVHMaterial const *&material, simgear::BVHNode::Id &id)
 
bool get_agl_ft (double t, const double pt[3], double max_altoff, double contact[3], double normal[3], double linearVel[3], double angularVel[3], simgear::BVHMaterial const *&material, simgear::BVHNode::Id &id)
 
double get_groundlevel_m (double lat, double lon, double alt)
 
double get_groundlevel_m (const SGGeod &geod)
 
bool get_nearest_m (double t, const double pt[3], double maxDist, double contact[3], double normal[3], double linearVel[3], double angularVel[3], simgear::BVHMaterial const *&material, simgear::BVHNode::Id &id)
 
bool get_nearest_ft (double t, const double pt[3], double maxDist, double contact[3], double normal[3], double linearVel[3], double angularVel[3], simgear::BVHMaterial const *&material, simgear::BVHNode::Id &id)
 
bool caught_wire_m (double t, const double pt[4][3])
 
bool caught_wire_ft (double t, const double pt[4][3])
 
bool get_wire_ends_m (double t, double end[2][3], double vel[2][3])
 
bool get_wire_ends_ft (double t, double end[2][3], double vel[2][3])
 
void release_wire (void)
 
bool updateGroundReactions (simgear::BVHMaterial const *&material)
 
void setHeading (float h)
 
void setPosition (double pt[3])
 
float getPressure ()
 
float getBumpiness ()
 
float getGroundDisplacement ()
 
float getStaticFrictionFactor ()
 
float getRolingFrictionFactor ()
 
bool getSolid ()
 
void add_ai_wake (FGAIAircraft *ai)
 
void reset_wake_group (void)
 
const AIWakeGroupget_wake_group (void)
 

Static Public Member Functions

static const char * staticSubsystemClassId ()
 

Position Parameter Update

Sets the atmospheric static pressure

Parameters
ppressure in psf Sets the atmospheric temperature
Ttemperature in degrees rankine Sets the atmospheric density.
rhoair density slugs/cubic foot Sets the velocity of the local airmass for wind modeling.
wnorthvelocity north in fps
weastvelocity east in fps
wdownvelocity down in fps
bool ToggleDataLogging (bool state)
 
bool ToggleDataLogging (void)
 
double get_agl_ft (double t, const JSBSim::FGColumnVector3 &loc, double alt_off, double contact[3], double normal[3], double vel[3], double angularVel[3])
 

Additional Inherited Members

- Public Types inherited from FGInterface
enum  {
  FG_MAGICCARPET = 0 , FG_LARCSIM = 1 , FG_JSBSIM = 2 , FG_BALLOONSIM = 3 ,
  FG_ADA = 4 , FG_ACM = 5 , FG_SUPER_SONIC = 6 , FG_HELICOPTER = 7 ,
  FG_AUTOGYRO = 8 , FG_PARACHUTE = 9 , FG_EXTERNAL = 10
}
 
- Protected Member Functions inherited from FGInterface
int _calc_multiloop (double dt)
 
void _setup ()
 Set default values for the state of the FDM.
 
void _busdump (void)
 
void _updatePositionM (const SGVec3d &cartPos)
 
void _updatePositionFt (const SGVec3d &cartPos)
 
void _updatePosition (const SGGeod &geod)
 
void _updatePosition (const SGGeoc &geoc)
 
void _updateGeodeticPosition (double lat, double lon, double alt)
 
void _updateGeocentricPosition (double lat_geoc, double lon, double alt)
 
void _update_ground_elev_at_pos (void)
 
void _set_CG_Position (double dx, double dy, double dz)
 
void _set_Accels_Local (double north, double east, double down)
 
void _set_Accels_Body (double u, double v, double w)
 
void _set_Accels_CG_Body (double x, double y, double z)
 
void _set_Accels_Pilot_Body (double x, double y, double z)
 
void _set_Accels_CG_Body_N (double x, double y, double z)
 
void _set_Nlf (double n)
 
void _set_Velocities_Local (double north, double east, double down)
 
void _set_Velocities_Ground (double north, double east, double down)
 
void _set_Velocities_Local_Airmass (double north, double east, double down)
 
void _set_Velocities_Body (double u, double v, double w)
 
void _set_V_rel_wind (double vt)
 
void _set_V_ground_speed (double v)
 
void _set_V_equiv_kts (double kts)
 
void _set_V_calibrated_kts (double kts)
 
void _set_Omega_Body (double p, double q, double r)
 
void _set_Euler_Rates (double phi, double theta, double psi)
 
void set_Phi_dot_degps (double x)
 
void set_Theta_dot_degps (double x)
 
void set_Psi_dot_degps (double x)
 
void _set_Geocentric_Rates (double lat, double lon, double rad)
 
void _set_Geocentric_Position (double lat, double lon, double rad)
 
void _set_Altitude (double altitude)
 
void _set_Altitude_AGL (double agl)
 
void _set_Geodetic_Position (double lat, double lon)
 
void _set_Geodetic_Position (double lat, double lon, double alt)
 
void _set_Euler_Angles (double phi, double theta, double psi)
 
void _set_T_Local_to_Body (int i, int j, double value)
 
void _set_Alpha (double a)
 
void _set_Beta (double b)
 
void set_Alpha_deg (double a)
 
void _set_Gamma_vert_rad (double gv)
 
void _set_Density (double d)
 
void _set_Mach_number (double m)
 
void _set_Static_pressure (double sp)
 
void _set_Static_temperature (double t)
 
void _set_Total_temperature (double tat)
 
void _set_Sea_level_radius (double r)
 
void _set_Earth_position_angle (double a)
 
void _set_Runway_altitude (double alt)
 
void _set_Climb_Rate (double rate)
 

Detailed Description

FGFS / JSBSim interface (aka "The Bus").

This class provides for an interface between FlightGear and its data structures and JSBSim and its data structures. This is the class which is used to command JSBSim when integrated with FlightGear. See the documentation for main for direction on running JSBSim apart from FlightGear.

Author
Curtis L. Olson (original)
Tony Peden (Maintained and refined)
Version
Id
FlightGear.hxx,v 1.16 2014/01/28 09:42:21 ehofman Exp
See also
main in file JSBSim.cpp (use main() wrapper for standalone usage)

Definition at line 101 of file JSBSim.hxx.

Constructor & Destructor Documentation

◆ FGJSBsim()

FGJSBsim::FGJSBsim ( double dt)

Constructor.

Definition at line 124 of file JSBSim.cxx.

◆ ~FGJSBsim()

FGJSBsim::~FGJSBsim ( void )

Destructor.

Definition at line 369 of file JSBSim.cxx.

Member Function Documentation

◆ copy_from_JSBsim()

bool FGJSBsim::copy_from_JSBsim ( )

copy FDM state from LaRCsim structures

Definition at line 748 of file JSBSim.cxx.

◆ copy_to_JSBsim()

bool FGJSBsim::copy_to_JSBsim ( )

copy FDM state to LaRCsim structures

Definition at line 598 of file JSBSim.cxx.

◆ get_agl_ft()

double FGJSBsim::get_agl_ft ( double t,
const JSBSim::FGColumnVector3 & loc,
double alt_off,
double contact[3],
double normal[3],
double vel[3],
double angularVel[3] )

Definition at line 1369 of file JSBSim.cxx.

◆ init()

void FGJSBsim::init ( )
override

Definition at line 380 of file JSBSim.cxx.

◆ resume()

void FGJSBsim::resume ( )
override

Definition at line 588 of file JSBSim.cxx.

◆ set_Altitude()

void FGJSBsim::set_Altitude ( double alt)
virtual

Set altitude Note: this triggers a recalculation of AGL altitude.

Parameters
altaltitude in feet

Reimplemented from FGInterface.

Definition at line 1069 of file JSBSim.cxx.

◆ set_Climb_Rate()

void FGJSBsim::set_Climb_Rate ( double roc)
virtual

Sets rate of climb.

Parameters
rocRate of climb in ft/sec

Reimplemented from FGInterface.

Definition at line 1186 of file JSBSim.cxx.

◆ set_Euler_Angles()

void FGJSBsim::set_Euler_Angles ( double phi,
double theta,
double psi )
virtual

Euler Angle Parameter Set.

Parameters
phiroll angle in radians
thetapitch angle in radians
psiheading angle in radians

Reimplemented from FGInterface.

Definition at line 1164 of file JSBSim.cxx.

◆ set_Gamma_vert_rad()

void FGJSBsim::set_Gamma_vert_rad ( double gamma)
virtual

Sets the flight path angle in radians.

Parameters
gammaflight path angle in radians.

Reimplemented from FGInterface.

Definition at line 1209 of file JSBSim.cxx.

◆ set_Latitude()

void FGJSBsim::set_Latitude ( double lat)
virtual

Set geocentric latitude.

Parameters
latlatitude in radians measured from the 0 meridian where the westerly direction is positive and east is negative

Reimplemented from FGInterface.

Definition at line 1030 of file JSBSim.cxx.

◆ set_Longitude()

void FGJSBsim::set_Longitude ( double lon)
virtual

Set longitude.

Parameters
lonlongitude in radians measured from the equator where the northerly direction is positive and south is negative

Reimplemented from FGInterface.

Definition at line 1056 of file JSBSim.cxx.

◆ set_Mach_number()

void FGJSBsim::set_Mach_number ( double mach)
virtual

Sets Mach number.

Setting this will trigger a recalc of the other velocity terms.

Parameters
machMach number

Reimplemented from FGInterface.

Definition at line 1103 of file JSBSim.cxx.

◆ set_V_calibrated_kts()

void FGJSBsim::set_V_calibrated_kts ( double vc)
virtual

Sets calibrated airspeed Setting this will trigger a recalc of the other velocity terms.

Parameters
vcCalibrated airspeed in ft/sec

Reimplemented from FGInterface.

Definition at line 1081 of file JSBSim.cxx.

◆ set_Velocities_Body()

void FGJSBsim::set_Velocities_Body ( double u,
double v,
double w )
virtual

Sets aircraft velocity in stability frame.

Setting this will trigger a recalc of the other velocity terms.

Parameters
uX velocity in ft/sec
vY velocity in ft/sec
wZ velocity in ft/sec

Reimplemented from FGInterface.

Definition at line 1144 of file JSBSim.cxx.

◆ set_Velocities_Local()

void FGJSBsim::set_Velocities_Local ( double north,
double east,
double down )
virtual

Sets velocity in N-E-D coordinates.

Setting this will trigger a recalc of the other velocity terms.

Parameters
northvelocity northward in ft/sec
eastvelocity eastward in ft/sec
downvelocity downward in ft/sec

Reimplemented from FGInterface.

Definition at line 1123 of file JSBSim.cxx.

◆ staticSubsystemClassId()

static const char * FGJSBsim::staticSubsystemClassId ( )
inlinestatic

Definition at line 118 of file JSBSim.hxx.

◆ suspend()

void FGJSBsim::suspend ( )
override

Definition at line 580 of file JSBSim.cxx.

◆ ToggleDataLogging() [1/2]

bool FGJSBsim::ToggleDataLogging ( bool state)
virtual

Reimplemented from FGInterface.

Definition at line 1017 of file JSBSim.cxx.

◆ ToggleDataLogging() [2/2]

bool FGJSBsim::ToggleDataLogging ( void )
virtual

Reimplemented from FGInterface.

Definition at line 1009 of file JSBSim.cxx.

◆ unbind()

void FGJSBsim::unbind ( )
override

Definition at line 508 of file JSBSim.cxx.

◆ update()

void FGJSBsim::update ( double dt)
override

Definition at line 517 of file JSBSim.cxx.


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