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

Controller Class Reference

Short Description. More...

#include <controller.h>

List of all members.

Public Member Functions

 Controller (msg *daemon, std::ofstream &dataFile, const char *servo_serial_device)
int run (void)
 Short Description.
 Controller (msg *daemon, const char *servo_serial_device)
 Short Description.
int run (void)
 Controller (msg *daemon, const char *servo_serial_device)
int run (void)
 Controller (msg *daemon, const char *servo_serial_device)
int run (void)

Private Member Functions

int joyX (void)
 Short Description.
int joyY (void)
 Short Description.
int heartbeat (void)
int stop (void)
 Short Description.
int info (void)
 Short Description.
int kill (void)
 Short Description.
int gps (void)
 Short Description.
int setPower (void)
 Short Description.
int setPowerValue (void)
 Short Description.
int setAngle (void)
 Short Description.
int setAngleValue (void)
 Short Description.
int processMsgs (void)
 Short Description.
void sendAck (void)
 Short Description.
void sendNack (void)
 Short Description.
float calcAdjustedValue (float value, float &valueErr)
 Allows setting "fractional" values by returns values that fluctuates proportially between two consecutive integers.
int joyX (void)
int joyY (void)
int heartbeat (void)
int stop (void)
int info (void)
int kill (void)
int gps (void)
int gain (float &K)
 Short Description.
int speed (void)
 Short Description.
int processMsgs (void)
void sendAck (void)
void sendNack (void)
float encSum (hwInterface &truck_hw)
 Short Description.
int forward (void)
 Increase power output of engine Servo.
int back (void)
 Decrease power output of engine Servo.
int left (void)
 Turn wheel to the left.
int right (void)
 Turn wheel to the right.
int stop (void)
int kill (void)
int gps (void)
int processMsgs (void)
void sendAck (void)
void sendNack (void)
int processMsgs (void)
void sendAck (void)
void sendNack (void)

Private Attributes

hwInterface hw
msgdaemon
EncEstimator est
std::ofstream & f
int verbose
bool useAngleValue
float angle
float angleValue
float angleValueErr
bool usePowerValue
float power
float powerValue
float powerValueErr
int msecLeft
hwInterface truck_hw
msgdaemon
float targetVeloc
float veloc
float Kp
float Ki
float Kd
float errSum
int cyclesLeft
msgdaemon
int quit
msgdaemon
int ack_count
FILE * dataFile


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 15 of file controller.h.


Constructor & Destructor Documentation

Controller::Controller msg daemon,
std::ofstream &  dataFile,
const char *  servo_serial_device
 

Controller::Controller msg daemon,
const char *  serial_servo_device
 

Short Description.

Long Description if necessary.

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

Definition at line 14 of file controller.cpp.

References angle, cyclesLeft, errSum, Kd, Ki, Kp, hwInterface::reset(), targetVeloc, truck_hw, veloc, and hwInterface::wait().

Controller::Controller msg daemon,
const char *  servo_serial_device
 

Controller::Controller msg daemon,
const char *  servo_serial_device
 


Member Function Documentation

int Controller::back void   )  [private]
 

Decrease power output of engine Servo.

Long Description if necessary.

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

Definition at line 111 of file controller.cpp.

References msecLeft, power, POWER_DELTA, and sendAck().

float Controller::calcAdjustedValue float  value,
float &  valueErr
[private]
 

Allows setting "fractional" values by returns values that fluctuates proportially between two consecutive integers.

For example if this function is called continously with input an input value of 100.5, half the time the return value will be 100 and the other half of the time the return value will be 101. Over multiple calls the output value should average out to be 101.5

Parameters:
<value> <floating point="" value>="">
Returns:
<integer value>="">
Author:
<Derek>

Definition at line 433 of file controller.cpp.

Referenced by run().

float Controller::encSum hwInterface truck_hw  )  [private]
 

Short Description.

Long Description if necessary.

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

Definition at line 355 of file controller.cpp.

References hwInterface::BACK_LEFT, hwInterface::BACK_RIGHT, hwInterface::encTicks(), hwInterface::FRONT_LEFT, and hwInterface::FRONT_RIGHT.

int Controller::forward void   )  [private]
 

Increase power output of engine Servo.

Long Description if necessary.

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

Definition at line 92 of file controller.cpp.

References msecLeft, power, POWER_DELTA, and sendAck().

int Controller::gain float &  K  )  [private]
 

Short Description.

Long Description if necessary.

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

Definition at line 163 of file controller.cpp.

References daemon, endmsg, errSum, startmsg(), and msg::type().

int Controller::gps void   )  [private]
 

int Controller::gps void   )  [private]
 

int Controller::gps void   )  [private]
 

Short Description.

Long Description if necessary.

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

Definition at line 410 of file controller.cpp.

Referenced by processMsgs().

int Controller::heartbeat void   )  [private]
 

int Controller::heartbeat void   )  [private]
 

int Controller::info void   )  [private]
 

int Controller::info void   )  [private]
 

Short Description.

Long Description if necessary.

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

Definition at line 169 of file controller.cpp.

References angle, endmsg, est, EstimatorBase::getAngle(), EstimatorBase::getXPos(), EstimatorBase::getYPos(), msg::moreArgs(), power, and startmsg().

Referenced by processMsgs().

int Controller::joyX void   )  [private]
 

int Controller::joyX void   )  [private]
 

Short Description.

Long Description if necessary.

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

Definition at line 109 of file controller.cpp.

References angle, endmsg, msg::moreArgs(), startmsg(), and msg::type().

Referenced by processMsgs().

int Controller::joyY void   )  [private]
 

int Controller::joyY void   )  [private]
 

Short Description.

Long Description if necessary.

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

Definition at line 139 of file controller.cpp.

References endmsg, msg::moreArgs(), power, startmsg(), and msg::type().

Referenced by processMsgs().

int Controller::kill void   )  [private]
 

int Controller::kill void   )  [private]
 

int Controller::kill void   )  [private]
 

Short Description.

Long Description if necessary.

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

Definition at line 229 of file controller.cpp.

References angle, hw, power, quit, sendAck(), hwInterface::setAngle(), hwInterface::setSCPower(), hwInterface::wait(), and hwInterface::writeControl().

Referenced by processMsgs().

int Controller::left void   )  [private]
 

Turn wheel to the left.

Move Servo to turn wheels left by incrementing the servo position by 5 units Motion to the left using setAngle is from 0 to +30

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

Definition at line 132 of file controller.cpp.

References angle, ANGLE_DELTA, and sendAck().

int Controller::processMsgs void   )  [private]
 

int Controller::processMsgs void   )  [private]
 

int Controller::processMsgs void   )  [private]
 

int Controller::processMsgs void   )  [private]
 

Short Description.

Long Description if necessary.

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

Definition at line 49 of file controller.cpp.

References msg::dispatch(), msg::error(), gps(), info(), joyX(), joyY(), kill(), msecLeft, msg::recvNoWait(), sendNack(), setAngle(), setAngleValue(), setPower(), setPowerValue(), stop(), msg::type(), and verbose.

Referenced by run().

int Controller::right void   )  [private]
 

Turn wheel to the right.

Move Servo to turn wheels right by decrementing the servo position by 5 units Motion to the right using setAngle is from 0 to -30

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

Definition at line 152 of file controller.cpp.

References angle, ANGLE_DELTA, and sendAck().

int Controller::run void   ) 
 

int Controller::run void   ) 
 

int Controller::run void   ) 
 

int Controller::run 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 452 of file controller.cpp.

References angle, angleValue, angleValueErr, calcAdjustedValue(), hwInterface::encTicksBL(), hwInterface::encTicksBR(), hwInterface::encTicksFL(), hwInterface::encTicksFR(), est, f, hwInterface::getSteeringA2DValue(), hw, i, msecLeft, power, powerValue, powerValueErr, processMsgs(), quit, hwInterface::readStatus(), hwInterface::setAdjustedSCPower(), hwInterface::setAngle(), hwInterface::setSCPower(), hwInterface::setSCValue(), hwInterface::setSteeringValue(), EncEstimator::update(), useAngleValue, usePowerValue, hwInterface::wait(), and hwInterface::writeControl().

Referenced by main().

void Controller::sendAck void   )  [private]
 

void Controller::sendAck void   )  [private]
 

void Controller::sendAck void   )  [private]
 

void Controller::sendAck void   )  [private]
 

Short Description.

Long Description if necessary.

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

Definition at line 380 of file controller.cpp.

References endmsg, startmsg(), and msg::type().

Referenced by back(), forward(), kill(), left(), right(), and stop().

void Controller::sendNack void   )  [private]
 

void Controller::sendNack void   )  [private]
 

void Controller::sendNack void   )  [private]
 

void Controller::sendNack void   )  [private]
 

Short Description.

Long Description if necessary.

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

Definition at line 395 of file controller.cpp.

References endmsg, startmsg(), and msg::type().

Referenced by processMsgs().

int Controller::setAngle void   )  [private]
 

Short Description.

Long Description if necessary.

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

Definition at line 318 of file controller.cpp.

References angle, endmsg, msg::moreArgs(), msecLeft, startmsg(), msg::type(), and useAngleValue.

Referenced by processMsgs().

int Controller::setAngleValue void   )  [private]
 

Short Description.

Long Description if necessary.

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

Definition at line 349 of file controller.cpp.

References angleValue, endmsg, msg::moreArgs(), msecLeft, startmsg(), msg::type(), and useAngleValue.

Referenced by processMsgs().

int Controller::setPower void   )  [private]
 

Short Description.

Long Description if necessary.

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

Definition at line 254 of file controller.cpp.

References endmsg, msg::moreArgs(), msecLeft, power, startmsg(), msg::type(), and usePowerValue.

Referenced by processMsgs().

int Controller::setPowerValue void   )  [private]
 

Short Description.

Long Description if necessary.

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

Definition at line 285 of file controller.cpp.

References endmsg, msg::moreArgs(), msecLeft, powerValue, startmsg(), msg::type(), and usePowerValue.

Referenced by processMsgs().

int Controller::speed void   )  [private]
 

Short Description.

Long Description if necessary.

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

Definition at line 280 of file controller.cpp.

References cyclesLeft, daemon, endmsg, startmsg(), targetVeloc, and msg::type().

int Controller::stop void   )  [private]
 

int Controller::stop void   )  [private]
 

int Controller::stop void   )  [private]
 

Short Description.

Long Description if necessary.

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

Definition at line 211 of file controller.cpp.

References power, and sendAck().

Referenced by processMsgs().


Member Data Documentation

int Controller::ack_count [private]
 

Definition at line 24 of file fcontroller.h.

float Controller::angle [private]
 

Definition at line 30 of file controller.h.

Referenced by Controller(), info(), joyX(), kill(), left(), right(), run(), and setAngle().

float Controller::angleValue [private]
 

Definition at line 31 of file controller.h.

Referenced by run(), and setAngleValue().

float Controller::angleValueErr [private]
 

Definition at line 32 of file controller.h.

Referenced by run().

int Controller::cyclesLeft [private]
 

Definition at line 35 of file controller.h.

Referenced by Controller(), and speed().

msg* Controller::daemon [private]
 

Definition at line 19 of file fcontroller.h.

msg* Controller::daemon [private]
 

Definition at line 22 of file controller.h.

msg* Controller::daemon [private]
 

Definition at line 25 of file controller.h.

msg* Controller::daemon [private]
 

Definition at line 18 of file controller.h.

Referenced by gain(), and speed().

FILE* Controller::dataFile [private]
 

Definition at line 25 of file fcontroller.h.

float Controller::errSum [private]
 

Definition at line 31 of file controller.h.

Referenced by Controller(), and gain().

EncEstimator Controller::est [private]
 

Definition at line 20 of file controller.h.

Referenced by info(), and run().

std::ofstream& Controller::f [private]
 

Definition at line 22 of file controller.h.

Referenced by run().

hwInterface Controller::hw [private]
 

Definition at line 17 of file controller.h.

Referenced by kill(), and run().

float Controller::Kd [private]
 

Definition at line 30 of file controller.h.

Referenced by Controller().

float Controller::Ki [private]
 

Definition at line 30 of file controller.h.

Referenced by Controller().

float Controller::Kp [private]
 

Definition at line 30 of file controller.h.

Referenced by Controller().

int Controller::msecLeft [private]
 

Definition at line 43 of file controller.h.

Referenced by back(), forward(), processMsgs(), run(), setAngle(), setAngleValue(), setPower(), and setPowerValue().

float Controller::power [private]
 

Definition at line 37 of file controller.h.

Referenced by back(), forward(), info(), joyY(), kill(), run(), setPower(), and stop().

float Controller::powerValue [private]
 

Definition at line 38 of file controller.h.

Referenced by run(), and setPowerValue().

float Controller::powerValueErr [private]
 

Definition at line 39 of file controller.h.

Referenced by run().

int Controller::quit [private]
 

Definition at line 26 of file controller.h.

Referenced by kill(), and run().

float Controller::targetVeloc [private]
 

Definition at line 29 of file controller.h.

Referenced by Controller(), and speed().

hwInterface Controller::truck_hw [private]
 

Definition at line 24 of file controller.h.

Referenced by Controller().

bool Controller::useAngleValue [private]
 

Definition at line 29 of file controller.h.

Referenced by run(), setAngle(), and setAngleValue().

bool Controller::usePowerValue [private]
 

Definition at line 36 of file controller.h.

Referenced by run(), setPower(), and setPowerValue().

float Controller::veloc [private]
 

Definition at line 29 of file controller.h.

Referenced by Controller().

int Controller::verbose [private]
 

Definition at line 24 of file controller.h.

Referenced by processMsgs().


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