Aria  2.8.0
ArTCM2 Class Referenceabstract

Interface to the PNI TCM 2, TCM 2.5, and TCM 2.6 3-axis compass (magnetometer) that can sense absolute heading, as well as pitch, roll, and includes a temperature sensor. More...

#include <ArTCM2.h>

Inherited by ArTCMCompassDirect [virtual], and ArTCMCompassRobot [virtual].

Public Member Functions

void addHeadingDataCallback (ArFunctor1< double > *f)
 
virtual bool blockingConnect (unsigned long connectTimeout=5000)
 If a connection/initialization procedure is required, perform it, wait until data is recieved from the compass, and return true on success, false on failure. More...
 
virtual void commandAutoCalibration (void)=0
 Start auto calibration.
 
virtual void commandContinuousPackets (void)=0
 Start the compass sending a continuous stream of readings at its fastest rate.
 
virtual void commandJustCompass (void)=0
 Command to just send compass heading data.
 
virtual void commandOff (void)=0
 Turn sending of data off (Compass remains powered on, this is not its not low power standby mode)
 
virtual void commandOnePacket (void)=0
 Get one reading from the compass.
 
virtual void commandSoftReset (void)=0
 Command to do a soft reset of the compass.
 
virtual void commandStopCalibration (void)=0
 Stop calibration.
 
virtual void commandUserCalibration (void)=0
 Start user calibration.
 
virtual bool connect ()
 If a connection/initialization procedure is required, perform it, and return true on success, false on failure. More...
 
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
 

Protected Member Functions

void incrementPacketCount ()
 
void invokeHeadingDataCallbacks (double heading)
 

Protected Attributes

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
 

Detailed Description

Interface to the PNI TCM 2, TCM 2.5, and TCM 2.6 3-axis compass (magnetometer) that can sense absolute heading, as well as pitch, roll, and includes a temperature sensor.

See subclasses and ArCompassConnector for more information, as well as your robot manuals. PNI's TCM manual is also available for download at the MobileRobots support website, documentation section.

This is an abstract interface. To create a compass interface object, instantiate a subclass or use ArCompassConnector.

Note
The compass returns a heading relative to magnetic north, which varies depending on your location in the Earth's magnetic field (declination also varies slowly over time as the Earth's magnetic field changes). To find true north, you must apply an offset, or declination. For example, on June 1, 2007, the magnetic declination of MobileRobots' location of Amherst, NH, USA was 15 1/6 degrees West, so a value of approx. -15.166666 would have to be applied. You can look up declination values for various locations on Earth at http://www.ngdc.noaa.gov/seg/geomag/jsp/Declination.jsp
Examples:
demo.cpp.

Member Function Documentation

◆ blockingConnect()

bool ArTCM2::blockingConnect ( unsigned long  connectTimeout = 5000)
virtual

If a connection/initialization procedure is required, perform it, wait until data is recieved from the compass, and return true on success, false on failure.

Otherwise, just return true.

Examples:
demo.cpp.

◆ connect()

bool ArTCM2::connect ( )
virtual

If a connection/initialization procedure is required, perform it, and return true on success, false on failure.

Otherwise, just return true.

Reimplemented in ArTCMCompassDirect.

◆ getCompass()

double ArTCM2::getCompass ( void  ) const
inline

Get the compass heading (-180, 180] degrees.

Deprecated:
Use getHeading()

The documentation for this class was generated from the following files: