Icon of NXTCam block

NXTCam Block

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

NXTCam Block with no hub

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

NXTCam Panel

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.

  1. 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.
  2. The I2C address of this device. Usually you will not need to change this.
  3. The mode of operation for NXTCam, supported operations are as follows:
    1. Disable Tracking - stop the tracking, do this to conserve the battery power.
    2. Get First Object - Upto 8 objects are tracked by NXTCam, for most applications first object is of utmost importance.
    3. Get n th Object - For advanced applications to get a specific object.
    4. Enable Tracking - when you are ready to start tracking your objects, this energizes the camera chip (consuming power) and begins processing the images.
    5. 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).
    6. 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)
    7. Illumination on - For future use.
    8. Illumination off - For Future use.
    9. Write Colormap - Write the Colormap to NXTCam memory.
    10. Camera Settings - For advanced operations.
    11. Line tracking mode - NXTCam supports Line Tracking mode and Object tracking mode. This option enables Line tracking mode.
    12. Object tracking mode - This enables Object tracking mode on NXTCam. This is also the default mode (factory set).
  4. Object ID - you can enter the object ID when you select 'Get nth Object' mode of operation.
  5. 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

NXTCam with Data hub

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).

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'. 

For further details, please download the User Guide.