Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages | Examples

ArTCMCompassDirect Class Reference

#include <ArTCMCompassDirect.h>

Inheritance diagram for ArTCMCompassDirect:

ArTCM2 List of all members.

Detailed Description

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:

    ArRetFunctor1C<int, ArTCMCompassDirect, unsigned int> compassReadFunc(myCompass, &ArTCMCompassDirect::read, 10);
    myRobot->addSensorInterpTask("ArTCMCompassDirect read", 200, &compassReadFunc);

If you use ArCompassConnector, however, it will automatically do this.


Public Member Functions

 ArTCMCompassDirect (const char *serialPortName=ARTCM2_DEFAULT_SERIAL_PORT)
 ArTCMCompassDirect (ArDeviceConnection *devCon)
virtual bool blockingConnect (unsigned long connectTimeout=5000)
virtual void commandAutoCalibration ()
virtual void commandContinuousPackets ()
virtual void commandJustCompass ()
virtual void commandOff ()
virtual void commandOnePacket ()
virtual void commandSoftReset ()
virtual void commandStopCalibration ()
virtual void commandUserCalibration ()
virtual bool connect ()
ArDeviceConnectiongetDeviceConnetion ()
int read (unsigned int msWait=1)
void setDeviceConnection (ArDeviceConnection *devCon)


Member Function Documentation

void ArTCMCompassDirect::commandAutoCalibration  )  [virtual]
 

Send commands to begin calibrating

Implements ArTCM2.

void ArTCMCompassDirect::commandContinuousPackets  )  [virtual]
 

Send commands to start/stop sending data.

Implements ArTCM2.

virtual void ArTCMCompassDirect::commandJustCompass void   )  [inline, virtual]
 

Same as commandContinuousPackets() in this implementation.

Implements ArTCM2.

virtual void ArTCMCompassDirect::commandSoftReset void   )  [inline, virtual]
 

Not implemented yet.

Implements ArTCM2.

bool ArTCMCompassDirect::connect  )  [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.

Returns:
A value > 0 if messages were recieved from the compass, 0 if no data was recieved, and a value < 0 on error reading from the compass.


The documentation for this class was generated from the following files:
Generated on Thu Jan 7 10:34:44 2010 for Aria by  doxygen 1.4.2