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 operation of this block, supported operations are as follows:
  • 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 program 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. The X coordinates range between 0 and 144.

    7. Y Upper left : The Upper left Y coordinate of the objects' bounding box. The Y coordinates range between 0 and 88.

    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. (This indicates any data errors while reading from NXTCam, if reading is successful this is TRUE.
    A read could fail because sensor is connected to incorrect port, has different I2C address etc.)

    b. Object ID you want to track when your operation is 'Get nth Object'. 

    For further details, please download the User Guide.