def make_sweep():
	
	obstacle_range = numpy.zeros(NUMBER_OF_SCANS)
	index = 0
	gopigo.enable_servo()

	#Scan the vicinity in front
	for angle in range(SCAN_START, SCAN_END + SCAN_STEP, SCAN_STEP):

		gopigo.servo(angle)
		time.sleep(SLEEP_TIME_BETWEEN_STEPS)
		distance = gopigo.us_dist(PORT_A1)
		
		#Take into account sense lmits
		if distance < SENSE_LIMIT and distance >= 0:
			obstacle_range[index] = distance - AVERAGE_DISTANCE_ERROR
		else:
			obstacle_range[index] = SENSE_LIMIT

		index += 1		

	gopigo.disable_servo()
	return obstacle_range
def make_sweep():

    obstacle_range = numpy.zeros(NUMBER_OF_SCANS)
    index = 0
    gopigo.enable_servo()

    #Scan the vicinity in front
    for angle in range(SCAN_START, SCAN_END + SCAN_STEP, SCAN_STEP):

        gopigo.servo(angle)
        time.sleep(SLEEP_TIME_BETWEEN_STEPS)
        distance = gopigo.us_dist(PORT_A1)

        #Take into account sense lmits
        if distance < SENSE_LIMIT and distance >= 0:
            obstacle_range[index] = distance - AVERAGE_DISTANCE_ERROR
        else:
            obstacle_range[index] = SENSE_LIMIT

        index += 1

    gopigo.disable_servo()
    return obstacle_range
示例#3
0
 def __init__(self, port="SERVO", gpg=None, use_mutex = False):
     Sensor.__init__(self, port, "SERVO", use_mutex)
     gopigo.enable_servo()
     self.set_descriptor("Servo Motor")
示例#4
0
if __name__ == "__main__":
    if len(sys.argv) !=2:
        print 'usage: GenerateSampleGpG.py <path_to_file_to_save> \n You must specify the path to the file you want to save as the first arg'
        sys.exit(1)
    filename = sys.argv[1]
    sensor_dof = Sensor_Dof()
    sensor_dof.on_init()

    sensor_motor = Sensor_Motor()
    sensor_motor.on_init()
    sensor_motor.switchdualmotors()
    sensor_motor.setMotorSpeed(90)
    sensor_motor.on_loop()

    gopigo.enable_servo()
    print "enable_servo"
    sample_acquire = main_usd_sample()
    sample = GPG_Pos_Dist()
    sample.release_element()
    sample_acquire.rotate_usd(0)
    print "Current angle :",sensor_dof.angle

    one_sample = GPG_Pos_Dist_Element()
    istep_main = 66
    iangle_main = 0
    istep_usd = 10
    icone_usd = 60
    max_sample_usd = 2
    angle_main = sensor_dof.angle
    sample_acquire.acquire_cone_usd(angle_main,one_sample,istep_usd,icone_usd,max_sample_usd)
示例#5
0
 def on_start_stop_servo(self):
     if not self._servo:
         gopigo.enable_servo()    
     else:
         gopigo.disable_servo()
     self._servo = not self._servo
示例#6
0
 def __init__(self, port="SERVO", gpg=None, use_mutex = False):
     Sensor.__init__(self, port, "SERVO", use_mutex)
     gopigo.enable_servo()
     self.set_descriptor("Servo Motor")
示例#7
0
def enable_servo(kargs):
    r = {'return_value': gopigo.enable_servo()}
    return r