Forums

Full Version: Joystick help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I can't seem to use my joystick properly in this game. I have an iMac g5 and a Logitech extreme 3D pro joystick. When I input the controls, the accelerate is making the steering go to the right and the braking is making the steering go to the left.
It sounds like it may not be picking up the Axis correctly. Do you have a gamepad or different joystick you can try it with to see if it behaves differently?
Make sure you do a calibration (Options->Controls->Joystick Options->Calibrate) and then try to reassign the joystick controls (Options->Controls->Assign Controls->Car Controls). Click on any existing joystick icons to delete the old control and then click the + button to add a new one. It should detect the control axis properly. If it's still detecting the wrong one, let use know.
When you calibrate your joystick, also note if one of the axes "shakes" erratically even when it's not moving. Sometimes this can cause the wrong axis to get assigned when you set them.
Ok I'll try all of those, thanks! Smile
thelusiv Wrote:When you calibrate your joystick, also note if one of the axes "shakes" erratically even when it's not moving. Sometimes this can cause the wrong axis to get assigned when you set them.
nevertheless, the algorithm used to detect which axis is moved doesn't seem very good...
I kinda get a problem looking like this one - calibration works, but seems not being saved, as every time I calibrate again, the boxes are alligned not in the middle, but the same again.
While in menu of the game, my highlighted menu option is jumping up and down all the time.
When I assign joystick controls it is not reacting to my moved axes, but some other. And even after that, when ingame testing my calibration, I only got forward movement making left turn the car - not as it was assigned (only one axe for testing).
Looks like the data from joystick is interpreted wrongly.

I got a Debian Etch netinst and a Saitek Cyborg 3DII USB joystick. Game is installed from distribution, not self downloaded. Joystick is working in other games.
I'll see what I can do to make the joystick code ignore weirdness...

uldics, make sure to wiggle all your axes a little bit during the calibration, for instance on my Logitech Wingman Rumblepad, I found that sometimes my slider thingy will wiggle between two values when I don't move it at all. This throws everything off in much the way you describe. I never use the slider and didn't even think about it being another axis I should worry about, so this kinda had me confused for a while.
I move all my 4 axes to expand the boxes, when they no more expand, I leave calibration. Do you mean I should move all axes all the calibration time and be so fast to press the leaving button while still moving axes?
No, just meant to make sure there's not another axis you're forgetting about. Sometimes certain buttons are analog for instance (some triggers). In my case it's a gain slider on the top right of the control, above the Y and Z buttons in this picture: (edit: picture is gone, search for images of Logitech Wingman RumplePad on Google)

It slides left to right. Sometimes when sitting perfectly still, my computer will show it jerking back and forth erratically. Moving it a little makes it better. This may not be your problem, it's just one that could cause the things you describe...

Can you look at the joystick values in a joystick tester program and see how it looks there? Maybe you can identify a problem better there, and I can get a better idea of how I can make sure it doesn't cause problems anymore.

Also, when you "draw the boxes" in the calibration screen what does it look like in the end? Is it any shape besides square - is there any white showing anymore? Could you post the contents of your ~/.vdrift/calibration file? Just the first few lines are fine, after it starts repeating "-0.1 0.1" you can cut it off.

By the way, if you want to try playing the game without the joystick in the meantime, edit your ~/.vdrift/VDrift.config file and set the line under "[ joystick ]" that says "calibrated = on" to "calibrated = off".
I have 4 axes and 14 buttons (including 4 way pow hat), all buttons are digital (2 positions - pressed or not pressed).
I kinda solved my axes problem with some axes after a lot of trying got assigned, the rest I wrote manually in config file, because assigning is almost random(not after my will). But now I can drive with joystick. One problem still is there: I have steering set to when I roll my joystick (left right), but it does not give full result (only about 80-90% of full scale) - I can only get full steering at max, when I roll AND twist my joystick. Twisting I have nothing about in my config nor have I assigned it to nothing. Just to add, that axes names in calibration and assigning menus are not the same - that was my first problem. Now I know what axes are where and it works.
It is still jumpy in menus, sometimes setting some settings before I can get out of current menu (recording race, steering compensation, deadzones, auto clutch - all what can be assigned just by moving with axes, not pushing any buttons).
Boxes in calibration screen are almost from top and left side to a bit over middle. And shape is square. And there is white left after no more expanding.
~/.vdrift/calibration file is:
# VDrift joystick calibration file.
#Each line is an axis with the format [min] [max]

-0.824768 0.206177
-0.876312 0.195862
-0.969086 0.144318
-0.979401 0.329895
-0.1 0.1
-0.1 0.1
-0.1 0.1
And I want joystick, button steering is almost impossible with powerful engines, spinning at max and no traction --> no control. But thanks for the tip.
In the Subversion repository for the game, we have TCS (traction control), ABS (antilock braking), automatic shifting, as well as something called button delay, all of which combine to make driving with the keyboard or joystick buttons much easier. Also, in the last version as well as in SVN, you can race using the mouse as a control. However it seems you found a solution by editing the controls file by hand. If you also set calibrated=off in VDrift.config, I think it will still use the calibration in-game, but will make the menu much easier to use.

Now on to your joystick calibration. It seems like your joystick is being prevented from covering its full range, or it's off-center. Does the box stop moving even though you continue moving the axis? Or does the calibration cursor start somewhere other than the middle of the white box?

edit: after searching the web for your joystick and seeing that it's not the gamepad type as I expected but a flight-sim style single stick, I wonder, how does this joystick have 4 axes? Is there one axis per direction, rather than one for left/right and one for up/down? If this is the case I think I can devise a way to fix this...I'll see what I can do.

I know why your joystick causes erratic movement in the menus. The menu joystick movement code does not yet take the calibration data into account. So when your joystick is at rest, which means it's probably around -0.4 or something, the menu thinks you moved the axis 40% to the left, indicating that you are moving it when you're really not. This also explains why it thinks you're moving axes you're really not, in the assign controls menu.

I'll see what I can do to get both of these portions of the GUI to account for calibration. In the mean time, if you're running Linux, one thing you could do is run the program jscalibrator, which will calibrate your joystick external to the game, and VDrift will see the proper values.
After a lot of searching on the net, I found out, how to get around the actual problem - jscalibrator was not saving its data somehow. Now I just have to execute a script every time I start KDE and it sets my joystick as calibrated even if jscal -t /dev/input/js0 says it is not calibrated. Actions I took:
1. Run jscal -c /dev/input/js0 to calibrate my stick
2. Run jscal -p /dev/input/js0 to get correction values
2. Made a script with return of last command, looks like that:

#!/bin/bash
jscal -s 6,1,0,90,90,9418500,8658944,1,0,97,97,7780500,8388352,1,0,87,87,8134160,8012754,1,0,91,92,7354172,6795627,1,0,0,0,-2147483648,-2147483648,1,0,0,0,-2147483648,-2147483648 /dev/input/js0

3. The script was a text file made with kate (pico, vi or whatever), made it executable and placed in ~/.kde/Autostart
I hope it will run every time I start my PC. But it works when I run it by hand. Now all my axes are fully usable, and the car is much easier to steer (actually it was off center before, which I compensated with deadzone, felt wrong). And at calibration, it starts in the middle and expands 100%.
I'm glad you found a solution. I'd like to make it so that it "just works" though so I have a few questions for you.

1. When you move your joystick directly left from rest, does only one axis move, or more than one? How much does each one change?
2. What are the axis values when your joystick is at rest (center)?
3. The way that VDrift gets a decimal number is by dividing the value from the joystick by 32768, since SDL gives us an integer value between 0 and 32K. At least I assume it's always between 0 and 32K. I know some joysticks have axes with different levels of accuracy, and I am not entirely sure if SDL makes everything equal to us or not. Any idea what kind of integer values your joystick returns?

Thanks Smile