Added rudder trim and aileron trim to FGControls, and bound them to
properties analogous to elevator trim.
This commit is contained in:
parent
7abad40151
commit
0b792ab689
2 changed files with 32 additions and 0 deletions
|
@ -30,9 +30,11 @@
|
|||
// Constructor
|
||||
FGControls::FGControls() :
|
||||
aileron( 0.0 ),
|
||||
aileron_trim( 0.0 ),
|
||||
elevator( 0.0 ),
|
||||
elevator_trim( 1.969572E-03 ),
|
||||
rudder( 0.0 ),
|
||||
rudder_trim( 0.0 ),
|
||||
throttle_idle( true )
|
||||
{
|
||||
}
|
||||
|
@ -41,9 +43,11 @@ FGControls::FGControls() :
|
|||
void FGControls::reset_all()
|
||||
{
|
||||
set_aileron(0.0);
|
||||
set_aileron_trim(0.0);
|
||||
set_elevator(0.0);
|
||||
set_elevator_trim(0.0);
|
||||
set_rudder(0.0);
|
||||
set_rudder_trim(0.0);
|
||||
set_throttle(FGControls::ALL_ENGINES, 0.0);
|
||||
set_starter(FGControls::ALL_ENGINES, false);
|
||||
set_magnetos(FGControls::ALL_ENGINES, 0);
|
||||
|
@ -82,6 +86,9 @@ FGControls::bind ()
|
|||
fgTie("/controls/aileron", this,
|
||||
&FGControls::get_aileron, &FGControls::set_aileron);
|
||||
fgSetArchivable("/controls/aileron");
|
||||
fgTie("/controls/aileron-trim", this,
|
||||
&FGControls::get_aileron_trim, &FGControls::set_aileron_trim);
|
||||
fgSetArchivable("/controls/aileron-trim");
|
||||
fgTie("/controls/elevator", this,
|
||||
&FGControls::get_elevator, &FGControls::set_elevator);
|
||||
fgSetArchivable("/controls/elevator");
|
||||
|
@ -91,6 +98,9 @@ FGControls::bind ()
|
|||
fgTie("/controls/rudder", this,
|
||||
&FGControls::get_rudder, &FGControls::set_rudder);
|
||||
fgSetArchivable("/controls/rudder");
|
||||
fgTie("/controls/rudder-trim", this,
|
||||
&FGControls::get_rudder_trim, &FGControls::set_rudder_trim);
|
||||
fgSetArchivable("/controls/rudder-trim");
|
||||
fgTie("/controls/flaps", this,
|
||||
&FGControls::get_flaps, &FGControls::set_flaps);
|
||||
fgSetArchivable("/controls/flaps");
|
||||
|
@ -136,9 +146,11 @@ FGControls::unbind ()
|
|||
{
|
||||
// Tie control properties.
|
||||
fgUntie("/controls/aileron");
|
||||
fgUntie("/controls/aileron-trim");
|
||||
fgUntie("/controls/elevator");
|
||||
fgUntie("/controls/elevator-trim");
|
||||
fgUntie("/controls/rudder");
|
||||
fgUntie("/controls/rudder-trim");
|
||||
fgUntie("/controls/flaps");
|
||||
int index;
|
||||
for (index = 0; index < MAX_ENGINES; index++) {
|
||||
|
|
|
@ -56,9 +56,11 @@ public:
|
|||
private:
|
||||
|
||||
double aileron;
|
||||
double aileron_trim;
|
||||
double elevator;
|
||||
double elevator_trim;
|
||||
double rudder;
|
||||
double rudder_trim;
|
||||
double flaps;
|
||||
double throttle[MAX_ENGINES];
|
||||
double mixture[MAX_ENGINES];
|
||||
|
@ -97,9 +99,11 @@ public:
|
|||
|
||||
// Query functions
|
||||
inline double get_aileron() const { return aileron; }
|
||||
inline double get_aileron_trim() const { return aileron_trim; }
|
||||
inline double get_elevator() const { return elevator; }
|
||||
inline double get_elevator_trim() const { return elevator_trim; }
|
||||
inline double get_rudder() const { return rudder; }
|
||||
inline double get_rudder_trim() const { return rudder_trim; }
|
||||
inline double get_flaps() const { return flaps; }
|
||||
inline double get_throttle(int engine) const { return throttle[engine]; }
|
||||
inline double get_mixture(int engine) const { return mixture[engine]; }
|
||||
|
@ -132,6 +136,14 @@ public:
|
|||
set_rudder( aileron / 2.0 );
|
||||
}
|
||||
}
|
||||
inline void set_aileron_trim( double pos ) {
|
||||
aileron_trim = pos;
|
||||
CLAMP( &aileron_trim, -1.0, 1.0 );
|
||||
}
|
||||
inline void move_aileron_trim( double amt ) {
|
||||
aileron_trim += amt;
|
||||
CLAMP( &aileron_trim, -1.0, 1.0 );
|
||||
}
|
||||
inline void set_elevator( double pos ) {
|
||||
elevator = pos;
|
||||
CLAMP( &elevator, -1.0, 1.0 );
|
||||
|
@ -156,6 +168,14 @@ public:
|
|||
rudder += amt;
|
||||
CLAMP( &rudder, -1.0, 1.0 );
|
||||
}
|
||||
inline void set_rudder_trim( double pos ) {
|
||||
rudder_trim = pos;
|
||||
CLAMP( &rudder_trim, -1.0, 1.0 );
|
||||
}
|
||||
inline void move_rudder_trim( double amt ) {
|
||||
rudder_trim += amt;
|
||||
CLAMP( &rudder_trim, -1.0, 1.0 );
|
||||
}
|
||||
inline void set_flaps( double pos ) {
|
||||
flaps = pos;
|
||||
CLAMP( &flaps, 0.0, 1.0 );
|
||||
|
|
Loading…
Add table
Reference in a new issue