fhwInterface Class Reference

A Fake Hardware Interface. More...

#include <fhw_interface.h>

List of all members.

Public Types

enum  { FRONT_RIGHT = 0, FRONT_LEFT = 1, BACK_RIGHT = 2, BACK_LEFT = 3 }

Public Member Functions

 fhwInterface (int write, const char *servo_dev="/dev/ttyS1")
 Constructor.
 ~fhwInterface (void)
 Destructor.
void readStatus (void)
 Fake Read Status.
void writeControl (void)
 Fake Writing to share memory.
void wait (void)
 Simulate hwInterface Wait.
void reset (void)
 Simulate hwInterface Reset.
int encTicks (int encNum)
 returns the cumulative number of ticks a wheel has moved
int encTicksFR (void)
 Reads Encoder Value for Front Right Encoder.
int encTicksFL (void)
 Reads Encoder Value for Front Left Encoder.
int encTicksBR (void)
 Reads Encoder Value for Back Right Encoder.
int encTicksBL (void)
 Reads Encoder Value for Back Left Encoder.
int a2d (int adNum)
 returns the A2D value for a certain input
float getAngle (void)
 return the current steering angle
void setAngle (float angle)
 Set Truck Steering Angle.
void setSCPower (float power)
 Set Speed Controller Power.
void setAdjustedSCPower (float power)
 This function linearizes the SC power output.
void setSCValue (int value)
 Set speed Controller Value.
void safeStop (void)
 Stop Speed Controller.

Protected Attributes

status_t status
int driver_fd
int servo_fd
int writeEn
SSC speedController
Servo steeringServo
SSC shiftingServo
float valueErr


Detailed Description

A Fake Hardware Interface.

This is a fake Hardware interface that does not require being on the truck. This is written so that we can test components that depend on this class without having to load everything on to the truck.

Author:
Feanil Patel

Definition at line 47 of file fhw_interface.h.


Member Enumeration Documentation

anonymous enum
 

Enumerator:
FRONT_RIGHT 
FRONT_LEFT 
BACK_RIGHT 
BACK_LEFT 

Definition at line 70 of file fhw_interface.h.


Constructor & Destructor Documentation

fhwInterface::fhwInterface int  write,
const char *  servo_dev = "/dev/ttyS1"
 

Constructor.

Parameters:
write indicate whether or not the interface can write to shared memory
servo_dev the location of the servo device to write to
Author:
Feanil Patel

Definition at line 30 of file fhw_interface.cpp.

References driver_fd, servo_fd, and writeEn.

fhwInterface::~fhwInterface void   ) 
 

Destructor.

Author:
Feanil Patel

Definition at line 53 of file fhw_interface.cpp.


Member Function Documentation

int fhwInterface::a2d int  adNum  )  [inline]
 

returns the A2D value for a certain input

Parameters:
adNum a numeric id for the a2d whose value you want
Returns:
an integer a2d value
Author:
Feanil Patel

Definition at line 166 of file fhw_interface.h.

References status_t::encoder, and status.

int fhwInterface::encTicks int  encNum  )  [inline]
 

returns the cumulative number of ticks a wheel has moved

Long Description if necessary.

Parameters:
<parameter_name> <parameter_descreption>
Returns:
<information on="" what="" is="" being="" returned>="">
Author:
<author name>="">

Definition at line 100 of file fhw_interface.h.

References status_t::encoder, and status.

int fhwInterface::encTicksBL void   )  [inline]
 

Reads Encoder Value for Back Left Encoder.

Long Description if necessary.

Returns:
an integer value for the number on encoder ticks counted
Author:
Feanil Patel

Definition at line 152 of file fhw_interface.h.

References BACK_LEFT, status_t::encoder, and status.

int fhwInterface::encTicksBR void   )  [inline]
 

Reads Encoder Value for Back Right Encoder.

Returns:
an integer value for the number on encoder ticks counted
Author:
Feanil Patel

Definition at line 138 of file fhw_interface.h.

References BACK_RIGHT, status_t::encoder, and status.

int fhwInterface::encTicksFL void   )  [inline]
 

Reads Encoder Value for Front Left Encoder.

Returns:
an integer value for the number on encoder ticks counted
Author:
Feanil Patel

Definition at line 126 of file fhw_interface.h.

References status_t::encoder, FRONT_LEFT, and status.

int fhwInterface::encTicksFR void   )  [inline]
 

Reads Encoder Value for Front Right Encoder.

Returns:
an integer value for the number on encoder ticks counted
Author:
Feanil Patel

Definition at line 114 of file fhw_interface.h.

References status_t::encoder, FRONT_RIGHT, and status.

float fhwInterface::getAngle void   )  [inline]
 

return the current steering angle

Returns:
floating point angle in degrees.
Author:
Feanil Patel

Definition at line 180 of file fhw_interface.h.

References Servo::getAngle(), and steeringServo.

void fhwInterface::readStatus void   ) 
 

Fake Read Status.

A stuf for the readStatus function to emulate the hwInterface class.

Author:
Feanil Patel

Definition at line 97 of file fhw_interface.cpp.

void fhwInterface::reset void   ) 
 

Simulate hwInterface Reset.

Zero out the a2d and encoder values as if the truck was being reset.

Author:
Feanil Patel

Definition at line 123 of file fhw_interface.cpp.

References status_t::a2d, status_t::encoder, status, and wait().

void fhwInterface::safeStop void   ) 
 

Stop Speed Controller.

Author:
Feanil Patel

Definition at line 64 of file fhw_interface.cpp.

References setSCPower().

void fhwInterface::setAdjustedSCPower float  power  ) 
 

This function linearizes the SC power output.

Parameters:
power a floating point value between -1 and 1 that indicates the new power setting
Returns:
<information on="" what="" is="" being="" returned>="">
Author:
<author name>="">

Definition at line 162 of file fhw_interface.cpp.

References SSC::setValue(), speedController, and valueErr.

void fhwInterface::setAngle float  angle  )  [inline]
 

Set Truck Steering Angle.

Parameters:
angle the steering angle to set in degrees
Author:
Feanil Patel

Definition at line 193 of file fhw_interface.h.

References Servo::setAngle(), and steeringServo.

void fhwInterface::setSCPower float  power  ) 
 

Set Speed Controller Power.

Parameters:
power a floating point value between -1 and 1 that indicates the new power setting
Author:
Feanil Patel

Definition at line 145 of file fhw_interface.cpp.

References SSC::setValue(), and speedController.

Referenced by safeStop().

void fhwInterface::setSCValue int  value  )  [inline]
 

Set speed Controller Value.

Parameters:
value the servo value to set betwoon 0 and 254
Author:
Feanil Patel

Definition at line 206 of file fhw_interface.h.

References SSC::setValue(), and speedController.

void fhwInterface::wait void   ) 
 

Simulate hwInterface Wait.

Sleep for half a second.

Author:
Feanil Patel

Definition at line 110 of file fhw_interface.cpp.

Referenced by reset().

void fhwInterface::writeControl void   ) 
 

Fake Writing to share memory.

Change Local data values to qusi-simulate what might happen to them after control has been written.

Author:
Feanil Patel

Definition at line 78 of file fhw_interface.cpp.

References status_t::a2d, status_t::encoder, SSC::getValue(), speedController, and status.


Member Data Documentation

int fhwInterface::driver_fd [protected]
 

Definition at line 50 of file fhw_interface.h.

Referenced by fhwInterface().

int fhwInterface::servo_fd [protected]
 

Definition at line 51 of file fhw_interface.h.

Referenced by fhwInterface().

SSC fhwInterface::shiftingServo [protected]
 

Definition at line 56 of file fhw_interface.h.

SSC fhwInterface::speedController [protected]
 

Definition at line 54 of file fhw_interface.h.

Referenced by setAdjustedSCPower(), setSCPower(), setSCValue(), and writeControl().

status_t fhwInterface::status [protected]
 

Definition at line 49 of file fhw_interface.h.

Referenced by a2d(), encTicks(), encTicksBL(), encTicksBR(), encTicksFL(), encTicksFR(), reset(), and writeControl().

Servo fhwInterface::steeringServo [protected]
 

Definition at line 55 of file fhw_interface.h.

Referenced by getAngle(), and setAngle().

float fhwInterface::valueErr [protected]
 

Definition at line 58 of file fhw_interface.h.

Referenced by setAdjustedSCPower().

int fhwInterface::writeEn [protected]
 

Definition at line 52 of file fhw_interface.h.

Referenced by fhwInterface().


The documentation for this class was generated from the following files:
Generated on Mon Jul 17 16:44:57 2006 for Raptor by  doxygen 1.4.6