~mulder-nebulon/openracing/PhysX

« back to all changes in this revision

Viewing changes to src/human/HumanRobot.cs

  • Committer: Nagy Imre
  • Date: 2009-03-14 12:52:57 UTC
  • Revision ID: mulder@codenode-20090314125257-cj2uude8ojrq72r4
Added throttle, fixed Barcelona track offset

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
        public static int ACCELERATOR_BUTTON = 0;
16
16
        public static int BRAKE_BUTTON = 1;
17
17
        public static int STEER_AXIS = 0;
 
18
        public static int THROTTLE_AXIS = 1;
18
19
        public static int GEAR_DOWN_BUTTON = 4;
19
20
        public static int GEAR_UP_BUTTON = 5;
20
21
 
96
97
            }
97
98
        }
98
99
 
99
 
        public void OnAxisMoved(int axisID, float val) {
 
100
        public void OnAxisMoved(int axisID, float val) 
 
101
            {
100
102
            // Console.Out.WriteLine("axisID {0} val {1}", axisID, val);
101
 
            if (axisID == STEER_AXIS) {
102
 
                SteerCommand = -val;
103
 
            }
104
 
        }
 
103
                if      (axisID==STEER_AXIS)    SteerCommand = -val;
 
104
                else if (axisID==THROTTLE_AXIS)
 
105
                    {
 
106
                        //TODO should watch out if throttle, brake and clutch are on different axis!
 
107
                        Console.Out.WriteLine("axisID {0} val {1}", axisID, val);
 
108
                        if (val>0)              // brake        
 
109
                            {
 
110
                                BrakeCommand = val;
 
111
                            }
 
112
                        else if (val<0)         // accelerate
 
113
                            {
 
114
                                AcceleratorCommand = -val;
 
115
                            }
 
116
                    }
 
117
            }
105
118
#endregion
106
119
 
107
120
#region IRobot implementation