hal_joystick − (DEPRECATED) control HAL pins with a joystick |
hal_joystick [-d device] [-p prefix] |
hal_joystick is deprecated. Use hal_input(1) instead. hal_joystick will be removed from a future version of emc. hal_joystick allows a joystick to generate HAL (Hardware Abstraction Layer) signals. Although not a hard realtime component, it is quite responsive under moderate system load. It provides analog (float) HAL pins for each joystick axis, and digital (bit) pins for each joystick button or trigger. |
-d device |
use device as the joystick device (default is /dev/input/js0). |
-p prefix |
use prefix for the HAL pin names (default is "joystick.0"). Note that changing the prefix also changes the component name from its default of "hal_joystick" to the new prefix. If you are loading hal_joystick with "halcmd loadusr -W", you will need to use the -Wn variant, and specify the new prefix as the component name. However, this still does not avoid race conditions between creating and connecting pins; see the section BUGS. |
hal_joystick runs forever until interrupted with SIGINT or SIGTERM. Normally it would be invoked as hal_joystick & to run in the background. For each joystick axis, it exports a HAL float pin called "<prefix>.axis.<N>" where N is an integer, starting at zero. The value of the pin will range from -1.0 to +1.0 as the axis is moved thru its range of motion. For each joystick button, it exports a HAL bit pin called "<prefix>.button.<M>" where M is also an integer starting at zero. The mapping of axis and buttons to N and M are joystick dependent, as is the direction of motion that results in positive values of the axis pin. hal_joystick uses the numbering and direction that is reported by the Linux joystick driver. For modern USB or other digital joysticks, the Linux driver figures out the number of axis and buttons automatically. For older analog joysticks, the driver may need configured by the user. See Linux documentation for more details. Once the Linux driver is properly configured, the HAL driver will configure itself to match automatically. |
hal_input(1) |
hal_joystick is incompatible with the way that halcmd waits for components to be ready. This leads to race conditions when connecting signals to hal_joystick’s pins. Perhaps the analog axes should have a "scale" parameter that could be used to scale the -1.0 to +1.0 range to whatever the user needs. It would also allow the direction of an axis to be reversed by using a negative scale. This can already be done using a HAL scale block, but a built-in scale parameter would be more convenient. |
Written by John Kasunich, as part of the Enhanced Machine Controller (EMC) project. |
Report bugs to jmkasunich AT users DOT sourceforge DOT net |
Copyright © 2003 John Kasunich. |