Example #1
0
 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
Example #2
0
	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()
Example #3
0
	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()
Example #5
0
 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 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 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]));
Example #10
0
 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 setSpeed(self, speed):
		byte_speed = int(speed)
		mark1Rpi.directWrite(self.pid_address, ((byte_speed & 0x00FF),((byte_speed & 0xFF00) >> 8))) 
Example #12
0
	def setLeds(self, val):
		mark1Rpi.directWrite(self.leds_base_address, (val,0));
Example #13
0
	def setServoPulse(self, index, pos):	
		mark1Rpi.directWrite(self.servo_base_address[index], (pos,0));
Example #14
0
 def setP(self, p_coeff):
     byte_coef = int(p_coeff * 256)
     mark1Rpi.directWrite(
         self.pcoef_address((byte_coef & 0x00FF),
                            ((byte_coef & 0xFF00) >> 8)))
Example #15
0
 def setSpeed(self, speed):
     byte_speed = int(speed)
     mark1Rpi.directWrite(self.pid_address, ((byte_speed & 0x00FF),
                                             ((byte_speed & 0xFF00) >> 8)))
Example #16
0
 def resetWatchdog(self):
     mark1Rpi.directWrite(self.watchdog_address, (0x01, 0x00))  # going high
Example #17
0
 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 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 resetWatchdog(self):
		mark1Rpi.directWrite(self.watchdog_address, (0x01, 0x00)) # going high
	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))) 
Example #22
0
 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))) 
Example #24
0
 def setI(self, i_coeff):
     byte_coef = int(i_coeff * 256)
     mark1Rpi.directWrite(self.icoeff_address,
                          ((byte_coef & 0x00FF),
                           ((byte_coef & 0xFF00) >> 8)))