EVShield  v1.3
EVShield Library Reference by mindsensors.com
EVs_NXTCam Class Reference

This class interfaces with NXTCam attached to EVShield. More...

#include <EVs_NXTCam.h>

Inheritance diagram for EVs_NXTCam:
EVShieldI2C BaseI2CDevice SoftI2cMaster

Public Member Functions

 EVs_NXTCam (uint8_t i2c_address=0x02)
 
uint8_t issueCommand (char command)
 
bool sortSize ()
 
bool selectObjectMode ()
 
bool writeImageRegisters ()
 
bool disableTracking ()
 
bool enableTracking ()
 
bool getColorMap ()
 
bool illuminationOn ()
 
bool readImageRegisters ()
 
bool selectLineMode ()
 
bool pingCam ()
 
bool resetCam ()
 
bool sendColorMap ()
 
bool illuminationOff ()
 
bool sortColor ()
 
bool sortNone ()
 
bool camFirmware ()
 
int getNumberObjects ()
 
void getBlobs (int *nblobs, uint8_t *color, uint8_t *left, uint8_t *top, uint8_t *right, uint8_t *bottom)
 
- Public Member Functions inherited from EVShieldI2C
 EVShieldI2C (uint8_t i2c_address)
 
void init (void *shield, SH_BankPort bp)
 
uint8_t readByte (uint8_t location)
 
uint16_t readInteger (uint8_t location)
 
uint32_t readLong (uint8_t location)
 
uint8_t * readRegisters (uint8_t start_register, uint8_t bytes, uint8_t *buf)
 
char * readString (uint8_t location, uint8_t bytes_to_read, uint8_t *buffer=0, uint8_t buffer_length=0)
 
bool writeRegisters (uint8_t start_register, uint8_t bytes_to_write, uint8_t *buffer=0)
 
bool writeByte (uint8_t location, uint8_t data)
 
bool writeInteger (uint8_t location, uint16_t data)
 
bool writeLong (uint8_t location, uint32_t data)
 
char * getFirmwareVersion ()
 
char * getVendorID ()
 
char * getDeviceID ()
 
char * getFeatureSet ()
 
uint8_t getErrorCode ()
 
bool checkAddress ()
 
bool setAddress (uint8_t address)
 
- Public Member Functions inherited from BaseI2CDevice
 BaseI2CDevice (uint8_t i2c_address)
 
void initProtocol ()
 
uint8_t * readRegisters (uint8_t start_register, uint8_t bytes_to_read, uint8_t *buffer=0, uint8_t buffer_length=0, bool clear_buffer=false)
 
uint8_t readByte (uint8_t location)
 
int16_t readInteger (uint8_t location)
 
uint32_t readLong (uint8_t location)
 
char * readString (uint8_t location, uint8_t bytes_to_read, uint8_t *buffer=0, uint8_t buffer_length=0)
 
bool writeRegisters (uint8_t start_register, uint8_t bytes_to_write, uint8_t *buffer=0)
 
bool writeByte (uint8_t location, uint8_t data)
 
bool writeInteger (uint8_t location, uint16_t data)
 
bool writeLong (uint8_t location, uint32_t data)
 
bool checkAddress ()
 
bool setAddress (uint8_t i2c_address)
 
uint8_t getAddress ()
 
uint8_t getWriteErrorCode ()
 
char * getFirmwareVersion ()
 
char * getVendorID ()
 
char * getDeviceID ()
 
char * getFeatureSet ()
 
- Public Member Functions inherited from SoftI2cMaster
uint8_t start (uint8_t addressRW)
 
void stop (void)
 
uint8_t restart (uint8_t addressRW)
 
uint8_t write (uint8_t b)
 
uint8_t read (uint8_t last)
 
 SoftI2cMaster (uint8_t devAddr)
 
void initProtocol (uint8_t sclPin=(uint8_t) NULL, uint8_t sdaPin=(uint8_t) NULL)
 
uint8_t * readRegisters (uint8_t startRegister, uint8_t bytes, uint8_t *buf=NULL)
 
bool writeRegistersWithLocation (int bytes, uint8_t *buf)
 
bool writeRegisters (uint8_t location, uint8_t bytes_to_write, uint8_t *buffer=0)
 
bool writeByte (uint8_t location, uint8_t data)
 
bool writeInteger (uint8_t location, uint16_t data)
 
bool writeLong (uint8_t location, uint32_t data)
 
char * readString (uint8_t startRegister, uint8_t bytes, uint8_t *buf=NULL, uint8_t len=0)
 
uint8_t readByte (uint8_t location)
 
int16_t readInteger (uint8_t location)
 
uint32_t readLong (uint8_t location)
 
char * getFirmwareVersion ()
 
char * getVendorID ()
 
char * getDeviceID ()
 
uint8_t getWriteErrorCode ()
 
bool checkAddress ()
 
bool setAddress (uint8_t address)
 

Additional Inherited Members

- Public Attributes inherited from EVShieldI2C
void * mp_shield
 
uint8_t * _i2c_buffer
 
uint8_t m_protocol
 
- Public Attributes inherited from SoftI2cMaster
uint8_t * _so_buffer
 
- Static Public Attributes inherited from BaseI2CDevice
static uint8_t * _buffer = 0
 
static bool b_initialized = false
 
- Protected Member Functions inherited from BaseI2CDevice
void setWriteErrorCode (uint8_t code)
 

Detailed Description

This class interfaces with NXTCam attached to EVShield.

Constructor & Destructor Documentation

§ EVs_NXTCam()

EVs_NXTCam::EVs_NXTCam ( uint8_t  i2c_address = 0x02)

class constructor for NXTCam with optional custom i2c address parameter

Member Function Documentation

§ camFirmware()

bool EVs_NXTCam::camFirmware ( )

get the firmware of the NXTCam

§ disableTracking()

bool EVs_NXTCam::disableTracking ( )

disable tracking for the NXTCam

§ enableTracking()

bool EVs_NXTCam::enableTracking ( )

enable tracking for the NXTCam

§ getBlobs()

void EVs_NXTCam::getBlobs ( int *  nblobs,
uint8_t *  color,
uint8_t *  left,
uint8_t *  top,
uint8_t *  right,
uint8_t *  bottom 
)

This function gets the blob information of all the blobs that NXTCam is tracking. There could be upto 8 blobs being tracked by NXTCam. All the parameters of this function are return values. This function will return color and coordinate information for all the blobs.

Parameters
nblobsIn this variable, number of blobs NXTCam sees are returned. The blobs NXTCam sees could be of different color or same color. For e.g. if you have 3 colors defined, say red (color 1), blue (color 2) and green (color3), and you have 3 red objects and 2 blue objects and 1 green object in front of NXTCam, nblobs will be 6. color[]: a array of colors for the blobs in above example, Color array will have 6 valid elements - three bytes will say 1 (for color1), and 2 bytes will say (for color 2), and 1 byte will say 3 (for color 3). Based on sorting chosen, they will be sorted by size or color (if the sorting was color, first 3 bytes will be 1, next two will be 2 and next one will be 3).
colora array of colors for the blobs (array has 8 elements)
leftthe coordinate values of the blobs (array of 8 elements)
topthe coordinate values of the blobs (array of 8 elements)
rightthe coordinate values of the blobs (array of 8 elements)
bottomthe coordinate values of the blobs (array of 8 elements)
Returns
look at the nblobs first to see how many blobs are being tracked, and then read the respective color and coordinate infromation.

§ getColorMap()

bool EVs_NXTCam::getColorMap ( )

get the current colormap of the NXTCam

§ getNumberObjects()

int EVs_NXTCam::getNumberObjects ( )

get the total number of objected tracked by the NXTCam

§ illuminationOff()

bool EVs_NXTCam::illuminationOff ( )

not impmemented yet

§ illuminationOn()

bool EVs_NXTCam::illuminationOn ( )

not impmemented yet

§ issueCommand()

uint8_t EVs_NXTCam::issueCommand ( char  command)

issue character command byte to the command register of the NXTCam (command such as enable tracking, stop tracking, etc). Refer to User Guide for available commands.

§ pingCam()

bool EVs_NXTCam::pingCam ( )

ping the NXTCam to test connection

§ readImageRegisters()

bool EVs_NXTCam::readImageRegisters ( )

read the image registers of the CCD

§ resetCam()

bool EVs_NXTCam::resetCam ( )

reset the NXTCam

§ selectLineMode()

bool EVs_NXTCam::selectLineMode ( )

put the NXTCam in line tracking mode

§ selectObjectMode()

bool EVs_NXTCam::selectObjectMode ( )

configure the tracking mode of the device to object tracking

§ sendColorMap()

bool EVs_NXTCam::sendColorMap ( )

send ColorMap to the NXTCam

§ sortColor()

bool EVs_NXTCam::sortColor ( )

sort the blobs by color

§ sortNone()

bool EVs_NXTCam::sortNone ( )

clear any selected sort configuration

§ sortSize()

bool EVs_NXTCam::sortSize ( )

sort the blobs from the NXTCam byt blobs

§ writeImageRegisters()

bool EVs_NXTCam::writeImageRegisters ( )

write to the image registers of the CCD


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