This block interfaces with NXTCam from
mindsensors.com.
At setup time, NXTCam allows you to define object(s) in it's
environment by color.
At runtime, it can track object(s), and provide you it's color and
bounding
box.
Display Settings
The number (1) above shows which of your NXT’s ports are connected to
the NXTCam.
Number (2) above shows the mode of operation.
You can change this number in the configuration panel if you need
to.
Configuring the NXTCam Block
In your NXT-G program, to begin tracking operation, you
should add a block with "Enable
Tracking" operation.
This block should then be followed by a block to 'Get First Object'.
At this time, from
this block you can read the number of objects being tracked.
If you have more than one objects, subsequently, you can use 'Get n th
Object' to get information of 'n'th object.
Note: if 'n' value supplied is larger than number of objects
found, 'Get n th Object' operation will yield invalid data.
In other words, if NXTCam finds 3 objects, Get n th Object operation
for 4th/5th/6th/7th/8th object will yield invalid data.
When you are done tracking, to conserve power, insert a block
with 'Disable Tracking' Operation.
- The Port number to which NXTCam is supposed to be connected.
Ensure that the connector cable is connected to correct port. You can
change this value to suit your configuration.
- The I2C address of this device. Usually you will not need to
change this.
- The mode of operation for NXTCam, supported operations are as
follows:
- Disable Tracking - stop the tracking, do this to conserve the
battery power.
- Get First Object - Upto 8 objects are tracked by NXTCam, for
most applications first object is of utmost importance.
- Get n th Object - For advanced applications to get a specific
object.
- Enable Tracking - when you are ready to start tracking your
objects, this energizes the camera chip (consuming power) and begins
processing the images.
- Sort Objects by Size - the objects tracked could be of varying
sizes, this option sorts them by the size before while processing the
image. (Get First Object will return you the largest object).
- Sort Objects by Colors - the objects tracked could be oc
variying colors, this option sorts them by color while processing the
image. (Get First Object will return you the object with color 0)
- Illumination on - For future use.
- Illumination off - For Future use.
- Write Colormap - Write the Colormap to NXTCam memory.
- Camera Settings - For advanced operations.
- Line tracking mode - NXTCam supports Line Tracking mode and
Object tracking mode. This option enables Line tracking mode.
- Object tracking mode - This enables Object tracking mode on
NXTCam. This is also the default mode (factory set).
- Object ID - you can enter the object ID when you select 'Get nth
Object' mode of operation.
- This button starts NXTCamView program. If you have not already,
please install NXTCamView proogram developed by Paul
Tingey from here.
NXTCam Block's Data Hub Plugs
1. Port number to which NXTCam is supposed to be connected.
2. I2C address of this sensor.
3. This plug allows you to select mode of operation, use appropriate
numeric value for your mode.
4. Total Tracked Objects : Total number of objects found (you
may retrieve these objects using subsequent block with 'Get n th
Object' operation).
-
This value ranges from 0 to 8, 0 indicating no objects found.
-
When this value is 0, remaining values (X/Y coordinates and
color
number will not be valid)
5. Color: Color number from the colormap of the current object
identified.
6. X Upper Left : The Upper left X coordinate of the objects'
bounding box.
7. Y Upper left : The Upper left Y coordinate of the objects'
bounding box.
8. Y Lower right : The Lower right Y coordinate of the objects'
bounding box.
9. X Lower right : The Lower right X coordinate of the objects'
bounding box.
a. Boolean value for successful tracking.
b. Object ID you want to track when your operation is
'Get nth
Object'.
- This value is ignored if you specify Operation as 'Get First
Object'.
For further details, please
download
the User Guide.