Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Author Topic: Joystick calibration in Linux  (Read 1253 times)

johanzebin

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 3
    • View Profile
Joystick calibration in Linux
« on: October 06, 2009, 02:01:24 AM »

Hi everybody,
this is my 1st post, and it really is about a basic problem.
For a research project, I'm currently programming a psychology experiment using python-ogre in Linux (Ubuntu 8.10), in which seems to be embedded OIS 1.2.

I run into a problem with a Joystick that needs calibration (the y-axis' "default output" only ranges from about 20 to 110 instead 0-255).
Calibration using either jscal or jscalibrator works fine, however it doesn't seem to have any effect on OIS. From what I learned so far, this might be due to OIS using directly the /dev/input/event%d device, which might be not configurable in a way /dev/input/js%d would be.
Now I'm stuck - would I have to write a calibration routine myself or is there a "hidden way" somewhere (in OIS itself?).
PS: I also tried the my very same program in windowsXP, which worked perfectly...
Logged

johanzebin

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 3
    • View Profile
Re: Joystick calibration in Linux
« Reply #1 on: October 07, 2009, 12:24:47 PM »

Well, just before writing a probably quite clumsy program for calibration, I found the build-option (in ReadMe.txt  ::)) ./configure --disable-joyevents --- Uses /dev/input/jsX instead of /dev/input/eventX
I'll try that first...
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
Re: Joystick calibration in Linux
« Reply #2 on: October 07, 2009, 04:44:19 PM »

Well, that system is pretty much depreciated. The old JS API of Linux does not accommodate much, and certainly not force feedback. I planned to remove those files - guess I haven't gotten around to it if they are still there.

I'm not sure what you mean about a y-axis issue. OIS axes should be in the range of -32k to 32k. There may be a scaling issue within OIS for Joystick axes that don't adhere to that on Linux, it would be better if you added some logging code in the Joystick event classes and dumped out what the raw values are for your device.

As for calibration, there is no inbuilt system for OIS to calibrate devices. On Windows, it is done by control panel, and I'm not aware of a Linux method for calibrating with event structure. However, all calibration is really supposed to do is move the deadzone, not really adjust the ranges of axes. Mostly, games should account for deadzones themselves, either ignoring low values, and/or letting the user calibrate values via an in-game system.
Logged

johanzebin

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 3
    • View Profile
Re: Joystick calibration in Linux
« Reply #3 on: October 08, 2009, 10:05:18 AM »

Ok, I checked the output of my python-wrapped code (python-ogre) as well as from demos/OISConsole.cpp (ConsoleApp), built both with and without --disable-joyevents. The joystick under investigation (Logitech Inc. WingMan Extreme Digital 3D) is connected via a Gameport/USB adaptor.

First of all, there is no difference between the python-wrapped and the native C++ version of OIS.
Secondly, even the ConsoleApp's version with enabled --disable-joyevents switch isn't affected by neither jscalibrator (which uses libjsw somehow) nor jscal (for which I don't know where it applies changes). Calibration success as such was verified by jstest... by success I mean the range of the axes being [-2^15, +2^15 -1].

I'm not sure what you mean about a y-axis issue. OIS axes should be in the range of -32k to 32k. There may be a scaling issue within OIS for Joystick axes that don't adhere to that on Linux, it would be better if you added some logging code in the Joystick event classes and dumped out what the raw values are for your device.

OIS output ranges of this joystick are annoyingly persistent at [-24055, +27321] for the X-Axis and [-27579, 20018] for the Y-Axis...
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
Re: Joystick calibration in Linux
« Reply #4 on: October 09, 2009, 07:00:39 AM »

These are reasons that most applications don't expect values of joystick axes to be able to reach the extents of the ranges. Most apps simply check for the axes moving in some direction and call that a motion (ie > +- 10k). Helps avoid controllers that drift/fluctuate when at rest or that never reach the 32k mark. One reason why joysticks make lousy mice - there just not always accurate.
Logged