コード例 #1
0
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
コード例 #2
0
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
    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)
    while iangle_main<360-istep_main:
        angle_main = sample_acquire.rotate_main(sensor_dof,sensor_motor,istep_main);
        sample_acquire.rotate_usd(0)
        sample_acquire.rotate_usd(0)
        sample_acquire.rotate_usd(0)
        sample_acquire.acquire_cone_usd(angle_main,one_sample,istep_usd,icone_usd,max_sample_usd)
        iangle_main = iangle_main+istep_main



    sample_acquire.rotate_usd(0)
    sample_acquire.rotate_usd(0)
    sample_acquire.rotate_usd(0)

    print "disable sensor_dof"
    sensor_dof.on_cleanup()

    gopygo_version = fw_ver()
    info = 'Generated by GoPiGo Version : ' + str(gopygo_version) + ' GeneratedSampleGpG.py version :'+str(sample_acquire.num_version)
    io = GPG_Pos_Dist_IO(sample.get_version())
    io.ToFile(sample,filename,info)
    sample_acquire.rotate_usd(0)
    gopigo.disable_servo()
    print "disable_servo"
コード例 #4
0
ファイル: Servo_Util.py プロジェクト: cchschmch/RobotGPG
 def on_start_stop_servo(self):
     if not self._servo:
         gopigo.enable_servo()    
     else:
         gopigo.disable_servo()
     self._servo = not self._servo
コード例 #5
0
ファイル: gopi_proxy.py プロジェクト: sumsted/gopi
def disable_servo(kargs):
    r = {'return_value': gopigo.disable_servo()}
    return r