==============================================================================
Useful information about the SpaceOrb and driving software.
Mark Harris June '98
==============================================================================
For information on running under Windows, go to NT code.
The SpaceOrb was picked up by Erling, and has a 6-degrees-of-freedom
ball mounted on a nice handset with 6 buttons. It's going to be great for O.
The device is manaufactured by Spacetec, and in Sweden they are
distributed by X-Frame in Stockholm.
With a lot of help from some stuff on the web by Brett Viren
I have written a driving routine that generates X events that can be
interpreted by other X programs, including O.
I will soon modify 'joy' to be able to use the id tag (77,88 or 99)
to distinguish joysticks, but currently the test program is called 'job'.
The unit can be held horizontally or vertically, but then the correspondence
between its axes and those of the model change, and to compensate for this
one can switch between modes by simultaneously pressing buttons C, D and E,
or C, D and F.
There is a reset button on the bottom used to set the zero point,
and holding down buttons A, B and then C together quits the driving routine.
Any non-resting state causes data to be transmitted at least every 100ms,
and when resting a confirmational message is send once per second.
The X routine is called spaceorb.c, and compiles on DEC Alphas.
The name of the the terminal port is read from the env variable JOYSTICK_PORT,
and is probably "/dev/tty00", at least on the DEC Alphas.
Ideally the driver should be called from the application program,
but for testing, you can run /home/markh/joy/spaceorb in any window,
and the X events will be picked up by whichever window the mouse is in.
There is a link to the latest version in /usr/local/bin on arcturus,
so you should be able to simply type 'spaceorb' on this machine.
Useful runtime options include :
'c' to see confirmation of data being sent
'n' to change to new motion scale factor from the default value of 6.
'h' to get help on the less useful runtime options
You will even find an O emulator in the same directory, called simply 'job'.
Incorporating into existing code
================================
You need to call the driving program something like :
--------------------------------------------
fork_pid = fork();
if (fork_pid == 0) {
execlp("spaceorb","spaceorb",0,0);
exit();
}
--------------------------------------------
Then it can be killed later with :
--------------------------------------------
kill (fork_pid,SIGKILL);
--------------------------------------------
The X event is dealt with as follows :
--------------------------------------------
while (1) {
XNextEvent(display,&my_event);
switch (my_event.type) {
case ClientMessage:
x = my_event.xclient.data.b[1];
y = my_event.xclient.data.b[2];
break;
}
}
--------------------------------------------
The new data structures
=======================
The data arrives in 'my_event' as follows :
my_event.xclient.data.b[byte]
byte contents
---- --------
0 Internal use
1 The rotational component about X (-64 to +64)
2 The rotational component about Y (-64 to +64)
3 The translational component in X (-64 to +64)
4 The translational component in Y (-64 to +64)
5 The rotational component about Z (-64 to +64)
6 The translational component in Z (-64 to +64)
7 Button C (0 or 1)
8 Button D (0 or 1)
9 Button F (0 or 1)
10 Button E (0 or 1)
11 Button B (0 or 1)
12 Button A (0 or 1)
13-18 undefined
19 99 (identifies client message as coming from spaceorb)
Mark Harris 1998