|
Data Structures | |
struct | blob |
Files | |
file | mindsensors-nxtcam.h |
Mindsensors NXTCam driver. | |
Defines | |
#define | MAX_BLOBS 8 |
#define | NXTCAM_I2C_ADDR 0x02 |
#define | NXTCAM_CMD_REG 0x41 |
#define | NXTCAM_COUNT_REG 0x42 |
#define | NXTCAM_DATA_REG 0x43 |
#define | SIDE_CENTER(X1, X2) ((X1 + X2) / 2) |
Typedefs | |
typedef blob | blob_array [MAX_BLOBS] |
Functions | |
bool | NXTCAMinit (tSensors link, ubyte address=NXTCAM_I2C_ADDR) |
bool | NXTCAMinitTL (tSensors link, ubyte address=NXTCAM_I2C_ADDR) |
int | NXTCAMgetBlobs (tSensors link, blob_array &blobs, bool mergeBlobs, ubyte address=NXTCAM_I2C_ADDR) |
int | NXTCAMgetBlobs (tSensors link, blob_array &blobs, ubyte address=NXTCAM_I2C_ADDR) |
bool | _camera_cmd (tSensors link, byte cmd, ubyte address) |
int | _mergeBlobs (int blob1, int blob2, int nblobs, blob_array &blobs) |
int | _merge (int nblobs, blob_array &blobs) |
void | _sortBlobs (int nblobs, blob_array &blobs) |
void | NXTCAMgetAverageCenter (blob_array &blobs, int nblobs, int colourindex, int &x, int &y) |
void | NXTCAMgetCenter (blob_array &blobs, int index, int &x, int &y) |
Variables | |
tByteArray | NXTCAM_I2CRequest |
tByteArray | NXTCAM_I2CReply |
bool | still_merging = false |
NXTCam Vision System
#define MAX_BLOBS 8 |
Maximum number of blobs returned by the NXTCam
Definition at line 48 of file mindsensors-nxtcam.h.
#define NXTCAM_CMD_REG 0x41 |
Register used for issuing commands
Definition at line 50 of file mindsensors-nxtcam.h.
#define NXTCAM_COUNT_REG 0x42 |
Register used to hold number of blobs detected
Definition at line 51 of file mindsensors-nxtcam.h.
#define NXTCAM_DATA_REG 0x43 |
Register containing data pertaining to blobs
Definition at line 52 of file mindsensors-nxtcam.h.
#define NXTCAM_I2C_ADDR 0x02 |
I2C address used by the NXTCam
Definition at line 49 of file mindsensors-nxtcam.h.
#define SIDE_CENTER | ( | X1, | |
X2 | |||
) | ((X1 + X2) / 2) |
Returns the center of a side
Definition at line 54 of file mindsensors-nxtcam.h.
typedef blob blob_array[MAX_BLOBS] |
Array of blob as a typedef, this is a work around for RobotC's inability to pass an array to a function
Definition at line 67 of file mindsensors-nxtcam.h.
bool _camera_cmd | ( | tSensors | link, |
byte | cmd, | ||
ubyte | address | ||
) |
This function sends a command to the camera over I2C.
Note: this is an internal function and should not be called directly.
link | the sensor port number |
cmd | the command to be sent |
address | the I2C address to use, optional, defaults to 0x02 |
Definition at line 98 of file mindsensors-nxtcam.h.
int _merge | ( | int | nblobs, |
blob_array & | blobs | ||
) |
Go through the blobs and calls _mergeBlobs.
Note: this is an internal function and should not be called directly.
nblobs | the number of blobs |
blobs | the array of blobs |
Definition at line 232 of file mindsensors-nxtcam.h.
int _mergeBlobs | ( | int | blob1, |
int | blob2, | ||
int | nblobs, | ||
blob_array & | blobs | ||
) |
Check if two blobs can be merged into one. blob1 will be replaced with the new merged blob and blob2 will be destroyed.
Note: this is an internal function and should not be called directly.
blob1 | the index number of the first blob |
blob2 | the index number of the second blob |
nblobs | the number of blobs |
blobs | the array of blobs |
Definition at line 256 of file mindsensors-nxtcam.h.
void _sortBlobs | ( | int | nblobs, |
blob_array & | blobs | ||
) |
This function sorts the blobs in the array using insertion sort.
Note: this is an internal function and should not be called directly.
nblobs | the number of blobs |
blobs | the array of blobs |
Definition at line 326 of file mindsensors-nxtcam.h.
void NXTCAMgetAverageCenter | ( | blob_array & | blobs, |
int | nblobs, | ||
int | colourindex, | ||
int & | x, | ||
int & | y | ||
) |
Calculate the average center of all the blobs of a specific colour.
Note: this is an experimental function and may not function properly yet.
blobs | the array of blobs |
nblobs | the number of blobs |
colourindex | the colour of the blobs of which the average center is to be calculated |
x | x-coordinate of the center |
y | y-coordinate of the center |
Definition at line 358 of file mindsensors-nxtcam.h.
int NXTCAMgetBlobs | ( | tSensors | link, |
blob_array & | blobs, | ||
ubyte | address | ||
) |
This function fetches the blob data from the camera.
link | the sensor port number |
blobs | the array of blobs |
address | the I2C address to use, optional, defaults to 0x02 |
Definition at line 183 of file mindsensors-nxtcam.h.
int NXTCAMgetBlobs | ( | tSensors | link, |
blob_array & | blobs, | ||
bool | mergeBlobs, | ||
ubyte | address | ||
) |
This function fetches the blob data from the camera and merges the colliding ones.
link | the sensor port number |
blobs | the array of blobs |
mergeBlobs | whether or not to merge the colliding blobs |
address | the I2C address to use, optional, defaults to 0x02 |
Definition at line 169 of file mindsensors-nxtcam.h.
void NXTCAMgetCenter | ( | blob_array & | blobs, |
int | index, | ||
int & | x, | ||
int & | y | ||
) |
Calculate the center of a specified blob.
Note: this is an experimental function and may not function properly yet.
blobs | the array of blobs |
index | the blob that you want to calculate the center of |
x | x-coordinate of the center |
y | y-coordinate of the center |
Definition at line 384 of file mindsensors-nxtcam.h.
bool NXTCAMinit | ( | tSensors | link, |
ubyte | address | ||
) |
This function initialises camera ready to find blobs and sort them according to size.
link | the sensor port number |
address | the I2C address to use, optional, defaults to 0x02 |
Definition at line 113 of file mindsensors-nxtcam.h.
bool NXTCAMinitTL | ( | tSensors | link, |
ubyte | address | ||
) |
This function initialises camera ready to track lines.
link | the sensor port number |
address | the I2C address to use, optional, defaults to 0x02 |
Definition at line 140 of file mindsensors-nxtcam.h.
Array to hold I2C reply data
Definition at line 70 of file mindsensors-nxtcam.h.
Array to hold I2C command data
Definition at line 69 of file mindsensors-nxtcam.h.
bool still_merging = false |
boolean to signal if there are still blobs that might qualify for merging
Definition at line 87 of file mindsensors-nxtcam.h.