コード例 #1
0
ファイル: scan.py プロジェクト: sapytrewq/farfield
def minimize_fsr():
	voltages = []
	servocontrol.move_arm(0)
	servocontrol.move_base(0)
	for arm_angle in range(0,182,2):
		servocontrol.move_arm(arm_angle)
		voltages.append(detector.read_detector())
	time.sleep(0.5)
	servocontrol.move_arm(0)
	servocontrol.move_base(0)

	maxvoltage = max(voltages)
	
	detector.set_fsr(maxvoltage)
コード例 #2
0
ファイル: scan.py プロジェクト: sapytrewq/farfield
def one_axis_scan(num_scans):
	'''scans over x'''
	#detector.reset_fsr()
	#minimize_fsr()
	detector.constant_gain()
	servocontrol.move_arm(0)
	servocontrol.move_base(0)
	writer = csvinterface.CSVWriter(([0]), list(range(0,182,2)));	
	for scan_num in range(num_scans):
		for arm_angle in range(0,182,2):
			servocontrol.move_arm(arm_angle)
			writer.add_point(0,arm_angle,detector.read_detector())
			#print(detector.read_detector())
		time.sleep(0.5)
	servocontrol.move_arm(0)
	servocontrol.move_base(0)
	means_filename, stdev_filename = writer.save_csv()
	simpleplot.one_axis_plot(means_filename, stdev_filename)
コード例 #3
0
ファイル: scan.py プロジェクト: sapytrewq/farfield
def two_axis_scan(num_scans):
	'''scans over x and y'''
	detector.reset_fsr()
	minimize_fsr()
	servocontrol.move_arm(0)
	servocontrol.move_base(0)
	writer = csvinterface.CSVWriter(([0,90]), list(range(0,182,2)));
	for scan_num in range(num_scans):
		for base_angle in [0,90]:
			servocontrol.move_base(base_angle)
			for arm_angle in range(0,182,2):
				servocontrol.move_arm(arm_angle)
				writer.add_point(base_angle,arm_angle,detector.read_detector())
				#print(detector.read_detector())
			time.sleep(0.5)
	servocontrol.move_arm(0)
	servocontrol.move_base(0)
	means_filename, stdev_filename = writer.save_csv()
	simpleplot.simple_plot(means_filename, stdev_filename)
コード例 #4
0
ファイル: scan.py プロジェクト: sapytrewq/farfield
def full_scan(num_scans):
	''' scans over everything!'''
	detector.reset_fsr()
	minimize_fsr()
	servocontrol.move_arm(0)
	servocontrol.move_base(0)
	writer = csvinterface.CSVWriter(list(range(0,190,10)), list(range(0,182,2)));
	for scan_num in range(num_scans):
		for base_angle in range(0,190,10):
			servocontrol.move_base(base_angle)
			for arm_angle in range(0,182,2):
				servocontrol.move_arm(arm_angle)
				writer.add_point(base_angle,arm_angle,detector.read_detector())
				#print(detector.read_detector())
			time.sleep(0.5)
	servocontrol.move_arm(0)
	servocontrol.move_base(0)
	means_filename, stdev_filename = writer.save_csv()
	twographs.plot_everything(means_filename, stdev_filename)
コード例 #5
0
def gainset(anglex, angley):

    x, y, button = joystick.get_joystick()

    print("voltage:", detector.read_detector(), "V")

    if y > 700:
        if angley < 180: angley += 3
        print("moving base to:", angley)
        servocontrol.move_base(angley)
    elif y < 200:
        if angley > 0: angley -= 3
        print("moving base to:", angley)
        servocontrol.move_base(angley)
    if x > 700:
        if anglex < 180: anglex += 3
        print("moving arm to:", anglex)
        servocontrol.move_arm(anglex)
    elif x < 200:
        if anglex > 0: anglex -= 3
        print("moving arm to:", anglex)
        servocontrol.move_arm(anglex)
    return anglex, angley