def resetEncoders(self): control_val = mark1Rpi.directRead(self.encoder_control_address, 2) control_val[0] = control_val[0] | 0x03 mark1Rpi.directWrite(self.encoder_control_address, control_val) # going high control_val[0] = control_val[0] & 0xFC mark1Rpi.directWrite(self.encoder_control_address, control_val) # going low
def setColorLut(self, lut_file): f = open(lut_file, "rb") values_tuple = () tuple_size = 0 try: byte = f.read(1) while byte != "": values_tuple = values_tuple + byte values_tuple = values_tuple + 0x00 tuple_size = tuple_size + 2 byte = f.read(1) mark1Rpi.directWrite(self.classifier_lut_base_address, values_tuple, tuple_size); finally: f.close()
def setColorLut(self, lut_file): f = open(lut_file, "rb") values_tuple = () try: byte = f.read(1) while byte != "": #print byte unpacked_val = struct.unpack('B',byte) values_tuple = values_tuple + unpacked_val #values_tuple = values_tuple + unpacked_val byte = f.read(1) #print values_tuple print 'sending : ', str(len(values_tuple)), 'in the color lut' #print hex(values_tuple[0]),hex(values_tuple[1]),hex(values_tuple[2]) mark1Rpi.directWrite(self.classifier_lut_base_address, values_tuple); print 'done !\n' finally: f.close()
def setColorLut(self, lut_file): f = open(lut_file, "rb") values_tuple = () try: byte = f.read(1) while byte != "": #print byte unpacked_val = struct.unpack('B', byte) values_tuple = values_tuple + unpacked_val #values_tuple = values_tuple + unpacked_val byte = f.read(1) #print values_tuple print 'sending : ', str(len(values_tuple)), 'in the color lut' #print hex(values_tuple[0]),hex(values_tuple[1]),hex(values_tuple[2]) mark1Rpi.directWrite(self.classifier_lut_base_address, values_tuple) print 'done !\n' finally: f.close()
def enableEncoders(self): control_val = mark1Rpi.directRead(self.encoder_control_address, 2) control_val[0] = control_val[0] | 0x0C mark1Rpi.directWrite(self.encoder_control_address, control_val) # high enable bits
def setLeds(self, val): mark1Rpi.directWrite(self.leds_base_address, (val,0));
def setServoPulse(self, index, pos): mark1Rpi.directWrite(self.servo_base_address[index], (pos,self.servo_failsafe[index]));
def setSpeed(self, speed): byte_speed = int(speed) mark1Rpi.directWrite(self.pid_address, ((byte_speed & 0x00FF),((byte_speed & 0xFF00) >> 8)))
def setServoPulse(self, index, pos): mark1Rpi.directWrite(self.servo_base_address[index], (pos,0));
def setP(self, p_coeff): byte_coef = int(p_coeff * 256) mark1Rpi.directWrite( self.pcoef_address((byte_coef & 0x00FF), ((byte_coef & 0xFF00) >> 8)))
def setSpeed(self, speed): byte_speed = int(speed) mark1Rpi.directWrite(self.pid_address, ((byte_speed & 0x00FF), ((byte_speed & 0xFF00) >> 8)))
def resetWatchdog(self): mark1Rpi.directWrite(self.watchdog_address, (0x01, 0x00)) # going high
def disableEncoders(self): control_val = mark1Rpi.directRead(self.encoder_control_address, 2) control_val[0] = control_val[0] & 0xF3 mark1Rpi.directWrite(self.encoder_control_address, control_val) # low enable bits
def setI(self, i_coeff): byte_coef = int(i_coeff*256) mark1Rpi.directWrite(self.icoeff_address, ((byte_coef & 0x00FF),((byte_coef & 0xFF00) >> 8)))
def setP(self, p_coeff): byte_coef = int(p_coeff*256) mark1Rpi.directWrite(self.pcoef_address ((byte_coef & 0x00FF),((byte_coef & 0xFF00) >> 8)))
def setD(self, d_coeff): byte_coef = int(d_coeff * 256) mark1Rpi.directWrite(self.dcoeff_address, ((byte_coef & 0x00FF), ((byte_coef & 0xFF00) >> 8)))
def setD(self, d_coeff): byte_coef = int(d_coeff*256) mark1Rpi.directWrite(self.dcoeff_address, ((byte_coef & 0x00FF),((byte_coef & 0xFF00) >> 8)))
def setI(self, i_coeff): byte_coef = int(i_coeff * 256) mark1Rpi.directWrite(self.icoeff_address, ((byte_coef & 0x00FF), ((byte_coef & 0xFF00) >> 8)))