apirrone
commited on
Commit
·
66a5bd7
1
Parent(s):
43f8926
update
Browse files- index.html +1 -1
- pyproject.toml +4 -1
- reachy_mini_greetings/main.py +89 -13
index.html
CHANGED
|
@@ -39,7 +39,7 @@
|
|
| 39 |
|
| 40 |
<button id="installBtn" class="install-btn primary">
|
| 41 |
<span class="btn-icon">📥</span>
|
| 42 |
-
Install Greetings App to Reachy
|
| 43 |
</button>
|
| 44 |
|
| 45 |
<div id="installStatus" class="install-status"></div>
|
|
|
|
| 39 |
|
| 40 |
<button id="installBtn" class="install-btn primary">
|
| 41 |
<span class="btn-icon">📥</span>
|
| 42 |
+
Install Greetings App to Reachy Mini
|
| 43 |
</button>
|
| 44 |
|
| 45 |
<div id="installStatus" class="install-status"></div>
|
pyproject.toml
CHANGED
|
@@ -11,8 +11,11 @@ readme = "README.md"
|
|
| 11 |
requires-python = ">=3.8"
|
| 12 |
dependencies = [
|
| 13 |
"reachy-mini",
|
| 14 |
-
"reachy-mini-toolbox
|
| 15 |
]
|
| 16 |
|
| 17 |
[project.entry-points."reachy_mini_apps"]
|
| 18 |
reachy_mini_greetings = "reachy_mini_greetings.main:GreetingsApp"
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
requires-python = ">=3.8"
|
| 12 |
dependencies = [
|
| 13 |
"reachy-mini",
|
| 14 |
+
"reachy-mini-toolbox[vision]>=1.0.1"
|
| 15 |
]
|
| 16 |
|
| 17 |
[project.entry-points."reachy_mini_apps"]
|
| 18 |
reachy_mini_greetings = "reachy_mini_greetings.main:GreetingsApp"
|
| 19 |
+
|
| 20 |
+
[project.scripts]
|
| 21 |
+
reachy-mini-greetings = "reachy_mini_greetings.main:main"
|
reachy_mini_greetings/main.py
CHANGED
|
@@ -4,25 +4,101 @@ import time
|
|
| 4 |
import numpy as np
|
| 5 |
from reachy_mini import ReachyMiniApp
|
| 6 |
from reachy_mini.reachy_mini import ReachyMini
|
|
|
|
| 7 |
from scipy.spatial.transform import Rotation as R
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
class GreetingsApp(ReachyMiniApp):
|
| 11 |
def run(self, reachy_mini: ReachyMini, stop_event: threading.Event):
|
|
|
|
|
|
|
|
|
|
| 12 |
t0 = time.time()
|
| 13 |
while not stop_event.is_set():
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
pose
|
| 23 |
-
pose
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
time.sleep(0.02)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
import numpy as np
|
| 5 |
from reachy_mini import ReachyMiniApp
|
| 6 |
from reachy_mini.reachy_mini import ReachyMini
|
| 7 |
+
from reachy_mini_toolbox.vision import HeadTracker
|
| 8 |
from scipy.spatial.transform import Rotation as R
|
| 9 |
+
from reachy_mini.utils import create_head_pose
|
| 10 |
+
from reachy_mini.motion.recorded_move import RecordedMoves
|
| 11 |
+
import time
|
| 12 |
|
| 13 |
|
| 14 |
class GreetingsApp(ReachyMiniApp):
|
| 15 |
def run(self, reachy_mini: ReachyMini, stop_event: threading.Event):
|
| 16 |
+
head_tracker = HeadTracker()
|
| 17 |
+
recorded_moves = RecordedMoves("pollen-robotics/reachy-mini-emotions-library")
|
| 18 |
+
|
| 19 |
t0 = time.time()
|
| 20 |
while not stop_event.is_set():
|
| 21 |
+
frame = reachy_mini.media.get_frame()
|
| 22 |
+
# cv2.imshow("frame", frame)
|
| 23 |
+
# cv2.waitKey(1)
|
| 24 |
+
|
| 25 |
+
pose = create_head_pose(0, 0, 0, 0, 0, 0)
|
| 26 |
+
reachy_mini.goto_target(pose, duration=1, antennas=[0, 0], method="ease_in_out")
|
| 27 |
+
time.sleep(0.5)
|
| 28 |
+
|
| 29 |
+
pose = create_head_pose(-0.01, 0, -0.035, 0, 15, 0)
|
| 30 |
+
reachy_mini.goto_target(pose, duration=0.3, antennas=[-1.5, 1.5], method="ease_in_out")
|
| 31 |
+
time.sleep(0.2)
|
| 32 |
+
|
| 33 |
+
pose = create_head_pose(0, 0, -0.02, 0, 0, 0)
|
| 34 |
+
reachy_mini.goto_target(pose, duration=2, antennas=[-1, 1], method="ease_in_out")
|
| 35 |
+
time.sleep(0.5)
|
| 36 |
+
|
| 37 |
+
pose = create_head_pose(0.0, 0.02, -0.02, 20, 0, 0)
|
| 38 |
+
reachy_mini.goto_target(pose, duration=0.5, antennas=[-1.5, 0], method="ease_in_out")
|
| 39 |
+
time.sleep(0.2)
|
| 40 |
+
|
| 41 |
+
pose = create_head_pose(0.0, -0.02, -0.02, -20, 0, 0)
|
| 42 |
+
reachy_mini.goto_target(pose, duration=0.5, antennas=[0, 1.6], method="ease_in_out")
|
| 43 |
+
time.sleep(0.2)
|
| 44 |
+
|
| 45 |
+
pose = create_head_pose(0, 0, 0, 0, 0, 0)
|
| 46 |
+
reachy_mini.goto_target(pose, duration=0.5, antennas=[0, 0], method="ease_in_out")
|
| 47 |
+
|
| 48 |
+
# look a little to the left and up
|
| 49 |
+
# pose = create_head_pose(0, 0, 0, 0, -15, -30)
|
| 50 |
+
# reachy_mini.goto_target(pose, duration=1, method="ease_in_out")
|
| 51 |
+
# time.sleep(0.5)
|
| 52 |
+
|
| 53 |
+
# pose = create_head_pose(0, 0, 0, 0, -15, 30)
|
| 54 |
+
# reachy_mini.goto_target(pose, duration=1, method="ease_in_out")
|
| 55 |
+
# time.sleep(0.5)
|
| 56 |
+
|
| 57 |
+
# pose = create_head_pose(0, 0, 0, 0, 15, 20)
|
| 58 |
+
# reachy_mini.goto_target(pose, duration=1, method="ease_in_out")
|
| 59 |
+
# time.sleep(0.5)
|
| 60 |
+
|
| 61 |
+
# pose = create_head_pose(0, 0, 0, 0, -20, -40)
|
| 62 |
+
# reachy_mini.goto_target(pose, duration=1, method="ease_in_out")
|
| 63 |
+
# time.sleep(0.5)
|
| 64 |
+
|
| 65 |
+
pose = create_head_pose(0, 0, 0.02, 0, -20, -140)
|
| 66 |
+
reachy_mini.goto_target(
|
| 67 |
+
pose, body_yaw=np.deg2rad(-100), duration=1, antennas=[-1.5, 0], method="ease_in_out"
|
| 68 |
+
)
|
| 69 |
+
time.sleep(0.5)
|
| 70 |
+
|
| 71 |
+
pose = create_head_pose(0, 0, 0, 0, 0, 0)
|
| 72 |
+
reachy_mini.goto_target(pose, duration=1, antennas=[0, 0], method="ease_in_out")
|
| 73 |
+
|
| 74 |
+
pose = create_head_pose(0, 0, 0.02, 0, -30, 100)
|
| 75 |
+
reachy_mini.goto_target(
|
| 76 |
+
pose, body_yaw=np.deg2rad(80), duration=1, antennas=[0, 1.5], method="ease_in_out"
|
| 77 |
+
)
|
| 78 |
+
time.sleep(0.5)
|
| 79 |
+
|
| 80 |
+
print("reset")
|
| 81 |
|
| 82 |
time.sleep(0.02)
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
def main():
|
| 86 |
+
with ReachyMini() as mini:
|
| 87 |
+
app = GreetingsApp()
|
| 88 |
+
|
| 89 |
+
stop = threading.Event()
|
| 90 |
+
|
| 91 |
+
try:
|
| 92 |
+
print("Running 'greetings' a ReachyMiniApp...")
|
| 93 |
+
print("Press Ctrl+C to stop the app.")
|
| 94 |
+
app.run(mini, stop)
|
| 95 |
+
print("App has stopped.")
|
| 96 |
+
|
| 97 |
+
except KeyboardInterrupt:
|
| 98 |
+
print("Stopping the app...")
|
| 99 |
+
stop.set()
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
if __name__ == "__main__":
|
| 103 |
+
# You can run the app directly from this script
|
| 104 |
+
main()
|