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

RoboteqSC Class Reference

List of all members.

Detailed Description

This class is responsible for opening, reading and controlling the roboteqAX2550 speed controller.

Definition at line 51 of file roboteqSC.h.

Public Types

enum  { baudrate = B9600 }
 The required baudrate for the speed Controller.

enum  status {
  OPEN = 1,
  CLOSED = 0,
  ERROR = -1
}
 The enumeration for the status of the speed controller. More...

enum  Motor {
  MOTOR0 = 0x41,
  MOTOR1 = 0x42,
  MOTOR0BKW = 0x61,
  MOTOR1BKW = 0x62
}
 Enumerations for both of the motors controlled by the speed controller. More...


Public Member Functions

status getStatus ()
 Get the status of the speed controller.

int openSC ()
 Open the speed controller so that it can be used.

int closeSC ()
 Close down the speed controller.

int setMotorSpeed (int motor, int speed)
 Set the motor speed.

int getPower (int motor)
 Query the amount of power supplied to a motor.

int getAmps (int motor)
 Query the amount of amps supplied to a motor.

int getControllerTemp ()
 Query the temperature of the heatsinks on the speed controller.

int convertTemp (int input)
 Converts between the raw speed controller output and degrees Cel.

int applyParam ()
 Apply a parameter change to the robot without restarting.

void resetController ()
 Reset the speed controller.

int readParamSetting (int param)
 Read one of the Parameter settings.

int setParam (int param, int value)
 Set a Param, note many paramets require the controller to be reset.

int sem_P ()
 enter a semaphore protected body of code

int sem_V ()
 exit a semaphore protected body of code

int openCommand ()
 open the controller from being in R/C or analog mode this will put the controller into RS232 watchDog mode

int getfd ()
 get the file descriptor for the serial connection


Static Public Member Functions

RoboteqSCtheInstance ()
 The function responsible for gaining access to the instance of the speed controller.

void watchDog ()
 the watchDog function for the speed controller sends a return character to the speed controller often enough to ensure a constand connection with it.


Protected Member Functions

 RoboteqSC ()
 Constructor for RoboteqSC class.

 ~RoboteqSC ()
 Destructor for RoboteqSC class.


Private Attributes

status SCStatus
 The status for the speed controller.

int fd
 The file descriptor for the speed controller.

termios oldttyS
 The old serial port settings.

termios newttyS
 The new serial port settings.

fd_set set
 fd_set for waiting for the returns from the controller

timeval tv
 timeout for waiting for values from the controller

pthread_t scThread
 thread for the watchdog function

int roboteqsv
 semaphore data for the speed controller


Member Enumeration Documentation

enum RoboteqSC::Motor
 

Enumerations for both of the motors controlled by the speed controller.

Enumeration values:
MOTOR0  Left Motor forward.
MOTOR1  Right Motor forward.
MOTOR0BKW  Left Motor Backwards.
MOTOR1BKW  Right Motor Backwards.

Definition at line 74 of file roboteqSC.h.

enum RoboteqSC::status
 

The enumeration for the status of the speed controller.

Enumeration values:
OPEN  The speed controller is opened.
CLOSED  The speed controller is closed.
ERROR  An error occured during operation.

Definition at line 62 of file roboteqSC.h.


Member Function Documentation

int RoboteqSC::applyParam  ) 
 

Apply a parameter change to the robot without restarting.

Return values:
1 on success
-1 on failure

int RoboteqSC::closeSC  ) 
 

Close down the speed controller.

Return values:
0 on success
-1 on error

int RoboteqSC::convertTemp int  input  ) 
 

Converts between the raw speed controller output and degrees Cel.

Parameters:
input - The output from the speed controller range 0 to 255
Return values:
The temp in Cel

int RoboteqSC::getAmps int  motor  ) 
 

Query the amount of amps supplied to a motor.

Parameters:
motor to query 0 for left 1 for right
Return values:
The number of amps applied to the motor 0 to 256

int RoboteqSC::getControllerTemp  ) 
 

Query the temperature of the heatsinks on the speed controller.

Return values:
The temperature of the heatsinks in Cel

int RoboteqSC::getfd  ) 
 

get the file descriptor for the serial connection

Return values:
file descriptor for the serial connection

int RoboteqSC::getPower int  motor  ) 
 

Query the amount of power supplied to a motor.

Parameters:
motor to query 0 for left 1 for right
Return values:
The power applied to the motor range 0 to 127

status RoboteqSC::getStatus  )  [inline]
 

Get the status of the speed controller.

Return values:
status of the speed controller

Definition at line 96 of file roboteqSC.h.

References SCStatus.

int RoboteqSC::openCommand  ) 
 

open the controller from being in R/C or analog mode this will put the controller into RS232 watchDog mode

Return values:
1 on success -1 on error

int RoboteqSC::openSC  ) 
 

Open the speed controller so that it can be used.

Return values:
1 on success
-1 on error

int RoboteqSC::readParamSetting int  param  ) 
 

Read one of the Parameter settings.

Parameters:
param to be read
Return values:
The current state of the param

int RoboteqSC::sem_P  ) 
 

enter a semaphore protected body of code

Return values:
1 on success 0 on error

int RoboteqSC::sem_V  ) 
 

exit a semaphore protected body of code

Return values:
1 on success 0 on error

int RoboteqSC::setMotorSpeed int  motor,
int  speed
 

Set the motor speed.

Parameters:
motor to set the speed on
speed to set the motor to range -127 to 127
motor to control 0 for left 1 for right
Return values:
1 on success
-1 on error

int RoboteqSC::setParam int  param,
int  value
 

Set a Param, note many paramets require the controller to be reset.

Parameters:
param to modify
value to set the parameter to. Please see the Roboteq documentation for these values
Return values:
1 on success
-1 on error or if the command value is invalid

RoboteqSC* RoboteqSC::theInstance  )  [static]
 

The function responsible for gaining access to the instance of the speed controller.

Return values:
the singleton instance of the RoboteqSC

void RoboteqSC::watchDog  )  [static]
 

the watchDog function for the speed controller sends a return character to the speed controller often enough to ensure a constand connection with it.

If this fuction stops and watchDog is enabled on the speed controller the speed controller will shutdown the motors everytime it does not receive a character in a one second period


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