From dcdd61c590bff9b2b555c2d06e235e54e4a38b0f Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 12 Jun 2000 20:52:36 +0000 Subject: [PATCH] Added differential braking (Alex and David). --- src/FDM/LaRCsim.cxx | 3 ++- src/FDM/LaRCsim/c172_gear.c | 7 +++++-- src/FDM/LaRCsim/ls_cockpit.h | 5 ++++- src/FDM/LaRCsim/navion_gear.c | 8 +++++--- src/Main/keyboard.cxx | 14 ++++++++++++++ 5 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/FDM/LaRCsim.cxx b/src/FDM/LaRCsim.cxx index 1c2697be2..9203b249e 100644 --- a/src/FDM/LaRCsim.cxx +++ b/src/FDM/LaRCsim.cxx @@ -91,7 +91,8 @@ int FGLaRCsim::update( int multiloop ) { Rudder_pedal = controls.get_rudder(); Flap_handle = 30.0 * controls.get_flaps(); Throttle_pct = controls.get_throttle( 0 ) * 1.0; - Brake_pct = controls.get_brake( 0 ); + Brake_pct[0] = controls.get_brake( 1 ); + Brake_pct[1] = controls.get_brake( 0 ); // Inform LaRCsim of the local terrain altitude Runway_altitude = get_Runway_altitude(); diff --git a/src/FDM/LaRCsim/c172_gear.c b/src/FDM/LaRCsim/c172_gear.c index 1ea4cc6cc..9f54fa62e 100644 --- a/src/FDM/LaRCsim/c172_gear.c +++ b/src/FDM/LaRCsim/c172_gear.c @@ -36,6 +36,9 @@ $Header$ $Log$ +Revision 1.15 2000/06/12 18:52:37 curt +Added differential braking (Alex and David). + Revision 1.14 2000/04/10 18:09:41 curt David Megginson made a few (mostly minor) mods to the LaRCsim files, and it's now possible to choose the LaRCsim model at runtime, as in @@ -220,8 +223,8 @@ char gear_strings[NUM_WHEELS][12]={"nose","right main", "left main", "tail skid" * Put aircraft specific executable code here */ - percent_brake[1] = Brake_pct; /* replace with cockpit brake handle connection code */ - percent_brake[2] = percent_brake[1]; + percent_brake[1] = Brake_pct[0]; + percent_brake[2] = Brake_pct[1]; caster_angle_rad[0] = 0.52*Rudder_pedal; diff --git a/src/FDM/LaRCsim/ls_cockpit.h b/src/FDM/LaRCsim/ls_cockpit.h index 0661e3e0e..431f006fa 100644 --- a/src/FDM/LaRCsim/ls_cockpit.h +++ b/src/FDM/LaRCsim/ls_cockpit.h @@ -35,6 +35,9 @@ $Header$ $Log$ +Revision 1.3 2000/06/12 18:52:37 curt +Added differential braking (Alex and David). + Revision 1.2 1999/10/29 16:08:32 curt Added flaps support to c172 model. @@ -92,7 +95,7 @@ typedef struct { short left_pb_on_stick, right_pb_on_stick, trig_pos_1, trig_pos_2; short sb_extend, sb_retract, gear_sel_up; float throttle_pct; - float brake_pct; + float brake_pct[2]; } COCKPIT; extern COCKPIT cockpit_; diff --git a/src/FDM/LaRCsim/navion_gear.c b/src/FDM/LaRCsim/navion_gear.c index 91de63c52..2e8fb4a5f 100644 --- a/src/FDM/LaRCsim/navion_gear.c +++ b/src/FDM/LaRCsim/navion_gear.c @@ -36,6 +36,9 @@ $Header$ $Log$ +Revision 1.3 2000/06/12 18:52:37 curt +Added differential braking (Alex and David). + Revision 1.2 2000/04/10 18:09:41 curt David Megginson made a few (mostly minor) mods to the LaRCsim files, and it's now possible to choose the LaRCsim model at runtime, as in @@ -235,9 +238,8 @@ char rcsid[] = "$Id$"; * Put aircraft specific executable code here */ - /* replace with cockpit brake handle connection code */ - percent_brake[1] = Brake_pct; - percent_brake[2] = percent_brake[1]; + percent_brake[1] = Brake_pct[0]; + percent_brake[2] = Brake_pct[1]; caster_angle_rad[0] = 0.03*Rudder_pedal; diff --git a/src/Main/keyboard.cxx b/src/Main/keyboard.cxx index f76b50f3c..4e6b61761 100644 --- a/src/Main/keyboard.cxx +++ b/src/Main/keyboard.cxx @@ -324,6 +324,20 @@ void GLUTkey(unsigned char k, int x, int y) { b_set = double(!b_ret); controls.set_brake( FGControls::ALL_WHEELS, b_set); return; + case 44: // , key + if (controls.get_brake(0) > 0.0) { + controls.set_brake(0, 0.0); + } else { + controls.set_brake(0, 1.0); + } + return; + case 46: // . key + if (controls.get_brake(1) > 0.0) { + controls.set_brake(1, 0.0); + } else { + controls.set_brake(1, 1.0); + } + return; case 104: // h key HUD_masterswitch( true ); return; -- 2.39.5