00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00029
00030
00039 #ifndef CARMEN_JOYCTRL_H
00040 #define CARMEN_JOYCTRL_H
00041
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045
00046 #include <carmen/carmen.h>
00047
00048 #include <sys/ioctl.h>
00049 #include <sys/types.h>
00050 #include <fcntl.h>
00051 #include <unistd.h>
00052 #include <stdlib.h>
00053 #include <linux/joystick.h>
00054
00055 #define CARMEN_JOYSTICK_DEVICE "/dev/js0"
00056 #define CARMEN_JOYSTICK_DEADSPOT 1
00057 #define CARMEN_JOYSTICK_DEADSPOT_SIZE 0.2
00058
00059 typedef struct {
00060 int fd;
00061 int nb_axes;
00062 int nb_buttons;
00063 int *axes;
00064 int *buttons;
00065 int deadspot;
00066 double deadspot_size;
00067 int initialized;
00068 } carmen_joystick_type;
00069
00070
00071 void carmen_set_deadspot(carmen_joystick_type *joystick, int on_off, double size);
00072
00073
00074
00075 int carmen_initialize_joystick(carmen_joystick_type *joystick);
00076
00077
00078
00079 int carmen_get_joystick_state(carmen_joystick_type *joystick);
00080
00081
00082 void carmen_close_joystick(carmen_joystick_type *joystick);
00083
00084
00085 void carmen_joystick_control(carmen_joystick_type *joystick, double max_tv,
00086 double max_rv, double *tv, double *rv);
00087
00088 #ifdef __cplusplus
00089 }
00090 #endif
00091
00092 #endif
00093