Aria
2.8.0
|
Talk to a compass directly over a computer serial port. More...
#include <ArTCMCompassDirect.h>
Inherits ArTCM2.
Public Member Functions | |
ArTCMCompassDirect (ArDeviceConnection *devCon) | |
ArTCMCompassDirect (const char *serialPortName=ARTCM2_DEFAULT_SERIAL_PORT) | |
virtual bool | blockingConnect (unsigned long connectTimeout=5000) |
virtual void | commandAutoCalibration () |
Send commands to begin calibrating. | |
virtual void | commandJustCompass () |
Same as commandContinuousPackets() in this implementation. More... | |
virtual void | commandSoftReset () |
Not implemented yet. More... | |
virtual void | commandStopCalibration () |
virtual void | commandUserCalibration () |
virtual bool | connect () |
Open device connection if not yet open and send commands to configure compass. More... | |
ArDeviceConnection * | getDeviceConnetion () |
int | read (unsigned int msWait=1) |
Read all available data, store, and call callbacks if any were added. More... | |
void | setDeviceConnection (ArDeviceConnection *devCon) |
virtual void | commandContinuousPackets () |
Send commands to start/stop sending data. More... | |
virtual void | commandOnePacket () |
virtual void | commandOff () |
Public Member Functions inherited from ArTCM2 | |
void | addHeadingDataCallback (ArFunctor1< double > *f) |
double | getCalibrationH (void) const |
Get the calibration H score (See TCM Manual) | |
double | getCalibrationM (void) const |
Get the calibration M score (See TCM Manual) | |
double | getCalibrationV (void) const |
Get the calibration V score (See TCM Manual) | |
double | getCompass (void) const |
Get the compass heading (-180, 180] degrees. More... | |
int | getError (void) const |
double | getHeading (void) const |
Get the compass heading (-180, 180] degrees. | |
int | getPacCount (void) |
Gets the number of readings recieved in the last second. | |
double | getPitch (void) const |
Get the pitch (-180,180] degrees. | |
double | getRoll (void) const |
Get the roll (-180,180] degrees. | |
double | getTemperature (void) const |
Get the temperature (degrees C) | |
double | getXMagnetic (void) const |
Get the magnetic field X component (See TCM2 Manual) | |
double | getYMagnetic (void) const |
Get the magnetic field Y component (See TCM2 Manual) | |
double | getZMagnetic (void) const |
Get the magnetic field Z component (See TCM2 Manual) | |
bool | haveCalibrationH () const |
bool | haveCalibrationM () const |
bool | haveCalibrationV () const |
bool | haveHeading () const |
bool | havePitch () const |
bool | haveRoll () const |
bool | haveTemperature () const |
bool | haveXMagnetic () const |
bool | haveYMagnetic () const |
bool | haveZMagnetic () const |
Additional Inherited Members | |
Protected Member Functions inherited from ArTCM2 | |
void | incrementPacketCount () |
void | invokeHeadingDataCallbacks (double heading) |
Protected Attributes inherited from ArTCM2 | |
double | myCalibrationH |
double | myCalibrationM |
double | myCalibrationV |
int | myError |
bool | myHaveCalibrationH |
bool | myHaveCalibrationM |
bool | myHaveCalibrationV |
bool | myHaveHeading |
bool | myHavePitch |
bool | myHaveRoll |
bool | myHaveTemperature |
bool | myHaveXMag |
bool | myHaveYMag |
bool | myHaveZMag |
double | myHeading |
std::list< ArFunctor1< double > *> | myHeadingDataCallbacks |
int | myPacCount |
int | myPacCurrentCount |
double | myPitch |
double | myRoll |
double | myTemperature |
time_t | myTimeLastPacket |
double | myXMag |
double | myYMag |
double | myZMag |
Talk to a compass directly over a computer serial port.
This class configures and recieves compass heading data from a TCM2 or TCM2.5 compass directly over a computer serial port, rather than via tha robot. This class cannot recieve pitch, roll or temperature data from the compass. On all Pioneer robots, the TCM compass (as originally installed by MobileRobots) is connected to the robot microcontroller, so if you have a Pioneer with this configuration, you should instead use the ArTCMCompassRobot class. Only use this class if you have connected the compass to the computer serial port.
You can create an instance of this class directly, or using an ArCompassConnector object and giving the "-compassType serialtcm" program argument.
If you create your own ArTCMCompassDirect object, you must call the read() method periodically (ideally at the same rate the compass sends data, approx. 8 hz by default) to read and parse incoming data. You can use an ArRobot callback to do this, for example:
If you use ArCompassConnector, however, it will automatically do this.
|
virtual |
Send commands to start/stop sending data.
Implements ArTCM2.
|
inlinevirtual |
Same as commandContinuousPackets() in this implementation.
Implements ArTCM2.
|
inlinevirtual |
Not implemented yet.
Implements ArTCM2.
|
virtual |
Open device connection if not yet open and send commands to configure compass.
Reimplemented from ArTCM2.
int ArTCMCompassDirect::read | ( | unsigned int | msWait = 1 | ) |
Read all available data, store, and call callbacks if any were added.
unsigned int msWait If 0, wait indefinately for new data. Otherwise, wait a maximum of this many milliseconds for data to arrive.