diff --git a/src/libs/robottools/rthumandriver.cpp b/src/libs/robottools/rthumandriver.cpp index 76d1b1d7..72a2de5d 100644 --- a/src/libs/robottools/rthumandriver.cpp +++ b/src/libs/robottools/rthumandriver.cpp @@ -1160,6 +1160,17 @@ static void common_drive(const int index, tCarElt* car, tSituation *s) } car->_steerCmd = leftSteer + rightSteer; + + /* Force feedback hack */ + float force = car->_steerTq * 32760 * 5; + + if (force > 32760) force = 32760; + if (force < -32760) force = -32760; + + //GfOut("force = %d\n", car->_steerTq); + + gfctrlJoyConstantForce(int((cmd[CMD_LEFTSTEER].val) / GFCTRL_JOY_NUMBER), abs((int)force), force < 0 ? 9000 : 27000 ); + //gfctrlJoyRumble(int((cmd[CMD_LEFTSTEER].val) / GFCTRL_JOY_NUMBER), 0.9); #define GLANCERATE 3 // speed at which the driver turns his head, ~1/3s to full glance newGlance = car->_glance; diff --git a/src/libs/tgfclient/control.cpp b/src/libs/tgfclient/control.cpp index 22733b92..11a0ccbc 100644 --- a/src/libs/tgfclient/control.cpp +++ b/src/libs/tgfclient/control.cpp @@ -347,7 +347,7 @@ gfctrlJoyInit(void) if (!Haptics[index]) { GfLogInfo("Joystick %d does not support haptic\n", index); break; -#if 0 +#if 1 } else { // add an CF effect on startup gfctrlJoyConstantForce(index, 50000, 9000); @@ -358,7 +358,7 @@ gfctrlJoyInit(void) if (SDL_HapticRumbleSupported(Haptics[index]) == SDL_TRUE) { if (SDL_HapticRumbleInit(Haptics[index]) != 0) GfLogError("Couldn't init rumble on joystick %d: %s\n", index, SDL_GetError()); -#if 0 +#if 1 else gfctrlJoyRumble(index, 0.5); #endif