Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

hwInterface Class Reference

Short Description. More...

#include <hw_interface.h>

List of all members.

Public Types

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

Public Member Functions

 hwInterface (int write, const char *servo_dev="/dev/ttyS1")
 Short Description.
 ~hwInterface (void)
 Short Description.
void readStatus (void)
 Short Description.
void writeControl (void)
 Short Description.
void wait (void)
 Short Description.
void reset (void)
 Sends signal to MCU code telling it to reset.
int encTicks (int encNum)
 returns the cumulative number of ticks a wheel has moved
int encTicksFR (void)
 Short Description.
int encTicksFL (void)
 Short Description.
int encTicksBR (void)
 Short Description.
int encTicksBL (void)
 Short Description.
int irValueFR (void)
 Returns raw a2d value from front right IR sensor.
int irValueFL (void)
 Returns raw a2d value from front right IR sensor.
int getSteeringA2DValue (void)
 Returns raw a2d value from TI A2D sensor (currently mapped to a2d[7]).
int a2d (int adNum)
 returns the A2D value for a certain input
float getAngle (void)
 return the current steering angle
void setAngle (float angle)
 Short Description.
void setSteeringValue (int value)
 Allows setting steering servo value directly.
void setSCPower (float power)
 Short Description.
void setAdjustedSCPower (float power)
 Sets speed controller power output.
void setSCValue (int value)
 Short Description.
void setShiftValue (int value)
void safeStop (void)
 Short Description.

Static Public Attributes

static const int ticksPerRevolution = 540*4
static const double ticksPerMeter = 3951.0979
static const double metersPerTick = 1.0 / 3951.0979
static const double axleLength = 0.37465

Protected Attributes

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


Detailed Description

Short Description.

Long Description if necessary.

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

Definition at line 48 of file hw_interface.h.


Member Enumeration Documentation

anonymous enum
 

Enumerator:
FRONT_RIGHT 
FRONT_LEFT 
BACK_RIGHT 
BACK_LEFT 

Definition at line 78 of file hw_interface.h.


Constructor & Destructor Documentation

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

Short Description.

Long Description if necessary.

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

Definition at line 31 of file hw_interface.cpp.

References driver_fd, servo_fd, and writeEn.

hwInterface::~hwInterface void   ) 
 

Short Description.

Long Description if necessary.

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

Definition at line 95 of file hw_interface.cpp.

References driver_fd, safeStop(), servo_fd, and writeEn.


Member Function Documentation

int hwInterface::a2d int  adNum  )  [inline]
 

returns the A2D value for a certain input

Long Description if necessary.

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

Definition at line 235 of file hw_interface.h.

References status_t::a2d, and status.

int hwInterface::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 115 of file hw_interface.h.

References status_t::encoder, and status.

Referenced by encSum(), Controller::encSum(), and main().

int hwInterface::encTicksBL void   )  [inline]
 

Short Description.

Long Description if necessary.

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

Definition at line 176 of file hw_interface.h.

References BACK_LEFT, status_t::encoder, and status.

Referenced by main(), and Controller::run().

int hwInterface::encTicksBR void   )  [inline]
 

Short Description.

Long Description if necessary.

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

Definition at line 161 of file hw_interface.h.

References BACK_RIGHT, status_t::encoder, and status.

Referenced by main(), and Controller::run().

int hwInterface::encTicksFL void   )  [inline]
 

Short Description.

Long Description if necessary.

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

Definition at line 146 of file hw_interface.h.

References status_t::encoder, FRONT_LEFT, and status.

Referenced by main(), and Controller::run().

int hwInterface::encTicksFR void   )  [inline]
 

Short Description.

Long Description if necessary.

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

Definition at line 131 of file hw_interface.h.

References status_t::encoder, FRONT_RIGHT, and status.

Referenced by main(), and Controller::run().

float hwInterface::getAngle void   )  [inline]
 

return the current steering angle

Long Description if necessary.

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

Definition at line 251 of file hw_interface.h.

References Servo::getAngle(), and steeringServo.

int hwInterface::getSteeringA2DValue void   )  [inline]
 

Returns raw a2d value from TI A2D sensor (currently mapped to a2d[7]).

The A2D is currently running in 128HZ with 12 bits of resolution. The Analog sensor can measure negative voltages, but the POT of the servo shouldn't produce any negative voltages

Returns:
<raw a2d value -2048 to 2047 from TI I2C A2D>
Author:
<Derek>

Definition at line 219 of file hw_interface.h.

References status_t::a2d, and status.

Referenced by main(), and Controller::run().

int hwInterface::irValueFL void   )  [inline]
 

Returns raw a2d value from front right IR sensor.

Returns:
<raw a2d value 0 to ~32000>
Author:
<Derek>

Definition at line 202 of file hw_interface.h.

References status_t::a2d, and status.

Referenced by main().

int hwInterface::irValueFR void   )  [inline]
 

Returns raw a2d value from front right IR sensor.

Returns:
<raw a2d value 0 to ~32000>
Author:
<Derek>

Definition at line 189 of file hw_interface.h.

References status_t::a2d, and status.

Referenced by main().

void hwInterface::readStatus void   ) 
 

Short Description.

Long Description if necessary.

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

Definition at line 174 of file hw_interface.cpp.

References driver_fd, MCU_READ_STATUS, and status.

Referenced by main(), and Controller::run().

void hwInterface::reset void   ) 
 

Sends signal to MCU code telling it to reset.

Reset encoder values on truck, doesn't reset steering angle or speed controller settings. This function waits about 30ms for reset operation to complete

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

Definition at line 218 of file hw_interface.cpp.

References driver_fd, and MCU_RESET.

Referenced by Controller::Controller(), Daemon::Daemon(), main(), and stopAll().

void hwInterface::safeStop void   ) 
 

Short Description.

Long Description if necessary.

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

Definition at line 117 of file hw_interface.cpp.

References setSCPower().

Referenced by ~hwInterface().

void hwInterface::setAdjustedSCPower float  power  ) 
 

Sets speed controller power output.

The Traxxis speed controller won't do anything will low output values, (it has a high "minimum drive" setting). This means that it makes it difficuly to move the motors at low speed. This fucnction attempts to adjust for this discrpency by alternating the speed controller between on and off values. This works better but is not perfect because the motors make jerky movements. For this fucnction to operate correctly it must be called repeatedly, every 20 - 100ms, even if the target speed controller power is not changing

Parameters:
<power> <power output level of SC, -1 to 1>
Returns:
<void>
Author:
<Derek>

Definition at line 268 of file hw_interface.cpp.

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

Referenced by main(), and Controller::run().

void hwInterface::setAngle float  angle  )  [inline]
 

Short Description.

Long Description if necessary.

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

Definition at line 267 of file hw_interface.h.

References Servo::setAngle(), and steeringServo.

Referenced by Controller::kill(), main(), Controller::run(), and updateAngle().

void hwInterface::setSCPower float  power  ) 
 

Short Description.

Long Description if necessary.

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

Definition at line 241 of file hw_interface.cpp.

References SSC::setValue(), and speedController.

Referenced by Controller::kill(), main(), Controller::run(), safeStop(), stop(), stopAll(), updatePower(), and Daemon::~Daemon().

void hwInterface::setSCValue int  value  )  [inline]
 

Short Description.

Long Description if necessary.

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

Definition at line 301 of file hw_interface.h.

References SSC::setValue(), and speedController.

Referenced by main(), and Controller::run().

void hwInterface::setShiftValue int  value  )  [inline]
 

Definition at line 306 of file hw_interface.h.

References SSC::setValue(), and shiftingServo.

Referenced by main().

void hwInterface::setSteeringValue int  value  )  [inline]
 

Allows setting steering servo value directly.

With current SSC servo values can range from 0 to 254 but the steering has mechanical limits of appoximately between 30 to 215

Parameters:
<value> <ssc servo value between 0 and 254>
Returns:
<void>
Author:
<Derek>

Definition at line 285 of file hw_interface.h.

References SSC::setValue(), and steeringServo.

Referenced by main(), and Controller::run().

void hwInterface::wait void   ) 
 

Short Description.

Long Description if necessary.

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

Definition at line 195 of file hw_interface.cpp.

References driver_fd, and MCU_WAIT_FOR_NEXT_INT.

Referenced by Controller::Controller(), Controller::kill(), main(), Controller::run(), and Daemon::~Daemon().

void hwInterface::writeControl void   ) 
 

Short Description.

Long Description if necessary.

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

Definition at line 134 of file hw_interface.cpp.

References SSC::getNumber(), SSC::getValue(), servo_fd, shiftingServo, speedController, steeringServo, and writeEn.

Referenced by Controller::kill(), main(), Controller::run(), stop(), stopAll(), updateAngle(), updatePower(), and Daemon::~Daemon().


Member Data Documentation

const double hwInterface::axleLength = 0.37465 [static]
 

Definition at line 74 of file hw_interface.h.

Referenced by EncEstimator::update().

int hwInterface::driver_fd [protected]
 

Definition at line 51 of file hw_interface.h.

Referenced by hwInterface(), readStatus(), reset(), wait(), and ~hwInterface().

const double hwInterface::metersPerTick = 1.0 / 3951.0979 [static]
 

Definition at line 73 of file hw_interface.h.

Referenced by EncEstimator::update().

int hwInterface::servo_fd [protected]
 

Definition at line 52 of file hw_interface.h.

Referenced by hwInterface(), writeControl(), and ~hwInterface().

SSC hwInterface::shiftingServo [protected]
 

Definition at line 57 of file hw_interface.h.

Referenced by setShiftValue(), and writeControl().

SSC hwInterface::speedController [protected]
 

Definition at line 55 of file hw_interface.h.

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

status_t hwInterface::status [protected]
 

Definition at line 50 of file hw_interface.h.

Referenced by a2d(), encTicks(), encTicksBL(), encTicksBR(), encTicksFL(), encTicksFR(), getSteeringA2DValue(), irValueFL(), irValueFR(), and readStatus().

Servo hwInterface::steeringServo [protected]
 

Definition at line 56 of file hw_interface.h.

Referenced by getAngle(), setAngle(), setSteeringValue(), and writeControl().

const double hwInterface::ticksPerMeter = 3951.0979 [static]
 

Definition at line 72 of file hw_interface.h.

const int hwInterface::ticksPerRevolution = 540*4 [static]
 

Definition at line 71 of file hw_interface.h.

Referenced by printTicks().

float hwInterface::valueErr [protected]
 

Definition at line 59 of file hw_interface.h.

Referenced by setAdjustedSCPower().

int hwInterface::writeEn [protected]
 

Definition at line 53 of file hw_interface.h.

Referenced by hwInterface(), writeControl(), and ~hwInterface().


The documentation for this class was generated from the following files:
Generated on Fri Sep 1 14:26:01 2006 for Raptor by  doxygen 1.4.4