-
Notifications
You must be signed in to change notification settings - Fork 0
/
spot_sweep_hover.py
68 lines (52 loc) · 1.56 KB
/
spot_sweep_hover.py
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
"""
Small Demo for Spot.
"""
import asyncio
from spot_api import Spot
async def main():
"""
Makes Spot sweep an infinitely-long corridor in front of him using a
serpentine scan pattern. The number of times that Spot scans a line
in front of him and then moves forward is currently limited, but could
easily be made into an infinite loop.
The gripper is made to hover over the ground for the duration of the scan.
"""
# create the Spot robot
spot = Spot()
# Ensure that Spot has an arm.
assert spot.has_arm(), "Spot must have an arm for this demo."
# Lease the robot
with spot.leased(take=True) as spot:
# Power the motors of the Spot on
await spot.power_motors_on()
# Make Spot stand up
await spot.stand()
p1 = (0.75, -0.5, -0.4)
p2 = (0.75, 0.5, -0.4)
await spot.set_ee_pose(
x=p1[0],
y=p1[1],
z=p1[2],
move_time=5
)
for _ in range(4):
# scan the ground
await spot.set_ee_pose(
x=p2[0],
y=p2[1],
z=p2[2],
move_time=2
)
# Move Spot forward
await spot.move_forward(0.2, 1)
# scan the ground
await spot.set_ee_pose(
x=p1[0],
y=p1[1],
z=p1[2],
move_time=2
)
# Move Spot forward
await spot.move_forward(0.2, 1)
if __name__ == "__main__":
asyncio.run(main())