Class NXTCam

    • Field Detail

      • SIZE

        public static final char SIZE
        Used by sortBy() to choose sorting criteria based on size (ordered largest to smallest).
        See Also:
        Constant Field Values
      • COLOR

        public static final char COLOR
        Used by sortBy() to choose sorting criteria based on color id (ordered 0 to 7).
        See Also:
        Constant Field Values
      • NO_SORTING

        public static final char NO_SORTING
        Used by sortBy() to choose no sorting of detected objects.
        See Also:
        Constant Field Values
      • OBJECT_TRACKING

        public static final char OBJECT_TRACKING
        Used by setTrackingMode() to choose object tracking.
        See Also:
        Constant Field Values
      • LINE_TRACKING

        public static final char LINE_TRACKING
        Used by setTrackingMode() to choose line tracking.
        See Also:
        Constant Field Values
    • Constructor Detail

      • NXTCam

        public NXTCam​(I2CPort port,
                      int address)
      • NXTCam

        public NXTCam​(I2CPort port)
      • NXTCam

        public NXTCam​(Port port,
                      int address)
      • NXTCam

        public NXTCam​(Port port)
    • Method Detail

      • getNumberOfObjects

        public int getNumberOfObjects()
        Get the number of objects being tracked
        Returns:
        number of objects (0 - 8)
      • sortBy

        public void sortBy​(char sortType)
        Camera sorts objects it detects according to criteria, either color, size, or no sorting at all.
        Parameters:
        sortType - Use the class constants SIZE, COLOR, or NO_SORTING.
      • enableTracking

        public void enableTracking​(boolean enable)
        Parameters:
        enable - true to enable, false to disable
      • setTrackingMode

        public void setTrackingMode​(char mode)
        Choose either object or line tracking mode.
        Parameters:
        mode - Use either OBJECT_TRACKING or LINE_TRACKING
      • getObjectColor

        public int getObjectColor​(int id)
        Get the color number for a tracked object
        Parameters:
        id - the object number (starting at zero)
        Returns:
        the color of the object (starting at zero)
      • getFirmwareVersion

        public java.lang.String getFirmwareVersion()
        Returns the NXTCam firmware version.
        Returns:
        version number as a string
      • getRectangle

        public Rectangle2D getRectangle​(int id)
        Get the rectangle containing a tracked object
        Parameters:
        id - the object number (starting at zero)
        Returns:
        the rectangle
      • sendCommand

        public void sendCommand​(char cmd)
        Send a single byte command represented by a letter
        Parameters:
        cmd - the letter that identifies the command