We assume that you're successful to build the sample controller following the instructions.
When you run the TORCS and the client executable files, you will see the following scenes.
Tutorial 2
Open “SimpleDriver.cpp”
Please add the following codes before “CarControl cc(accel,brake,gear,steer,clutch);” in wDrive function.
accel=1.0; brake=0.0;
Tutorial 3
delete the new codes added in the tutorial 2
Please add the following codes before “CarControl cc(accel,brake,gear,steer,clutch);” in wDrive function.
double target_speed=100;
double actual_speed=cs.getSpeedX();
accel=0;
if(target_speed-actual_speed>0) accel=(target_speed-actual_speed)/20;
if(target_speed-actual_speed>20) accel=1;
brake=0;
* Tutorial 4
delete the new codes added in the tutorial 3
Please add the following codes before “CarControl cc(accel,brake,gear,steer,clutch);” in wDrive function.
steer=0;
accel=1;
brake=0;
Tutorial 5
delete the new codes added in the tutorial 4
Please add the following codes before “CarControl cc(accel,brake,gear,steer,clutch);” in wDrive function.
double target_pos=0;
double actual_pos=cs.getTrackPos();
double angle=cs.getAngle();
double error = target_pos - actual_pos;
angle = angle + error;
steer = angle/steerLock;