#include <hw_interface.h>
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 |
Long Description if necessary.
| <parameter_name> | <parameter_descreption> |
Definition at line 48 of file hw_interface.h.
|
|
Definition at line 78 of file hw_interface.h. |
|
||||||||||||
|
Short Description. Long Description if necessary.
Definition at line 31 of file hw_interface.cpp. |
|
|
Short Description. Long Description if necessary.
Definition at line 95 of file hw_interface.cpp. References driver_fd, safeStop(), servo_fd, and writeEn. |
|
|
returns the A2D value for a certain input Long Description if necessary.
Definition at line 235 of file hw_interface.h. References status_t::a2d, and status. |
|
|
returns the cumulative number of ticks a wheel has moved Long Description if necessary.
Definition at line 115 of file hw_interface.h. References status_t::encoder, and status. Referenced by encSum(), Controller::encSum(), and main(). |
|
|
Short Description. Long Description if necessary.
Definition at line 176 of file hw_interface.h. References BACK_LEFT, status_t::encoder, and status. Referenced by main(), and Controller::run(). |
|
|
Short Description. Long Description if necessary.
Definition at line 161 of file hw_interface.h. References BACK_RIGHT, status_t::encoder, and status. Referenced by main(), and Controller::run(). |
|
|
Short Description. Long Description if necessary.
Definition at line 146 of file hw_interface.h. References status_t::encoder, FRONT_LEFT, and status. Referenced by main(), and Controller::run(). |
|
|
Short Description. Long Description if necessary.
Definition at line 131 of file hw_interface.h. References status_t::encoder, FRONT_RIGHT, and status. Referenced by main(), and Controller::run(). |
|
|
return the current steering angle Long Description if necessary.
Definition at line 251 of file hw_interface.h. References Servo::getAngle(), and steeringServo. |
|
|
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
Definition at line 219 of file hw_interface.h. References status_t::a2d, and status. Referenced by main(), and Controller::run(). |
|
|
Returns raw a2d value from front right IR sensor.
Definition at line 202 of file hw_interface.h. References status_t::a2d, and status. Referenced by main(). |
|
|
Returns raw a2d value from front right IR sensor.
Definition at line 189 of file hw_interface.h. References status_t::a2d, and status. Referenced by main(). |
|
|
Short Description. Long Description if necessary.
Definition at line 174 of file hw_interface.cpp. References driver_fd, MCU_READ_STATUS, and status. Referenced by main(), and Controller::run(). |
|
|
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
Definition at line 218 of file hw_interface.cpp. References driver_fd, and MCU_RESET. Referenced by Controller::Controller(), Daemon::Daemon(), main(), and stopAll(). |
|
|
Short Description. Long Description if necessary.
Definition at line 117 of file hw_interface.cpp. References setSCPower(). Referenced by ~hwInterface(). |
|
|
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
Definition at line 268 of file hw_interface.cpp. References f, SSC::setValue(), speedController, and valueErr. Referenced by main(), and Controller::run(). |
|
|
Short Description. Long Description if necessary.
Definition at line 267 of file hw_interface.h. References Servo::setAngle(), and steeringServo. Referenced by Controller::kill(), main(), Controller::run(), and updateAngle(). |
|
|
Short Description. Long Description if necessary.
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(). |
|
|
Short Description. Long Description if necessary.
Definition at line 301 of file hw_interface.h. References SSC::setValue(), and speedController. Referenced by main(), and Controller::run(). |
|
|
Definition at line 306 of file hw_interface.h. References SSC::setValue(), and shiftingServo. Referenced by main(). |
|
|
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
Definition at line 285 of file hw_interface.h. References SSC::setValue(), and steeringServo. Referenced by main(), and Controller::run(). |
|
|
Short Description. Long Description if necessary.
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(). |
|
|
Short Description. Long Description if necessary.
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(). |
|
|
Definition at line 74 of file hw_interface.h. Referenced by EncEstimator::update(). |
|
|
Definition at line 51 of file hw_interface.h. Referenced by hwInterface(), readStatus(), reset(), wait(), and ~hwInterface(). |
|
|
Definition at line 73 of file hw_interface.h. Referenced by EncEstimator::update(). |
|
|
Definition at line 52 of file hw_interface.h. Referenced by hwInterface(), writeControl(), and ~hwInterface(). |
|
|
Definition at line 57 of file hw_interface.h. Referenced by setShiftValue(), and writeControl(). |
|
|
Definition at line 55 of file hw_interface.h. Referenced by setAdjustedSCPower(), setSCPower(), setSCValue(), and writeControl(). |
|
|
Definition at line 50 of file hw_interface.h. Referenced by a2d(), encTicks(), encTicksBL(), encTicksBR(), encTicksFL(), encTicksFR(), getSteeringA2DValue(), irValueFL(), irValueFR(), and readStatus(). |
|
|
Definition at line 56 of file hw_interface.h. Referenced by getAngle(), setAngle(), setSteeringValue(), and writeControl(). |
|
|
Definition at line 72 of file hw_interface.h. |
|
|
Definition at line 71 of file hw_interface.h. Referenced by printTicks(). |
|
|
Definition at line 59 of file hw_interface.h. Referenced by setAdjustedSCPower(). |
|
|
Definition at line 53 of file hw_interface.h. Referenced by hwInterface(), writeControl(), and ~hwInterface(). |
1.4.4