Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

JoystickManager Class Reference

Collaboration diagram for JoystickManager:
[legend]
List of all members.

Detailed Description

Reads inputs from the joystick - via version.

Definition at line 15 of file joystickManager.h.

Public Types

enum  Status {
  LISTENING = 2,
  INITIALIZE = 3,
  CLOSED = 0,
  ERROR = -2,
  OPEN = 1
}
 enumeration for the status of the JoystickManager More...


Public Member Functions

int startJoystickCtrl ()
 calls the thread to begin pulling values from the joystick

int stopJoystickCtrl ()
 stop pulling values from the joystick

void setStatus (Status newStatus)
 set the status of the joystick

void highStickCheck ()
 starts the thread to check if the joystick is centered properly and sets the status of the joystick

void setInitWheel (int value)
 set the value of the joystick wheel

void convertToSC (int x, int y, int factor)
 convert joystick inputs to the speed controller commands

void setXAxis (int x)
 set the xAxis

void setYAxis (int y)
 set the yAxis

void setMaxSpeed (int spd)
 set the max speed the robot should go

void spin (int x, int y, int factor)
 make the robot spin in place

Status getStatus ()
 get the status of the Joystick Manager

int getfd ()
 get the file descriptor for the joystick Manager thread

unsigned char getAxes ()
 returns how many axis' are on the joystick

unsigned char getButtons ()
 returns how many buttons are on the joystick

int getInitWheel ()
 get the value of the initWheel

int getXAxis ()
 get the current value of the xAxis

int getYAxis ()
 get the current value of the yAxis

int getMaxSpeed ()
 read the value that the max speed controller speed is sent to


Static Public Member Functions

JoystickManagertheInstance ()
 returns the singleton instance of the JoystickManager

void highStickThread ()
 Thread function to check if the joystick is centered.

void joystickCtrl ()
 thread function to the pull values from the joystick


Protected Member Functions

 JoystickManager ()
 Gets the joystick ready to use and checks to make sure it is not off center startJoystickCtrl must be called to acutally use the joystick.

 ~JoystickManager ()
 Destructor for the JoystickManager.


Private Attributes

pthread_t joystickThread
 Thread for pulling data from the joystick.

int jsfd
 File descriptor for the joystick.

unsigned char axes
 number of axes'

unsigned char buttons
 number of buttons

int initWheel
 value of the initWheel

int xAxis
 The current xAxis value.

int yAxis
 The current yAxis value.

int maxSpeed
 The max speed set by the user 1-127.


Static Private Attributes

Status status
 Status of the JoystickManager.

SysLogsystemLogger
 Reference to the systemLogger.

RoboteqSCspeedCtrl
 Reference to the speedController.


Member Enumeration Documentation

enum JoystickManager::Status
 

enumeration for the status of the JoystickManager

Enumeration values:
INITIALIZE  Passed the high stick test.
CLOSED  Joystick closed.
ERROR  Error opening the joystick.
OPEN  Joystick opened.

Definition at line 20 of file joystickManager.h.

Referenced by getStatus().


Member Function Documentation

void JoystickManager::convertToSC int  x,
int  y,
int  factor
 

convert joystick inputs to the speed controller commands

Parameters:
x the x axis on the joystick
y the y axis on the joystick
factor in the max speed setting

unsigned char JoystickManager::getAxes  )  [inline]
 

returns how many axis' are on the joystick

Return values:
the number of axes

Definition at line 129 of file joystickManager.h.

References axes.

unsigned char JoystickManager::getButtons  )  [inline]
 

returns how many buttons are on the joystick

Return values:
the number of buttons

Definition at line 135 of file joystickManager.h.

References buttons.

int JoystickManager::getfd  )  [inline]
 

get the file descriptor for the joystick Manager thread

Return values:
1 on success -1 on error

Definition at line 123 of file joystickManager.h.

References jsfd.

int JoystickManager::getInitWheel  )  [inline]
 

get the value of the initWheel

Return values:
the value of the initWheel

Definition at line 141 of file joystickManager.h.

References initWheel.

int JoystickManager::getMaxSpeed  )  [inline]
 

read the value that the max speed controller speed is sent to

Return values:
the maxSpeed

Definition at line 159 of file joystickManager.h.

References maxSpeed.

Status JoystickManager::getStatus  )  [inline]
 

get the status of the Joystick Manager

Return values:
the status of the joystickManager

Definition at line 117 of file joystickManager.h.

References status, and Status.

int JoystickManager::getXAxis  )  [inline]
 

get the current value of the xAxis

Return values:
the current value of the XAxis

Definition at line 147 of file joystickManager.h.

References xAxis.

int JoystickManager::getYAxis  )  [inline]
 

get the current value of the yAxis

Return values:
the current value of the yAxis

Definition at line 153 of file joystickManager.h.

References yAxis.

void JoystickManager::setInitWheel int  value  ) 
 

set the value of the joystick wheel

Parameters:
value of the wheel

void JoystickManager::setMaxSpeed int  spd  ) 
 

set the max speed the robot should go

Parameters:
spd speed

void JoystickManager::setStatus Status  newStatus  ) 
 

set the status of the joystick

Parameters:
newStatus to change the status to

void JoystickManager::setXAxis int  x  ) 
 

set the xAxis

Parameters:
x axis value

void JoystickManager::setYAxis int  y  ) 
 

set the yAxis

Parameters:
y axis value

void JoystickManager::spin int  x,
int  y,
int  factor
 

make the robot spin in place

Parameters:
x axis
y axis
factor of the init wheel

int JoystickManager::startJoystickCtrl  ) 
 

calls the thread to begin pulling values from the joystick

Return values:
1 on success -1 on error

int JoystickManager::stopJoystickCtrl  ) 
 

stop pulling values from the joystick

Return values:
1 on success -1 on error

JoystickManager* JoystickManager::theInstance  )  [static]
 

returns the singleton instance of the JoystickManager

Return values:
instance of the JoystickManager


The documentation for this class was generated from the following file:
Generated on Fri Mar 25 23:48:45 2005 for CS498EmbeddedSystemsProgramming by doxygen 1.3.6