forked from AnykeyNL/uArmProPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic_example.py
More file actions
58 lines (49 loc) · 1.5 KB
/
Copy pathbasic_example.py
File metadata and controls
58 lines (49 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# uArm Swift Pro - Python Library Example
# Created by: Richard Garsthagen - the.anykey@gmail.com
# Modified by: jfdzar
# V0.1 - June 2017 - Still under development
import uArmRobot
import time
import serial
#Configure Serial Port
serialport = 'COM7' # for windows
#serialport = "/dev/ttyACM0" # for linux like system
# Connect to uArm
myRobot = uArmRobot.robot(serialport)
myRobot.debug = False # Enable / Disable debug output on screen, by default disabled
myRobot.connect()
# Set mode to Normal
myRobot.mode(0)
# Get actual Position
print(myRobot.get_position())
#Go to Test Position
myRobot.goto(200,0,100,30000)
#Change the acceleration and move to test acceleartion
myRobot.set_acceleration(300,300)
myRobot.goto(200,150,100,30000)
myRobot.goto(200,-150,100,30000)
#Change the acceleration and move to test acceleartion
myRobot.set_acceleration(200,200)
myRobot.goto(200,150,100,5000)
myRobot.goto(200,-150,100,5000)
myRobot.goto(200,0,100,5000)
#Print Test
myRobot.mode(1)
z = 100
speed = 5000
for i in range(1,4):
myRobot.laser_goto(200,0,z,speed)
myRobot.laser_goto(200,50,z,speed)
myRobot.laser_goto(210,50,z,speed)
myRobot.laser_goto(210,0,z,speed)
myRobot.mode(0)
# Send move command, but continue program
myRobot.async_goto(200,150,250,3000)
while myRobot.moving:
print ("Waiting to complete move")
time.sleep(0.5)
#Set Normal Mode go to Home Position and disconnect the robot
myRobot.mode(0)
myRobot.goto(100,0,40,5000)
print('Disconnecting Robot')
myRobot.disconnect()