BeeSTEM Class Reference

BeeSTEM.H Interface to Rand Voorhies' BeeSTEM device. More...

#include <Devices/BeeSTEM.H>

Inheritance diagram for BeeSTEM:
Inheritance graph
[legend]
Collaboration diagram for BeeSTEM:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void run ()
 This is our main running thread - don't call directly.
bool writeByte (const byte val, const bool uselock=true)
 send a byte to the BeeSTEM
Constructors, destructors and debugging

 BeeSTEM (OptionManager &mgr, const std::string &descrName="BeeSTEM", const std::string &tagName="BeeSTEM", const char *dev="/dev/ttyS0")
 Default constructor. See ModelComponent.H.
 ~BeeSTEM ()
 Destructor.
void setListener (rutz::shared_ptr< BeeSTEMListener > &listener)
 Install a callback (listener) for BeeSTEM events.
bool echoRequest ()
 Send an echo request.
bool debugMode (const bool on)
 Turn debug mode on/off.
bool resetChip ()
 Reset the BeeSTEM.
bool toggleCalibrateHMR3300 ()
 Toggle the calibration mode of the HMR3300.
bool levelHMR3300 ()
 Level the HMR3300.
LCD functions

bool lcdPrintf (const char *fmt,...) __attribute__((format(__printf__
 Print some text.
bool bool lcdClear ()
 Clear LCD screen.
PWM control functions

bool setMotor (const int motor, signed char speed)
 Sets the speed of a motor. -100 is full reverse, and +100 is full forwards.
float getMotorCurrent (const int motor) const
 Gets the current current consumption of a motor.
Data aquisition and reporting functions

bool setReporting (const BeeSTEMReportingMask t, const bool on)
 Tell the BeeSTEM to start (or stop) sending a data type over the serial connection.
Data Acquisition Functions

byte getCompassHeading ()
 Get Compass Heading.
byte getCompassPitch ()
 Get Compass Pitch.
byte getCompassRoll ()
 Get Compass Pitch.
byte getAccelX ()
 Get High Speed Accelerometer X.
byte getAccelY ()
 Get High Speed Accelerometer Y.
byte getIntPress ()
 Get Internal Pressure.
byte getExtPress ()
 Get External Pressure.
byte getTemp1 ()
 Get Temperature Zone 1.
byte getTemp2 ()
 Get Temperature Zone 2.
byte getTemp3 ()
 Get Temperature Zone 3.
byte getSpareADC ()
 Get current raw Analog value from the spare ADC pin.
byte getMotorCurr (byte whichone)
 Get the current from a motor.
bool getDigitalIn (const int whichone)
 Get the value of a single digital input pin.
byte getDigitalIn ()
 Get the value of all 8 digital input pins as a whole byte.
Digital output function

bool setDigitalOut (const int outnum, const bool on)
 Turn a given digital output on/off.

Protected Member Functions

void start1 ()
 open the port and get started
void stop2 ()
 close the port and get stopped

Detailed Description

BeeSTEM.H Interface to Rand Voorhies' BeeSTEM device.

Hardware interface Class. Contains interfaces to display to an LCD, a 2D Accelerometer/Compass, and extra high speed accelerometer, 3 temperature sensors, internal & external pressure sensors, 8 digital I/O pins an ADC pin, 5 PWM outputs, and motor current readings.

Definition at line 183 of file BeeSTEM.H.


Constructor & Destructor Documentation

BeeSTEM::BeeSTEM ( OptionManager mgr,
const std::string descrName = "BeeSTEM",
const std::string tagName = "BeeSTEM",
const char *  dev = "/dev/ttyS0" 
)

Default constructor. See ModelComponent.H.

Definition at line 64 of file BeeSTEM.C.

References ModelComponent::addSubComponent(), and rutz::shared_ptr< T >::reset().

BeeSTEM::~BeeSTEM (  ) 

Destructor.

Definition at line 107 of file BeeSTEM.C.


Member Function Documentation

bool BeeSTEM::debugMode ( const bool  on  ) 

Turn debug mode on/off.

When in debug mode, the BeeSTEM sends an EchoReply for each command it receives.

Definition at line 125 of file BeeSTEM.C.

References writeByte().

bool BeeSTEM::echoRequest (  ) 

Send an echo request.

The BeeSTEM should reply with an Echo_Reply event if it is alive

Definition at line 118 of file BeeSTEM.C.

References writeByte().

byte BeeSTEM::getAccelX (  ) 

Get High Speed Accelerometer X.

Definition at line 252 of file BeeSTEM.C.

byte BeeSTEM::getAccelY (  ) 

Get High Speed Accelerometer Y.

Definition at line 260 of file BeeSTEM.C.

byte BeeSTEM::getCompassHeading (  ) 

Get Compass Heading.

Definition at line 228 of file BeeSTEM.C.

byte BeeSTEM::getCompassPitch (  ) 

Get Compass Pitch.

Definition at line 236 of file BeeSTEM.C.

byte BeeSTEM::getCompassRoll (  ) 

Get Compass Pitch.

Get Compass Roll.

Definition at line 244 of file BeeSTEM.C.

byte BeeSTEM::getDigitalIn (  ) 

Get the value of all 8 digital input pins as a whole byte.

Get the whole digital input byte.

Definition at line 331 of file BeeSTEM.C.

bool BeeSTEM::getDigitalIn ( const int  whichone  ) 

Get the value of a single digital input pin.

Definition at line 324 of file BeeSTEM.C.

References ASSERT.

byte BeeSTEM::getExtPress (  ) 

Get External Pressure.

Definition at line 276 of file BeeSTEM.C.

byte BeeSTEM::getIntPress (  ) 

Get Internal Pressure.

Definition at line 268 of file BeeSTEM.C.

byte BeeSTEM::getMotorCurr ( byte  whichone  ) 

Get the current from a motor.

0 for A, ..., 4 for E

Definition at line 317 of file BeeSTEM.C.

float BeeSTEM::getMotorCurrent ( const int  motor  )  const

Gets the current current consumption of a motor.

Note that motor current monitoring must be explicitely turned on

byte BeeSTEM::getSpareADC (  ) 

Get current raw Analog value from the spare ADC pin.

Definition at line 308 of file BeeSTEM.C.

byte BeeSTEM::getTemp1 (  ) 

Get Temperature Zone 1.

Definition at line 284 of file BeeSTEM.C.

byte BeeSTEM::getTemp2 (  ) 

Get Temperature Zone 2.

Definition at line 292 of file BeeSTEM.C.

byte BeeSTEM::getTemp3 (  ) 

Get Temperature Zone 3.

Definition at line 300 of file BeeSTEM.C.

bool BeeSTEM::lcdClear (  ) 

Clear LCD screen.

Definition at line 162 of file BeeSTEM.C.

References writeByte().

bool BeeSTEM::lcdPrintf ( const char *  fmt,
  ... 
)

Print some text.

syntax is the same as printf(). Returns true on success.

Definition at line 140 of file BeeSTEM.C.

bool BeeSTEM::levelHMR3300 (  ) 

Level the HMR3300.

Definition at line 212 of file BeeSTEM.C.

References writeByte().

bool BeeSTEM::resetChip (  ) 

Reset the BeeSTEM.

Definition at line 132 of file BeeSTEM.C.

References writeByte().

void BeeSTEM::run (  ) 

This is our main running thread - don't call directly.

Should have been protected, but is not because of pthread hack.

Definition at line 363 of file BeeSTEM.C.

References rutz::shared_ptr< T >::get(), and MYLOGVERB.

bool BeeSTEM::setDigitalOut ( const int  outnum,
const bool  on 
)

Turn a given digital output on/off.

Valid range for outnum is [0..7]

Definition at line 337 of file BeeSTEM.C.

References ASSERT, and writeByte().

void BeeSTEM::setListener ( rutz::shared_ptr< BeeSTEMListener > &  listener  ) 

Install a callback (listener) for BeeSTEM events.

This callback will be called with the corresponding BeeSTEMEventType each time an event is received from the BeeSTEM.

Definition at line 114 of file BeeSTEM.C.

bool BeeSTEM::setMotor ( const int  motor,
signed char  speed 
)

Sets the speed of a motor. -100 is full reverse, and +100 is full forwards.

Note that the [-100..+100] is only a percentage of the maximum possible PWM allowed by the BeeSTEM. See MotorControl.H of the BeeSTEM code for more.

Definition at line 167 of file BeeSTEM.C.

References abs(), and writeByte().

bool BeeSTEM::setReporting ( const BeeSTEMReportingMask  t,
const bool  on 
)

Tell the BeeSTEM to start (or stop) sending a data type over the serial connection.

This function takes in a BeeSTEMReportingMask and a bool, and tells the BeeSTEM to start or stop monitoring and reporting a resource designated by the mask. Note that turning on too many reporting features may significantly slow down the device, so please only turn on what's needed.

Definition at line 222 of file BeeSTEM.C.

References writeByte().

void BeeSTEM::start1 (  )  [protected, virtual]

open the port and get started

Reimplemented from ModelComponent.

Definition at line 92 of file BeeSTEM.C.

void BeeSTEM::stop2 (  )  [protected, virtual]

close the port and get stopped

Reimplemented from ModelComponent.

Definition at line 100 of file BeeSTEM.C.

bool BeeSTEM::toggleCalibrateHMR3300 (  ) 

Toggle the calibration mode of the HMR3300.

Definition at line 204 of file BeeSTEM.C.

References writeByte().

bool BeeSTEM::writeByte ( const byte  val,
const bool  uselock = true 
)

send a byte to the BeeSTEM

You should never have to use this, use the other functions instead. This function is made public just for testing the chip's robustness against a flood of random junk hitting it... See test-BeeSTEM.C

Definition at line 345 of file BeeSTEM.C.

References MYLOGVERB.

Referenced by debugMode(), echoRequest(), lcdClear(), levelHMR3300(), resetChip(), setDigitalOut(), setMotor(), setReporting(), and toggleCalibrateHMR3300().


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:43:07 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3