29#include <simgear/constants.h>
30#include <simgear/debug/logstream.hxx>
31#include <simgear/timing/timestamp.hxx>
32#include <simgear/scene/material/mat.hxx>
33#include <simgear/io/iochannel.hxx>
41static inline void assign(
double* ptr,
const SGVec3d& vec)
90 _state.d_cg_rp_body_v = SGVec3d::zeros();
91 _state.v_dot_local_v = SGVec3d::zeros();
92 _state.v_dot_body_v = SGVec3d::zeros();
93 _state.a_cg_body_v = SGVec3d::zeros();
94 _state.a_pilot_body_v = SGVec3d::zeros();
95 _state.n_cg_body_v = SGVec3d::zeros();
96 _state.v_local_v = SGVec3d::zeros();
97 _state.v_local_rel_ground_v = SGVec3d::zeros();
98 _state.v_local_airmass_v = SGVec3d::zeros();
99 _state.v_body_v = SGVec3d::zeros();
100 _state.omega_body_v = SGVec3d::zeros();
101 _state.euler_rates_v = SGVec3d::zeros();
102 _state.geocentric_rates_v = SGVec3d::zeros();
103 _state.geodetic_position_v = SGGeod::fromRadM(0, 0, 0);
104 _state.cartesian_position_v = SGVec3d::fromGeod(_state.geodetic_position_v);
105 _state.geocentric_position_v = SGGeoc::fromCart(_state.cartesian_position_v);
106 _state.euler_angles_v = SGVec3d::zeros();
109 _state.v_rel_wind=_state.v_true_kts=0;
110 _state.v_ground_speed=_state.v_equiv_kts=0;
111 _state.v_calibrated_kts=0;
112 _state.alpha=_state.beta=0;
113 _state.gamma_vert_rad=0;
114 _state.density=_state.mach_number=0;
115 _state.static_pressure=_state.total_pressure=0;
116 _state.dynamic_pressure=0;
117 _state.static_temperature=_state.total_temperature=0;
118 _state.sea_level_radius=_state.earth_position_angle=0;
119 _state.runway_altitude=0;
121 _state.altitude_agl=0;
139 SG_LOG( SG_FLIGHT, SG_INFO,
"Start common FDM init" );
143 ground_cache.set_cache_time_offset(
globals->get_sim_time_sec());
146 SG_LOG( SG_FLIGHT, SG_INFO,
"...initializing position..." );
147 double lon =
fgGetDouble(
"/sim/presets/longitude-deg")
148 * SGD_DEGREES_TO_RADIANS;
149 double lat =
fgGetDouble(
"/sim/presets/latitude-deg")
150 * SGD_DEGREES_TO_RADIANS;
151 double alt_ft =
fgGetDouble(
"/sim/presets/altitude-ft");
152 double alt_m = alt_ft * SG_FEET_TO_METER;
155 SG_LOG( SG_FLIGHT, SG_INFO,
"Checking for lon = "
156 << lon*SGD_RADIANS_TO_DEGREES <<
"deg, lat = "
157 << lat*SGD_RADIANS_TO_DEGREES <<
"deg, alt = "
161 double ground_elev_ft = ground_elev_m * SG_METER_TO_FEET;
165 if (
fgGetBool(
"/sim/presets/onground") || alt_ft < ground_elev_ft ) {
166 fgSetDouble(
"/position/altitude-ft", ground_elev_ft + 0.1);
173 SG_LOG( SG_FLIGHT, SG_INFO,
174 "...initializing ground elevation to " << ground_elev_ft
178 SG_LOG( SG_FLIGHT, SG_INFO,
"...initializing sea-level radius..." );
179 SG_LOG( SG_FLIGHT, SG_INFO,
" lat = "
182 double slr = SGGeodesy::SGGeodToSeaLevelRadius(_state.geodetic_position_v);
186 SG_LOG( SG_FLIGHT, SG_INFO,
"...initializing Euler angles..." );
188 * SGD_DEGREES_TO_RADIANS,
190 * SGD_DEGREES_TO_RADIANS,
192 * SGD_DEGREES_TO_RADIANS );
195 SG_LOG( SG_FLIGHT, SG_INFO,
"...initializing velocities..." );
196 if ( !
fgHasNode(
"/sim/presets/speed-set") ) {
199 const std::string speedset =
fgGetString(
"/sim/presets/speed-set");
200 if ( speedset ==
"knots" || speedset ==
"KNOTS" ) {
202 }
else if ( speedset ==
"mach" || speedset ==
"MACH" ) {
204 }
else if ( speedset ==
"UVW" || speedset ==
"uvw" ) {
209 }
else if ( speedset ==
"NED" || speedset ==
"ned" ) {
215 SG_LOG( SG_FLIGHT, SG_ALERT,
216 "Unrecognized value for /sim/presets/speed-set: "
222 if (
fgHasNode(
"/sim/presets/glideslope-deg") )
224 * SGD_DEGREES_TO_RADIANS );
225 else if (
fgHasNode(
"/sim/presets/speed-set") &&
226 fgHasNode(
"/sim/presets/vertical-speed-fps") )
233 SG_LOG( SG_FLIGHT, SG_INFO,
"End common FDM init" );
237 std::function<
void(
const std::string& from,
const std::string& to)> fn
258 _tiedProperties.setRoot(
globals->get_props());
260 _tiedProperties.Tie(
"/position/latitude-deg",
this,
265 _tiedProperties.Tie(
"/position/longitude-deg",
this,
270 _tiedProperties.Tie(
"/position/altitude-ft",
this,
275 _tiedProperties.Tie(
"/position/altitude-agl-ft",
this,
278 _tiedProperties.Tie(
"/position/ground-elev-ft",
this,
281 _tiedProperties.Tie(
"/position/ground-elev-m",
this,
283 _tiedProperties.Tie(
"/environment/ground-elevation-m",
this,
286 _tiedProperties.Tie(
"/position/sea-level-radius-ft",
this,
291 _tiedProperties.Tie(
"/orientation/roll-deg",
this,
295 _tiedProperties.Tie(
"/orientation/pitch-deg",
this,
299 _tiedProperties.Tie(
"/orientation/heading-deg",
this,
303 _tiedProperties.Tie(
"/orientation/true-heading-deg",
this,
307 _tiedProperties.Tie(
"/orientation/track-deg",
this,
309 _tiedProperties.Tie(
"/orientation/path-deg",
this,
314 _tiedProperties.Tie(
"/orientation/roll-rate-degps",
this,
317 _tiedProperties.Tie(
"/orientation/pitch-rate-degps",
this,
320 _tiedProperties.Tie(
"/orientation/yaw-rate-degps",
this,
329 _tiedProperties.Tie(
"/velocities/groundspeed-kt",
this,
334 _tiedProperties.Tie(
"/velocities/airspeed-kt",
this,
339 _tiedProperties.Tie(
"/velocities/equivalent-kt",
this,
343 _tiedProperties.Tie(
"/velocities/mach",
this,
366 _tiedProperties.Tie(
"/velocities/speed-north-fps",
this,
368 _tiedProperties.Tie(
"/velocities/speed-east-fps",
this,
370 _tiedProperties.Tie(
"/velocities/speed-down-fps",
this,
373 _tiedProperties.Tie(
"/velocities/north-relground-fps",
this,
375 _tiedProperties.Tie(
"/velocities/east-relground-fps",
this,
377 _tiedProperties.Tie(
"/velocities/down-relground-fps",
this,
382 _tiedProperties.Tie(
"/velocities/uBody-fps",
this,
387 _tiedProperties.Tie(
"/velocities/vBody-fps",
this,
392 _tiedProperties.Tie(
"/velocities/wBody-fps",
this,
399 _tiedProperties.Tie(
"/velocities/vertical-speed-fps",
this,
402 _tiedProperties.Tie(
"/velocities/glideslope",
this,
405 _tiedProperties.Tie(
"/orientation/side-slip-rad",
this,
407 _tiedProperties.Tie(
"/orientation/side-slip-deg",
this,
409 _tiedProperties.Tie(
"/orientation/alpha-deg",
this,
411 _tiedProperties.Tie(
"/accelerations/nlf",
this,
415 _tiedProperties.Tie(
"/accelerations/ned/north-accel-fps_sec",
417 _tiedProperties.Tie(
"/accelerations/ned/east-accel-fps_sec",
419 _tiedProperties.Tie(
"/accelerations/ned/down-accel-fps_sec",
423 _tiedProperties.Tie(
"/accelerations/pilot/x-accel-fps_sec",
425 _tiedProperties.Tie(
"/accelerations/pilot/y-accel-fps_sec",
427 _tiedProperties.Tie(
"/accelerations/pilot/z-accel-fps_sec",
430 _tiedProperties.Tie(
"/accelerations/n-z-cg-fps_sec",
444 _tiedProperties.Untie();
454 SG_LOG(SG_FLIGHT, SG_ALERT,
"dummy update() ... SHOULDN'T BE CALLED!");
460 int length =
sizeof(FlightState);
462 if ( io->get_type() == sgFileType ) {
463 if ( io->read( (
char *)(& buf), length ) == length ) {
464 SG_LOG( SG_IO, SG_DEBUG,
"Success reading data." );
469 while ( io->read( (
char *)(& buf), length ) == length ) {
470 SG_LOG( SG_IO, SG_DEBUG,
"Success reading data." );
480 if (!bound || !inited) {
484 int length =
sizeof(FlightState);
485 if ( ! io->write( (
char *)(& _state), length ) ) {
486 SG_LOG( SG_IO, SG_ALERT,
"Error writing data." );
495 TrackComputer tracker( _state.track, _state.path, _state.geodetic_position_v );
496 _state.cartesian_position_v = cartPos;
497 _state.geodetic_position_v = SGGeod::fromCart(_state.cartesian_position_v);
498 _state.geocentric_position_v = SGGeoc::fromCart(_state.cartesian_position_v);
499 _set_Sea_level_radius( SGGeodesy::SGGeodToSeaLevelRadius(_state.geodetic_position_v)*SG_METER_TO_FEET );
506 TrackComputer tracker( _state.track, _state.path, _state.geodetic_position_v );
507 _state.geodetic_position_v = geod;
508 _state.cartesian_position_v = SGVec3d::fromGeod(_state.geodetic_position_v);
509 _state.geocentric_position_v = SGGeoc::fromCart(_state.cartesian_position_v);
511 _set_Sea_level_radius( SGGeodesy::SGGeodToSeaLevelRadius(_state.geodetic_position_v)*SG_METER_TO_FEET );
518 TrackComputer tracker( _state.track, _state.path, _state.geodetic_position_v );
519 _state.geocentric_position_v = geoc;
520 _state.cartesian_position_v = SGVec3d::fromGeoc(_state.geocentric_position_v);
521 _state.geodetic_position_v = SGGeod::fromCart(_state.cartesian_position_v);
523 _set_Sea_level_radius( SGGeodesy::SGGeodToSeaLevelRadius(_state.geodetic_position_v)*SG_METER_TO_FEET );
547 _state.geodetic_position_v.setLatitudeRad(lat);
551 _state.geodetic_position_v.setLongitudeRad(lon);
555 _state.geodetic_position_v.setElevationFt(alt);
559 _state.altitude_agl=altagl;
564 _state.v_calibrated_kts = vc;
568 _state.mach_number = mach;
574 _state.v_local_v[0] = north;
575 _state.v_local_v[1] = east;
576 _state.v_local_v[2] = down;
582 _state.v_body_v[0] = u;
583 _state.v_body_v[1] = v;
584 _state.v_body_v[2] = w;
591 _state.euler_angles_v[0] = phi;
592 _state.euler_angles_v[1] = theta;
593 _state.euler_angles_v[2] = psi;
598 _state.climb_rate = roc;
602 _state.gamma_vert_rad = gamma;
612 _state.v_local_airmass_v[0] = wnorth;
613 _state.v_local_airmass_v[1] = weast;
614 _state.v_local_airmass_v[2] = wdown;
620 SG_LOG(SG_FLIGHT,SG_INFO,
"d_cg_rp_body_v: " << _state.d_cg_rp_body_v);
621 SG_LOG(SG_FLIGHT,SG_INFO,
"v_dot_local_v: " << _state.v_dot_local_v);
622 SG_LOG(SG_FLIGHT,SG_INFO,
"v_dot_body_v: " << _state.v_dot_body_v);
623 SG_LOG(SG_FLIGHT,SG_INFO,
"a_cg_body_v: " << _state.a_cg_body_v);
624 SG_LOG(SG_FLIGHT,SG_INFO,
"a_pilot_body_v: " << _state.a_pilot_body_v);
625 SG_LOG(SG_FLIGHT,SG_INFO,
"n_cg_body_v: " << _state.n_cg_body_v);
626 SG_LOG(SG_FLIGHT,SG_INFO,
"v_local_v: " << _state.v_local_v);
627 SG_LOG(SG_FLIGHT,SG_INFO,
"v_local_rel_ground_v: " << _state.v_local_rel_ground_v);
628 SG_LOG(SG_FLIGHT,SG_INFO,
"v_local_airmass_v: " << _state.v_local_airmass_v);
629 SG_LOG(SG_FLIGHT,SG_INFO,
"v_body_v: " << _state.v_body_v);
630 SG_LOG(SG_FLIGHT,SG_INFO,
"omega_body_v: " << _state.omega_body_v);
631 SG_LOG(SG_FLIGHT,SG_INFO,
"euler_rates_v: " << _state.euler_rates_v);
632 SG_LOG(SG_FLIGHT,SG_INFO,
"geocentric_rates_v: " << _state.geocentric_rates_v);
633 SG_LOG(SG_FLIGHT,SG_INFO,
"geocentric_position_v: " << _state.geocentric_position_v);
634 SG_LOG(SG_FLIGHT,SG_INFO,
"geodetic_position_v: " << _state.geodetic_position_v);
635 SG_LOG(SG_FLIGHT,SG_INFO,
"euler_angles_v: " << _state.euler_angles_v);
637 SG_LOG(SG_FLIGHT,SG_INFO,
"nlf: " << _state.nlf );
638 SG_LOG(SG_FLIGHT,SG_INFO,
"v_rel_wind: " << _state.v_rel_wind );
639 SG_LOG(SG_FLIGHT,SG_INFO,
"v_true_kts: " << _state.v_true_kts );
640 SG_LOG(SG_FLIGHT,SG_INFO,
"v_ground_speed: " << _state.v_ground_speed );
641 SG_LOG(SG_FLIGHT,SG_INFO,
"v_equiv_kts: " << _state.v_equiv_kts );
642 SG_LOG(SG_FLIGHT,SG_INFO,
"v_calibrated_kts: " << _state.v_calibrated_kts );
643 SG_LOG(SG_FLIGHT,SG_INFO,
"alpha: " << _state.alpha );
644 SG_LOG(SG_FLIGHT,SG_INFO,
"beta: " << _state.beta );
645 SG_LOG(SG_FLIGHT,SG_INFO,
"gamma_vert_rad: " << _state.gamma_vert_rad );
646 SG_LOG(SG_FLIGHT,SG_INFO,
"density: " << _state.density );
647 SG_LOG(SG_FLIGHT,SG_INFO,
"mach_number: " << _state.mach_number );
648 SG_LOG(SG_FLIGHT,SG_INFO,
"static_pressure: " << _state.static_pressure );
649 SG_LOG(SG_FLIGHT,SG_INFO,
"total_pressure: " << _state.total_pressure );
650 SG_LOG(SG_FLIGHT,SG_INFO,
"dynamic_pressure: " << _state.dynamic_pressure );
651 SG_LOG(SG_FLIGHT,SG_INFO,
"static_temperature: " << _state.static_temperature );
652 SG_LOG(SG_FLIGHT,SG_INFO,
"total_temperature: " << _state.total_temperature );
653 SG_LOG(SG_FLIGHT,SG_INFO,
"sea_level_radius: " << _state.sea_level_radius );
654 SG_LOG(SG_FLIGHT,SG_INFO,
"earth_position_angle: " << _state.earth_position_angle );
655 SG_LOG(SG_FLIGHT,SG_INFO,
"runway_altitude: " << _state.runway_altitude );
656 SG_LOG(SG_FLIGHT,SG_INFO,
"climb_rate: " << _state.climb_rate );
657 SG_LOG(SG_FLIGHT,SG_INFO,
"altitude_agl: " << _state.altitude_agl );
662 const double pt[3],
double rad)
664 return ground_cache.prepare_ground_cache(startSimTime, endSimTime,
670 const double pt[3],
double rad)
673 SGVec3d pt_ft = SG_FEET_TO_METER*SGVec3d(pt);
674 return ground_cache.prepare_ground_cache(startSimTime, endSimTime,
675 pt_ft, rad*SG_FEET_TO_METER);
682 bool valid = ground_cache.is_valid(*ref_time, _pt, *rad);
691 bool found_ground = ground_cache.is_valid(*ref_time, _pt, *rad);
692 assign(pt, SG_METER_TO_FEET*_pt);
693 *rad *= SG_METER_TO_FEET;
699 double end[2][3],
double vel[2][3])
701 SGVec3d _end[2], _vel[2];
702 double dist = ground_cache.get_cat(t, SGVec3d(pt), _end, _vel);
703 for (
int k=0; k<2; ++k) {
704 assign( end[k], _end[k] );
705 assign( vel[k], _vel[k] );
712 double end[2][3],
double vel[2][3])
715 SGVec3d pt_m = SG_FEET_TO_METER*SGVec3d(pt);
716 SGVec3d _end[2], _vel[2];
717 double dist = ground_cache.get_cat(t, pt_m, _end, _vel);
718 for (
int k=0; k<2; ++k) {
719 assign( end[k], SG_METER_TO_FEET*_end[k] );
720 assign( vel[k], SG_METER_TO_FEET*_vel[k] );
722 return dist*SG_METER_TO_FEET;
727 double bodyToWorld[16],
double linearVel[3],
728 double angularVel[3])
730 SGMatrixd _bodyToWorld;
731 SGVec3d _linearVel, _angularVel;
732 bool _foundID = ground_cache.get_body(t, _bodyToWorld, _linearVel, _angularVel,
id);
734 assign(linearVel, _linearVel);
735 assign(angularVel, _angularVel);
736 for (
unsigned int i = 0;
i < 16; ++
i)
737 bodyToWorld[
i] = _bodyToWorld.data()[
i];
747 double contact[3],
double normal[3],
748 double linearVel[3],
double angularVel[3],
749 simgear::BVHMaterial
const*& material, simgear::BVHNode::Id&
id)
751 SGVec3d pt_m = SGVec3d(pt) - max_altoff*ground_cache.get_down();
752 SGVec3d _contact,
_normal, _linearVel, _angularVel;
754 bool ret = ground_cache.get_agl(t, pt_m, _contact,
_normal, _linearVel,
755 _angularVel,
id, material);
759 _linearVel += cross(_angularVel, _contact - pt_m);
761 assign(contact, _contact);
763 assign(linearVel, _linearVel);
764 assign(angularVel, _angularVel);
770 double contact[3],
double normal[3],
771 double linearVel[3],
double angularVel[3],
772 simgear::BVHMaterial
const*& material, simgear::BVHNode::Id&
id)
775 SGVec3d pt_m = SGVec3d(pt) - max_altoff*ground_cache.get_down();
776 pt_m *= SG_FEET_TO_METER;
777 SGVec3d _contact,
_normal, _linearVel, _angularVel;
779 bool ret = ground_cache.get_agl(t, pt_m, _contact,
_normal, _linearVel,
780 _angularVel,
id, material);
784 _linearVel += cross(_angularVel, _contact - pt_m);
787 assign( contact, SG_METER_TO_FEET*_contact );
789 assign( linearVel, SG_METER_TO_FEET*_linearVel );
790 assign( angularVel, _angularVel );
796 double contact[3],
double normal[3],
797 double linearVel[3],
double angularVel[3],
798 simgear::BVHMaterial
const*& material,
799 simgear::BVHNode::Id&
id)
801 SGVec3d _contact, _linearVel, _angularVel;
803 if (!ground_cache.get_nearest(t, SGVec3d(pt), maxDist, _contact, _linearVel,
804 _angularVel,
id, material))
807 assign(contact, _contact);
808 assign(linearVel, _linearVel);
809 assign(angularVel, _angularVel);
815 double contact[3],
double normal[3],
816 double linearVel[3],
double angularVel[3],
817 simgear::BVHMaterial
const*& material,
818 simgear::BVHNode::Id&
id)
820 SGVec3d _contact, _linearVel, _angularVel;
822 if (!ground_cache.get_nearest(t, SG_FEET_TO_METER*SGVec3d(pt),
823 SG_FEET_TO_METER*maxDist, _contact, _linearVel,
824 _angularVel,
id, material))
827 assign(contact, SG_METER_TO_FEET*_contact);
828 assign(linearVel, SG_METER_TO_FEET*_linearVel);
829 assign(angularVel, _angularVel);
843 SGVec3d pos = SGVec3d::fromGeod(geod);
847 double ref_time = 0, radius;
849 if (!
is_valid_m(&ref_time, cpos.data(), &radius)) {
850 double startTime = ref_time;
851 double endTime = startTime + 1;
857 pos = SGVec3d::fromGeod(SGGeod::fromGeodM(geod, 10000));
862 }
else if (radius*radius <= distSqr(pos, cpos)) {
863 double startTime = ref_time;
864 double endTime = startTime + 1;
875 pos = SGVec3d::fromGeod(SGGeod::fromGeodM(geod, 10000));
882 double contact[3], normal[3], vel[3], angvel[3];
883 const simgear::BVHMaterial* material;
884 simgear::BVHNode::Id id;
889 get_agl_m(ref_time, pos.data(), 2.0, contact, normal, vel, angvel,
891 return SGGeod::fromCart(SGVec3d(contact)).getElevationM();
898 for (
int i=0;
i<4; ++
i)
899 pt_m[
i] = SGVec3d(pt[
i]);
901 return ground_cache.caught_wire(t, pt_m);
909 for (
int i=0;
i<4; ++
i)
910 pt_m[
i] = SG_FEET_TO_METER*SGVec3d(pt[
i]);
912 return ground_cache.caught_wire(t, pt_m);
918 SGVec3d _end[2], _vel[2];
919 bool ret = ground_cache.get_wire_ends(t, _end, _vel);
920 for (
int k=0; k<2; ++k) {
921 assign( end[k], _end[k] );
922 assign( vel[k], _vel[k] );
931 SGVec3d _end[2], _vel[2];
932 bool ret = ground_cache.get_wire_ends(t, _end, _vel);
933 for (
int k=0; k<2; ++k) {
934 assign( end[k], SG_METER_TO_FEET*_end[k] );
935 assign( vel[k], SG_METER_TO_FEET*_vel[k] );
943 ground_cache.release_wire();
void _updatePosition(const SGGeod &geod)
double get_V_dot_east() const
void set_Theta_dot_degps(double x)
void set_V_ground_speed_kt(double ground_speed)
virtual void set_Static_temperature(double T)
double get_V_east() const
void _update_ground_elev_at_pos(void)
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)
double get_V_north_rel_ground() const
bool writeState(SGIOChannel *io)
void set_V_east(double east)
double get_V_down() const
virtual void set_Latitude_deg(double lat)
virtual void set_Theta_deg(double theta)
virtual void set_Velocities_Body(double u, double v, double w)
bool caught_wire_m(double t, const double pt[4][3])
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)
virtual void set_vBody(double vBody)
double get_V_calibrated_kts() const
void unbind() override
Unbind any properties bound to this FDM.
void set_inited(bool value)
double get_Psi_deg() const
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)
virtual void set_wBody(double wBody)
double get_V_equiv_kts() const
bool get_wire_ends_ft(double t, double end[2][3], double vel[2][3])
bool is_valid_ft(double *ref_time, double pt[3], double *rad)
double get_V_down_rel_ground() const
virtual void set_Phi_deg(double phi)
double get_cat_m(double t, const double pt[3], double end[2][3], double vel[2][3])
virtual void property_associations(std::function< void(const std::string &from, const std::string &to)> fn)
virtual void set_Latitude(double lat)
virtual void set_Climb_Rate(double roc)
double get_P_body() const
void bind() override
Bind getters and setters to properties.
double get_Gamma_vert_rad() const
void set_Phi_dot_degps(double x)
void common_init()
Initialize the state of the FDM.
bool readState(SGIOChannel *io)
bool prepare_ground_cache_ft(double startSimTime, double endSimTime, const double pt[3], double rad)
virtual void set_Mach_number(double mach)
void _set_Runway_altitude(double alt)
double get_cat_ft(double t, const double pt[3], double end[2][3], double vel[2][3])
double get_Track(void) const
virtual void set_Gamma_vert_rad(double gamma)
void set_V_down(double down)
double get_Beta_deg() const
void set_Alpha_deg(double a)
double get_Mach_number() const
double get_A_Z_pilot() const
virtual void set_V_calibrated_kts(double vc)
bool prepare_ground_cache_m(double startSimTime, double endSimTime, const double pt[3], double rad)
double get_Runway_altitude_m() const
virtual void set_Altitude(double alt)
double get_Runway_altitude() const
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)
double get_V_dot_down() const
virtual void set_Longitude_deg(double lon)
virtual void set_Density(double rho)
double get_Nlf(void) const
double get_Longitude_deg() const
double get_N_Z_cg() const
bool is_valid_m(double *ref_time, double pt[3], double *rad)
double get_Path(void) const
double get_Latitude_deg() const
double get_V_north() const
void _setup()
Set default values for the state of the FDM.
bool get_wire_ends_m(double t, double end[2][3], double vel[2][3])
double get_A_X_pilot() const
void _set_Sea_level_radius(double r)
void _updateGeocentricPosition(double lat_geoc, double lon, double alt)
double get_V_dot_north() const
double get_A_Y_pilot() const
double get_Altitude() const
void set_V_north(double north)
virtual void set_Static_pressure(double p)
bool caught_wire_ft(double t, const double pt[4][3])
virtual void set_Psi_deg(double psi)
virtual void set_Euler_Angles(double phi, double theta, double psi)
void update(double dt) override
Update the state of the FDM (i.e.
bool get_body_m(double t, simgear::BVHNode::Id id, double bodyToWorld[16], double linearVel[3], double angularVel[3])
void _updateGeodeticPosition(double lat, double lon, double alt)
double get_Psi_dot_degps() const
double get_V_east_rel_ground() const
double get_Phi_dot_degps() const
void _updatePositionM(const SGVec3d &cartPos)
int _calc_multiloop(double dt)
double get_Sea_level_radius() const
void reset_wake_group(void)
double get_Alpha_deg() const
virtual void set_uBody(double uBody)
virtual void set_Longitude(double lon)
double get_groundlevel_m(double lat, double lon, double alt)
double get_V_ground_speed_kt() const
double get_Climb_Rate() const
virtual void set_Velocities_Local(double north, double east, double down)
double get_Altitude_AGL(void) const
double get_Q_body() const
virtual void set_Velocities_Local_Airmass(double wnorth, double weast, double wdown)
double get_Theta_dot_degps() const
virtual void set_AltitudeAGL(double altagl)
double get_Phi_deg() const
double get_R_body() const
void set_Psi_dot_degps(double x)
double get_Theta_deg() const
A little helper class to update the track if the position has changed.
bool fgHasNode(const char *path)
Test whether a given node exists.
std::string fgGetString(const char *name, const char *defaultValue)
Get a string value for a property.
void fgSetArchivable(const char *name, bool state)
Set the state of the archive attribute for a property.
static void assign(double *ptr, const SGVec3d &vec)
bool fgSetDouble(const char *name, double defaultValue)
Set a double value for a property.
bool fgGetBool(char const *name, bool def)
Get a bool value for a property.
double fgGetDouble(const char *name, double defaultValue)
Get a double value for a property.