-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrobot_commands.py
More file actions
73 lines (61 loc) · 1.58 KB
/
robot_commands.py
File metadata and controls
73 lines (61 loc) · 1.58 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
"""Main robot commands: home, move"""
import time
from config.robot import (
HOME_J6,
HOME_J5,
HOME_X,
HOME_Y,
HOME_Z,
HOME_SPEED,
MEAN_SPEED,
)
from helpers.communication import send_message_G1
def homing(
j6: float = HOME_J6,
j5: float = HOME_J5,
x: float = HOME_X,
y: float = HOME_Y,
z: float = HOME_Z,
speed: float = HOME_SPEED,
):
"""Homing the robot
After the main process is done, homing to the initial position.
Args:
j6, j5, x, y, z (float, optional): home position
speed (float, optional): selected speed (mm/min) for homing
"""
print('HOMING...')
send_message_G1(j6, j5, x, y, z, speed)
time.sleep(3) # wait for the robot to home
print('HOMED')
def move_arm(
new_J6: float,
new_J5: float,
new_x: float,
new_y: float,
new_z: float,
J6: float,
J5: float,
X: float,
Y: float,
Z: float,
speed=MEAN_SPEED,
) -> tuple[float, float, float, float, float]:
"""Move robot to designated coordinates
Args:
new_J6, new_J5 (float): degrees to add
new_x, new_y, new_z (float): distance to add
J6, J5 (float): current J6/J5 angle
X, Y, Z (float): current XYZ position
speed (float, optional): requested speed of the robot's movement.
Defaults to `MEAN_SPEED`.
Returns:
tuple[float, float, float, float, float]: new angles and positions
"""
J6 += new_J6
J5 += new_J5
X += new_x
Y += new_y
Z += new_z
send_message_G1(J6, J5, X, Y, Z, speed)
return J6, J5, X, Y, Z