Spike Prime & Robot Inventor python Library Reference
Spike Prime & Robot Inventor python Library
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lib.mindsensors.NXTCAM Class Reference
Inheritance diagram for lib.mindsensors.NXTCAM:
lib.mindsensors.SPIKEi2c

Public Member Functions

def __init__ (self, port, nxtcam_address=NXTCAM_ADDRESS)
 Initialize the class with the i2c address of your NXTCAM. More...
 
def command (self, command)
 Writes a value to the command register. More...
 
def sortSize (self)
 Sort the detected objects by size.
 
def trackObject (self)
 Track detected colors as objects.
 
def writeImageRegisters (self)
 Write to image sensor registers.
 
def stopTracking (self)
 Disable tracking.
 
def startTracking (self)
 Enable tracking.
 
def getColorMap (self)
 Get the color map from NXTCAM.
 
def illuminationOn (self)
 Turn on illumination.
 
def readImageRegisters (self)
 Read to image sensor registers.
 
def trackLine (self)
 Track detected colors as lines.
 
def ping (self)
 Ping the NXTCAM.
 
def reset (self)
 Reset the NXTCAM.
 
def sendColorMap (self)
 Send ColorMap to NXTCAM.
 
def illuminationOff (self)
 Turn off illumination.
 
def sortColor (self)
 Sort tracked objects by color.
 
def firmware (self)
 Get the firmware version of the NXTCAM.
 
def sortNone (self)
 Do not sort tracked objects.
 
def getNumberObjects (self)
 Read the number of objects detected (0-8)
 
def getBlobs (self, blobNum=1)
 Reads data of the tracked object(s) More...
 
- Public Member Functions inherited from lib.mindsensors.SPIKEi2c
def __init__ (self, port, i2c_address, bitrate=100)
 
def readByte (self, reg)
 Read the byte from reg of the i2c device. More...
 
def readArray (self, reg, len)
 read len long data array at reg of the i2c device More...
 
def writeByte (self, reg, value)
 write value at reg of the i2c device More...
 
def writeArray (self, reg, arr)
 write data array at reg of the i2c device More...
 
def readString (self, reg, length)
 Read the string of len from reg of the i2c device. More...
 
def readInteger (self, reg)
 Read the int from reg of the i2c device. More...
 
def readIntegerSigned (self, reg)
 Read the signed int from reg of the i2c device. More...
 
def readLong (self, reg)
 Read the long from reg of the i2c device. More...
 
def GetFirmwareVersion (self)
 Read the firmware version of the i2c device.
 
def GetVendorName (self)
 Read the vendor name of the i2c device.
 
def GetDeviceId (self)
 Read the i2c device id.
 

Public Attributes

 port
 
 nxtcam_address
 
- Public Attributes inherited from lib.mindsensors.SPIKEi2c
 SCL
 
 SDA
 
 address
 
 int_clk
 

Static Public Attributes

tuple NXTCAM_ADDRESS = (0x02)
 Default NXTCAM I2C Address.
 
int COMMAND = 0x41
 Command Register.
 
int NumberObjects = 0x42
 Number of Tracked Ojects Register. More...
 
int Color = 0x43
 First Register Containing Tracked Object Data. More...
 
int X_Top = 0x44
 X-axis Top Register.
 
int Y_Top = 0x45
 Y-axis Top Register.
 
int X_Bottom = 0x46
 X-axis Bottom Register.
 
int Y_Bottom = 0x47
 Y-axis Bottom Register.
 
- Static Public Attributes inherited from lib.mindsensors.SPIKEi2c
int int_clk = -1
 

Constructor & Destructor Documentation

◆ __init__()

def lib.mindsensors.NXTCAM.__init__ (   self,
  port,
  nxtcam_address = NXTCAM_ADDRESS 
)

Initialize the class with the i2c address of your NXTCAM.

Parameters
nxtcam_addressAddress of your NXTcam, skip if default.
Remarks

Member Function Documentation

◆ command()

def lib.mindsensors.NXTCAM.command (   self,
  command 
)

Writes a value to the command register.

Parameters
commandValue to write to the command register.

◆ getBlobs()

def lib.mindsensors.NXTCAM.getBlobs (   self,
  blobNum = 1 
)

Reads data of the tracked object(s)

Parameters
blobNumThe number of the tracked object.
Remarks
To use this function in your program:
from mindsensors import NXTCAM
...
cam = NXTCAM()
cam.startTracking()
cam.trackObject()
b = cam.getBlobs(1)
print "Color: " + str(b.color)
print "Left: " + str(b.left)
print "Top: " + str(b.top)
print "Right: " + str(b.right)
print "Bottom: " + str(b.bottom)

Member Data Documentation

◆ Color

int lib.mindsensors.NXTCAM.Color = 0x43
static

First Register Containing Tracked Object Data.

This is to be read in an array

◆ NumberObjects

int lib.mindsensors.NXTCAM.NumberObjects = 0x42
static

Number of Tracked Ojects Register.

Will return a byte (0-8)


The documentation for this class was generated from the following file: