pan_max = 180 target = open('data.csv', 'w') target.truncate() target.write('time,position,velocity\n') panServo = Servo(pan, pan_max, pan_min) tiltServo = Servo(tilt, tilt_max, tilt_min) panServo.setPosition(10) tiltServo.setPosition(tilt_min) # time.sleep(1) panServo.maxABSVelocity = 1000.0 panServo.maxABSacceleration = 25.0 startTime = time.time() panServo.updateTarget(pan_max) tiltServo.updateTarget(10) updated = False while panServo.position != panServo.target: # if not updated and time.time() - startTime > 1: # panServo.updateTarget(pan_min) # updated = True # print('Updated target =================================================') panServo.updatePosition(time.time()) target.write('{0:.3f}, {1:.3f}, {2:.3f}\n'.format(time.time() - startTime,
import os import time from Servo import Servo from csvFile import csvFile servo_max = 100 servo_min = -100 servo = Servo(0, servo_max, servo_min) servo.maxABSVelocity = 20 servo.maxABSacceleration = 5 csvHeader = 'time,position,velocity' def generateImage(csv, image, title): os.system('python graph.py {0} {1} --title="{2}"'.format( csv.filename, image, title)) """ **************************************** Standard Test ***************************************** """ standardPV = csvFile('data/standardPV.csv') standardPV.open() standardPV.write(csvHeader) startTime = time.time()