reachy-mini 1.2.5rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- reachy_mini/__init__.py +4 -0
- reachy_mini/apps/__init__.py +25 -0
- reachy_mini/apps/app.py +258 -0
- reachy_mini/apps/assistant.py +787 -0
- reachy_mini/apps/manager.py +312 -0
- reachy_mini/apps/sources/__init__.py +4 -0
- reachy_mini/apps/sources/hf_space.py +106 -0
- reachy_mini/apps/sources/local_common_venv.py +567 -0
- reachy_mini/apps/templates/README.md.j2 +12 -0
- reachy_mini/apps/templates/gitignore.j2 +3 -0
- reachy_mini/apps/templates/index.html.j2 +40 -0
- reachy_mini/apps/templates/main.py.j2 +74 -0
- reachy_mini/apps/templates/pyproject.toml.j2 +28 -0
- reachy_mini/apps/templates/static/index.html.j2 +27 -0
- reachy_mini/apps/templates/static/main.js.j2 +47 -0
- reachy_mini/apps/templates/static/style.css.j2 +25 -0
- reachy_mini/apps/templates/style.css.j2 +411 -0
- reachy_mini/apps/utils.py +30 -0
- reachy_mini/assets/config/hardware_config.yaml +164 -0
- reachy_mini/assets/confused1.wav +0 -0
- reachy_mini/assets/count.wav +0 -0
- reachy_mini/assets/dance1.wav +0 -0
- reachy_mini/assets/firmware/CHANGELOG.md +15 -0
- reachy_mini/assets/firmware/reachymini_ua_io16_lin_v2.1.2.bin +0 -0
- reachy_mini/assets/firmware/reachymini_ua_io16_lin_v2.1.3.bin +0 -0
- reachy_mini/assets/firmware/update.sh +9 -0
- reachy_mini/assets/go_sleep.wav +0 -0
- reachy_mini/assets/impatient1.wav +0 -0
- reachy_mini/assets/kinematics_data.json +253 -0
- reachy_mini/assets/models/fknetwork.dynamic.onnx +0 -0
- reachy_mini/assets/models/fknetwork.onnx +0 -0
- reachy_mini/assets/models/fknetwork_int8.onnx +0 -0
- reachy_mini/assets/models/iknetwork.onnx +0 -0
- reachy_mini/assets/wake_up.wav +0 -0
- reachy_mini/daemon/__init__.py +1 -0
- reachy_mini/daemon/app/__init__.py +1 -0
- reachy_mini/daemon/app/bg_job_register.py +142 -0
- reachy_mini/daemon/app/dashboard/static/assets/KO-cartoon-static.svg +40 -0
- reachy_mini/daemon/app/dashboard/static/assets/awake-cartoon-static.svg +42 -0
- reachy_mini/daemon/app/dashboard/static/assets/awake-cartoon.svg +6 -0
- reachy_mini/daemon/app/dashboard/static/assets/go-to-sleep-cartoon.svg +6 -0
- reachy_mini/daemon/app/dashboard/static/assets/no-wifi-cartoon-static.svg +50 -0
- reachy_mini/daemon/app/dashboard/static/assets/no-wifi-cartoon.svg +6 -0
- reachy_mini/daemon/app/dashboard/static/assets/reachy-mini-awake.svg +18 -0
- reachy_mini/daemon/app/dashboard/static/assets/reachy-mini-connection-lost-animation.svg +6 -0
- reachy_mini/daemon/app/dashboard/static/assets/reachy-mini-go-to-sleep-animation.svg +6 -0
- reachy_mini/daemon/app/dashboard/static/assets/reachy-mini-ko-animation.svg +6 -0
- reachy_mini/daemon/app/dashboard/static/assets/reachy-mini-ko.svg +22 -0
- reachy_mini/daemon/app/dashboard/static/assets/reachy-mini-sleeping-static.svg +41 -0
- reachy_mini/daemon/app/dashboard/static/assets/reachy-mini-sleeping.svg +18 -0
- reachy_mini/daemon/app/dashboard/static/assets/reachy-mini-wake-up-animation.svg +6 -0
- reachy_mini/daemon/app/dashboard/static/css/app.css +1433 -0
- reachy_mini/daemon/app/dashboard/static/fonts/Archivo-Italic-VariableFont_wdth,wght.ttf +0 -0
- reachy_mini/daemon/app/dashboard/static/fonts/Archivo-VariableFont_wdth,wght.ttf +0 -0
- reachy_mini/daemon/app/dashboard/static/fonts/Asap-Italic-VariableFont_wdth,wght.ttf +0 -0
- reachy_mini/daemon/app/dashboard/static/fonts/Asap-VariableFont_wdth,wght.ttf +0 -0
- reachy_mini/daemon/app/dashboard/static/js/3rdparty/gstwebrtc-api-2.0.0.min.js +5 -0
- reachy_mini/daemon/app/dashboard/static/js/apps.js +323 -0
- reachy_mini/daemon/app/dashboard/static/js/appstore.js +167 -0
- reachy_mini/daemon/app/dashboard/static/js/daemon.js +169 -0
- reachy_mini/daemon/app/dashboard/static/js/health_check.js +9 -0
- reachy_mini/daemon/app/dashboard/static/js/move_player.js +132 -0
- reachy_mini/daemon/app/dashboard/static/js/notification.js +41 -0
- reachy_mini/daemon/app/dashboard/static/js/update.js +132 -0
- reachy_mini/daemon/app/dashboard/static/js/volume_control.js +252 -0
- reachy_mini/daemon/app/dashboard/static/js/wifi.js +176 -0
- reachy_mini/daemon/app/dashboard/tailwindcss/README.md +15 -0
- reachy_mini/daemon/app/dashboard/tailwindcss/package-lock.json +1127 -0
- reachy_mini/daemon/app/dashboard/tailwindcss/package.json +6 -0
- reachy_mini/daemon/app/dashboard/tailwindcss/pnpm-lock.yaml +608 -0
- reachy_mini/daemon/app/dashboard/tailwindcss/postcss.config.js +6 -0
- reachy_mini/daemon/app/dashboard/tailwindcss/styles/app.css +185 -0
- reachy_mini/daemon/app/dashboard/tailwindcss/tailwind.config.js +11 -0
- reachy_mini/daemon/app/dashboard/templates/base.html +21 -0
- reachy_mini/daemon/app/dashboard/templates/index.html +20 -0
- reachy_mini/daemon/app/dashboard/templates/sections/apps.html +8 -0
- reachy_mini/daemon/app/dashboard/templates/sections/appstore.html +35 -0
- reachy_mini/daemon/app/dashboard/templates/sections/daemon.html +45 -0
- reachy_mini/daemon/app/dashboard/templates/sections/move_player.html +121 -0
- reachy_mini/daemon/app/dashboard/templates/sections/notification.html +19 -0
- reachy_mini/daemon/app/dashboard/templates/sections/update.html +54 -0
- reachy_mini/daemon/app/dashboard/templates/sections/wifi.html +46 -0
- reachy_mini/daemon/app/dashboard/templates/settings.html +14 -0
- reachy_mini/daemon/app/dependencies.py +41 -0
- reachy_mini/daemon/app/main.py +469 -0
- reachy_mini/daemon/app/models.py +149 -0
- reachy_mini/daemon/app/routers/apps.py +114 -0
- reachy_mini/daemon/app/routers/daemon.py +85 -0
- reachy_mini/daemon/app/routers/kinematics.py +57 -0
- reachy_mini/daemon/app/routers/motors.py +41 -0
- reachy_mini/daemon/app/routers/move.py +265 -0
- reachy_mini/daemon/app/routers/state.py +146 -0
- reachy_mini/daemon/app/routers/update.py +86 -0
- reachy_mini/daemon/app/routers/volume.py +423 -0
- reachy_mini/daemon/app/routers/wifi_config.py +219 -0
- reachy_mini/daemon/app/services/__init__.py +1 -0
- reachy_mini/daemon/app/services/bluetooth/bluetooth_service.py +796 -0
- reachy_mini/daemon/app/services/bluetooth/commands/HOTSPOT.sh +7 -0
- reachy_mini/daemon/app/services/bluetooth/commands/RESTART_DAEMON.sh +4 -0
- reachy_mini/daemon/app/services/bluetooth/commands/SOFTWARE_RESET.sh +7 -0
- reachy_mini/daemon/app/services/bluetooth/install_service_bluetooth.sh +39 -0
- reachy_mini/daemon/app/services/gpio_shutdown/__init__.py +1 -0
- reachy_mini/daemon/app/services/gpio_shutdown/install_service.sh +33 -0
- reachy_mini/daemon/app/services/gpio_shutdown/launcher.sh +3 -0
- reachy_mini/daemon/app/services/gpio_shutdown/shutdown_monitor.py +28 -0
- reachy_mini/daemon/app/services/wireless/generate_asoundrc.sh +70 -0
- reachy_mini/daemon/app/services/wireless/install_service.sh +33 -0
- reachy_mini/daemon/app/services/wireless/launcher.sh +5 -0
- reachy_mini/daemon/backend/__init__.py +1 -0
- reachy_mini/daemon/backend/abstract.py +815 -0
- reachy_mini/daemon/backend/mujoco/__init__.py +36 -0
- reachy_mini/daemon/backend/mujoco/backend.py +395 -0
- reachy_mini/daemon/backend/mujoco/utils.py +59 -0
- reachy_mini/daemon/backend/mujoco/video_udp.py +57 -0
- reachy_mini/daemon/backend/robot/__init__.py +8 -0
- reachy_mini/daemon/backend/robot/backend.py +597 -0
- reachy_mini/daemon/daemon.py +651 -0
- reachy_mini/daemon/utils.py +116 -0
- reachy_mini/descriptions/reachy_mini/mjcf/additional.xml +6 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/5w_speaker.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/5w_speaker.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/antenna.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/antenna.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/antenna_body_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/antenna_body_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/antenna_holder_l_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/antenna_holder_l_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/antenna_holder_r_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/antenna_holder_r_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/antenna_interface_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/antenna_interface_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/arducam.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/arducam.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/b3b_eh.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/b3b_eh.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/b3b_eh_1.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/b3b_eh_1.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/bearing_85x110x13.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/bearing_85x110x13.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/big_lens_d40.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/big_lens_d40.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/body_down_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/body_down_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/body_foot_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/body_foot_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/body_top_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/body_top_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/body_turning_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/body_turning_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/bts2_m2_6x8.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/bts2_m2_6x8.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/collision/README.m +1 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/collision/coarse/body_top_3dprint_collider_back_0.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/collision/coarse/body_top_3dprint_collider_back_1.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/collision/coarse/body_top_3dprint_collider_back_2.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/collision/coarse/body_top_3dprint_collider_back_3.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/collision/coarse/body_top_3dprint_collider_front_0.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/collision/coarse/body_top_3dprint_collider_front_1.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/collision/coarse/body_top_3dprint_collider_front_2.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/collision/coarse/head_one_3dprint_collider_0.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/collision/fine/body_top_3dprint_collider_back_0.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/collision/fine/body_top_3dprint_collider_back_1.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/collision/fine/body_top_3dprint_collider_back_2.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/collision/fine/body_top_3dprint_collider_back_3.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/collision/fine/body_top_3dprint_collider_front_0.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/collision/fine/body_top_3dprint_collider_front_1.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/collision/fine/body_top_3dprint_collider_front_2.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/collision/fine/head_one_3dprint_collider_0.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/croissant_1k.blend/croissant_1k.obj +5021 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/croissant_1k.blend/textures/croissant_diff_1k.png +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/dc15_a01_case_b_dummy.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/dc15_a01_case_b_dummy.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/dc15_a01_case_f_dummy.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/dc15_a01_case_f_dummy.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/dc15_a01_case_m_dummy.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/dc15_a01_case_m_dummy.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/dc15_a01_horn_dummy.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/dc15_a01_horn_dummy.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/dc15_a01_led_cap2_dummy.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/dc15_a01_led_cap2_dummy.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/food_apple_01_1k.blend/food_apple_01_1k.obj +18045 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/food_apple_01_1k.blend/textures/food_apple_01_diff_1k.png +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/glasses_dolder_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/glasses_dolder_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/head_back_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/head_back_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/head_front_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/head_front_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/head_mic_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/head_mic_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/lens_cap_d30_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/lens_cap_d30_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/lens_cap_d40_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/lens_cap_d40_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/m12_fisheye_lens_1_8mm.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/m12_fisheye_lens_1_8mm.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/mp01062_stewart_arm_3.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/mp01062_stewart_arm_3.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/neck_reference_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/neck_reference_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/phs_1_7x20_5_dc10.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/phs_1_7x20_5_dc10.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/phs_1_7x20_5_dc10_1.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/phs_1_7x20_5_dc10_1.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/phs_1_7x20_5_dc10_2.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/phs_1_7x20_5_dc10_2.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/phs_1_7x20_5_dc10_3.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/phs_1_7x20_5_dc10_3.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/pp01102_arducam_carter.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/pp01102_arducam_carter.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/rubber_duck_toy_1k.blend/rubber_duck_toy_1k.obj +8940 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/rubber_duck_toy_1k.blend/textures/rubber_duck_toy_diff_1k.png +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/small_lens_d30.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/small_lens_d30.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/stewart_link_ball.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/stewart_link_ball.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/stewart_link_ball__2.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/stewart_link_ball__2.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/stewart_link_rod.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/stewart_link_rod.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/stewart_main_plate_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/stewart_main_plate_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/stewart_tricap_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/stewart_tricap_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/wooden_table_02_1k.blend/textures/wooden_table_02_diff_1k.png +0 -0
- reachy_mini/descriptions/reachy_mini/mjcf/assets/wooden_table_02_1k.blend/wooden_table_02_1k.obj +485 -0
- reachy_mini/descriptions/reachy_mini/mjcf/config.json +21 -0
- reachy_mini/descriptions/reachy_mini/mjcf/joints_properties.xml +29 -0
- reachy_mini/descriptions/reachy_mini/mjcf/reachy_mini.xml +642 -0
- reachy_mini/descriptions/reachy_mini/mjcf/reachy_mini.xml.bak +442 -0
- reachy_mini/descriptions/reachy_mini/mjcf/scene.xml +24 -0
- reachy_mini/descriptions/reachy_mini/mjcf/scenes/empty.xml +27 -0
- reachy_mini/descriptions/reachy_mini/mjcf/scenes/minimal.xml +132 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/5w_speaker.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/5w_speaker.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/antenna.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/antenna.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/antenna_body_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/antenna_body_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/antenna_holder_l_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/antenna_holder_l_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/antenna_holder_r_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/antenna_holder_r_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/antenna_interface_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/antenna_interface_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/arducam.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/arducam.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/arm.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/arm.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/b3b_eh.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/b3b_eh.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/b3b_eh_1.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/b3b_eh_1.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/ball.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/ball.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/bearing_85x110x13.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/bearing_85x110x13.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/big_lens.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/big_lens.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/big_lens_d40.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/big_lens_d40.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/body_down_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/body_down_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/body_foot_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/body_foot_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/body_top_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/body_top_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/body_turning_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/body_turning_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/bottom_body.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/bottom_body.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/bts2_m2_6x8.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/bts2_m2_6x8.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/collision/README.m +1 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/collision/coarse/body_top_3dprint_collider_back_0.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/collision/coarse/body_top_3dprint_collider_back_1.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/collision/coarse/body_top_3dprint_collider_back_2.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/collision/coarse/body_top_3dprint_collider_back_3.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/collision/coarse/body_top_3dprint_collider_front_0.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/collision/coarse/body_top_3dprint_collider_front_1.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/collision/coarse/body_top_3dprint_collider_front_2.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/collision/coarse/head_one_3dprint_collider_0.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/collision/fine/body_top_3dprint_collider_back_0.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/collision/fine/body_top_3dprint_collider_back_1.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/collision/fine/body_top_3dprint_collider_back_2.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/collision/fine/body_top_3dprint_collider_back_3.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/collision/fine/body_top_3dprint_collider_front_0.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/collision/fine/body_top_3dprint_collider_front_1.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/collision/fine/body_top_3dprint_collider_front_2.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/collision/fine/head_one_3dprint_collider_0.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/dc15_a01_case_b_dummy.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/dc15_a01_case_b_dummy.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/dc15_a01_case_f_dummy.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/dc15_a01_case_f_dummy.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/dc15_a01_case_m_dummy.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/dc15_a01_case_m_dummy.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/dc15_a01_horn_dummy.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/dc15_a01_horn_dummy.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/dc15_a01_led_cap2_dummy.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/dc15_a01_led_cap2_dummy.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/drive_palonier__configuration_default.part +14 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/drive_palonier__configuration_default.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/drive_palonier__configuration_simple_axe.part +14 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/drive_palonier__configuration_simple_axe.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/eye_support.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/eye_support.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/foot.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/foot.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/glasses_dolder_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/glasses_dolder_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/head_back_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/head_back_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/head_front_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/head_front_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/head_head_back.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/head_head_back.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/head_interface.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/head_interface.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/head_mic_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/head_mic_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/head_shell_front.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/head_shell_front.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/lens_cap_d30_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/lens_cap_d30_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/lens_cap_d40_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/lens_cap_d40_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/m12_fisheye_lens_1_8mm.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/m12_fisheye_lens_1_8mm.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/m12_lens.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/m12_lens.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/main_plate.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/main_plate.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/mid_plate.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/mid_plate.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/mp01062_stewart_arm_3.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/mp01062_stewart_arm_3.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/neck_reference_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/neck_reference_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/phs_1_7x20_5_dc10.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/phs_1_7x20_5_dc10.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/phs_1_7x20_5_dc10_1.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/phs_1_7x20_5_dc10_1.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/phs_1_7x20_5_dc10_2.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/phs_1_7x20_5_dc10_2.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/phs_1_7x20_5_dc10_3.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/phs_1_7x20_5_dc10_3.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/plateform.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/plateform.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp00xxx_stewart_rod.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp00xxx_stewart_rod.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01062_stewart_arm.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01062_stewart_arm.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01063_stewart_plateform.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01063_stewart_plateform.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01064_stewart_main_plate.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01064_stewart_main_plate.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01065_stewart_side_plate.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01065_stewart_side_plate.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01066_stewart_mid_plate.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01066_stewart_mid_plate.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01067_bottom_body.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01067_bottom_body.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01068_top_body.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01068_top_body.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01069_head_shell_front.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01069_head_shell_front.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01070_head_head_back.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01070_head_head_back.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01071_turning_bowl.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01071_turning_bowl.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01072_turning_end.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01072_turning_end.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01078_glasses.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01078_glasses.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01079_back_big_eye.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01079_back_big_eye.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01080_back_small_eye.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01080_back_small_eye.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01102_arducam_carter.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/pp01102_arducam_carter.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/rod.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/rod.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/shape.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/shape.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/side_plate.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/side_plate.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/small_lens.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/small_lens.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/small_lens_d30.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/small_lens_d30.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/stewart_link_ball.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/stewart_link_ball.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/stewart_link_ball__2.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/stewart_link_ball__2.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/stewart_link_rod.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/stewart_link_rod.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/stewart_main_plate_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/stewart_main_plate_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/stewart_tricap_3dprint.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/stewart_tricap_3dprint.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/test_antenna.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/test_antenna.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/test_antenna_body.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/test_antenna_body.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/top_body.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/top_body.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/turning_bowl.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/turning_bowl.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/uc_a37_rev_a_step.part +13 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/uc_a37_rev_a_step.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/wj_wk00_0122topcabinetcase_95__configuration_default.part +14 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/wj_wk00_0122topcabinetcase_95__configuration_default.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/wj_wk00_0122topcabinetcase_95__configuration_simple_axe.part +14 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/wj_wk00_0122topcabinetcase_95__configuration_simple_axe.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/wj_wk00_0123middlecase_56__configuration_default.part +14 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/wj_wk00_0123middlecase_56__configuration_default.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/wj_wk00_0123middlecase_56__configuration_simple_axe.part +14 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/wj_wk00_0123middlecase_56__configuration_simple_axe.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/wj_wk00_0124bottomcase_45__configuration_default.part +14 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/wj_wk00_0124bottomcase_45__configuration_default.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/wj_wk00_0124bottomcase_45__configuration_simple_axe.part +14 -0
- reachy_mini/descriptions/reachy_mini/urdf/assets/wj_wk00_0124bottomcase_45__configuration_simple_axe.stl +0 -0
- reachy_mini/descriptions/reachy_mini/urdf/config.json +18 -0
- reachy_mini/descriptions/reachy_mini/urdf/robot.urdf +3281 -0
- reachy_mini/descriptions/reachy_mini/urdf/robot.urdf.bak +3282 -0
- reachy_mini/descriptions/reachy_mini/urdf/robot_no_collision.urdf +2316 -0
- reachy_mini/descriptions/reachy_mini/urdf/robot_simple_collision.urdf +2399 -0
- reachy_mini/io/__init__.py +15 -0
- reachy_mini/io/abstract.py +70 -0
- reachy_mini/io/audio_ws.py +242 -0
- reachy_mini/io/protocol.py +44 -0
- reachy_mini/io/video_ws.py +135 -0
- reachy_mini/io/ws_controller.py +120 -0
- reachy_mini/io/zenoh_client.py +273 -0
- reachy_mini/io/zenoh_server.py +230 -0
- reachy_mini/kinematics/__init__.py +68 -0
- reachy_mini/kinematics/analytical_kinematics.py +151 -0
- reachy_mini/kinematics/nn_kinematics.py +109 -0
- reachy_mini/kinematics/placo_kinematics.py +656 -0
- reachy_mini/media/__init__.py +1 -0
- reachy_mini/media/audio_base.py +111 -0
- reachy_mini/media/audio_control_utils.py +455 -0
- reachy_mini/media/audio_gstreamer.py +272 -0
- reachy_mini/media/audio_sounddevice.py +321 -0
- reachy_mini/media/audio_utils.py +114 -0
- reachy_mini/media/camera_base.py +100 -0
- reachy_mini/media/camera_constants.py +152 -0
- reachy_mini/media/camera_gstreamer.py +231 -0
- reachy_mini/media/camera_opencv.py +89 -0
- reachy_mini/media/camera_utils.py +111 -0
- reachy_mini/media/media_manager.py +281 -0
- reachy_mini/media/webrtc_client_gstreamer.py +288 -0
- reachy_mini/media/webrtc_daemon.py +334 -0
- reachy_mini/motion/__init__.py +4 -0
- reachy_mini/motion/goto.py +71 -0
- reachy_mini/motion/move.py +43 -0
- reachy_mini/motion/recorded_move.py +146 -0
- reachy_mini/reachy_mini.py +753 -0
- reachy_mini/tools/reflash_motors.py +116 -0
- reachy_mini/tools/setup_motor.py +422 -0
- reachy_mini/tools/setup_motor_rpi.py +108 -0
- reachy_mini/utils/__init__.py +46 -0
- reachy_mini/utils/constants.py +9 -0
- reachy_mini/utils/hardware_config/__init__.py +1 -0
- reachy_mini/utils/hardware_config/parser.py +65 -0
- reachy_mini/utils/interpolation.py +227 -0
- reachy_mini/utils/parse_urdf_for_kinematics.py +110 -0
- reachy_mini/utils/rerun.py +320 -0
- reachy_mini/utils/wireless_version/__init__.py +1 -0
- reachy_mini/utils/wireless_version/startup_check.py +144 -0
- reachy_mini/utils/wireless_version/update.py +20 -0
- reachy_mini/utils/wireless_version/update_available.py +61 -0
- reachy_mini/utils/wireless_version/utils.py +39 -0
- reachy_mini-1.2.5rc1.dist-info/METADATA +161 -0
- reachy_mini-1.2.5rc1.dist-info/RECORD +479 -0
- reachy_mini-1.2.5rc1.dist-info/WHEEL +5 -0
- reachy_mini-1.2.5rc1.dist-info/entry_points.txt +4 -0
- reachy_mini-1.2.5rc1.dist-info/licenses/LICENSE +201 -0
- reachy_mini-1.2.5rc1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
"""WebRTC daemon.
|
|
2
|
+
|
|
3
|
+
Starts a gstreamer webrtc pipeline to stream video and audio.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import logging
|
|
7
|
+
from threading import Thread
|
|
8
|
+
from typing import Optional, Tuple, cast
|
|
9
|
+
|
|
10
|
+
import gi
|
|
11
|
+
|
|
12
|
+
from reachy_mini.media.camera_constants import (
|
|
13
|
+
ArducamSpecs,
|
|
14
|
+
CameraSpecs,
|
|
15
|
+
ReachyMiniLiteCamSpecs,
|
|
16
|
+
ReachyMiniWirelessCamSpecs,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
gi.require_version("Gst", "1.0")
|
|
20
|
+
gi.require_version("GstApp", "1.0")
|
|
21
|
+
|
|
22
|
+
from gi.repository import GLib, Gst # noqa: E402
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class GstWebRTC:
|
|
26
|
+
"""WebRTC pipeline using GStreamer."""
|
|
27
|
+
|
|
28
|
+
def __init__(
|
|
29
|
+
self,
|
|
30
|
+
log_level: str = "INFO",
|
|
31
|
+
) -> None:
|
|
32
|
+
"""Initialize the GStreamer WebRTC pipeline."""
|
|
33
|
+
self._logger = logging.getLogger(__name__)
|
|
34
|
+
self._logger.setLevel(log_level)
|
|
35
|
+
|
|
36
|
+
# self._id_audio_card = get_respeaker_card_number()
|
|
37
|
+
|
|
38
|
+
Gst.init(None)
|
|
39
|
+
self._loop = GLib.MainLoop()
|
|
40
|
+
self._thread_bus_calls = Thread(target=lambda: self._loop.run(), daemon=True)
|
|
41
|
+
self._thread_bus_calls.start()
|
|
42
|
+
|
|
43
|
+
cam_path, self.camera_specs = self._get_video_device()
|
|
44
|
+
|
|
45
|
+
if self.camera_specs is None:
|
|
46
|
+
raise RuntimeError("Camera specs not set")
|
|
47
|
+
self._resolution = self.camera_specs.default_resolution
|
|
48
|
+
self.resized_K = self.camera_specs.K
|
|
49
|
+
|
|
50
|
+
if self._resolution is None:
|
|
51
|
+
raise RuntimeError("Failed to get default camera resolution.")
|
|
52
|
+
|
|
53
|
+
self._pipeline_sender = Gst.Pipeline.new("reachymini_webrtc_sender")
|
|
54
|
+
self._bus_sender = self._pipeline_sender.get_bus()
|
|
55
|
+
self._bus_sender.add_watch(
|
|
56
|
+
GLib.PRIORITY_DEFAULT, self._on_bus_message, self._loop
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
webrtcsink = self._configure_webrtc(self._pipeline_sender)
|
|
60
|
+
|
|
61
|
+
self._configure_video(cam_path, self._pipeline_sender, webrtcsink)
|
|
62
|
+
self._configure_audio(self._pipeline_sender, webrtcsink)
|
|
63
|
+
|
|
64
|
+
self._pipeline_receiver = Gst.Pipeline.new("reachymini_webrtc_receiver")
|
|
65
|
+
self._bus_receiver = self._pipeline_receiver.get_bus()
|
|
66
|
+
self._bus_receiver.add_watch(
|
|
67
|
+
GLib.PRIORITY_DEFAULT, self._on_bus_message, self._loop
|
|
68
|
+
)
|
|
69
|
+
self._configure_receiver(self._pipeline_receiver)
|
|
70
|
+
|
|
71
|
+
def __del__(self) -> None:
|
|
72
|
+
"""Destructor to ensure gstreamer resources are released."""
|
|
73
|
+
self._loop.quit()
|
|
74
|
+
self._bus_sender.remove_watch()
|
|
75
|
+
self._bus_receiver.remove_watch()
|
|
76
|
+
|
|
77
|
+
def _configure_webrtc(self, pipeline: Gst.Pipeline) -> Gst.Element:
|
|
78
|
+
self._logger.debug("Configuring WebRTC")
|
|
79
|
+
webrtcsink = Gst.ElementFactory.make("webrtcsink")
|
|
80
|
+
if not webrtcsink:
|
|
81
|
+
raise RuntimeError(
|
|
82
|
+
"Failed to create webrtcsink element. Is the GStreamer webrtc rust plugin installed?"
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
meta_structure = Gst.Structure.new_empty("meta")
|
|
86
|
+
meta_structure.set_value("name", "reachymini")
|
|
87
|
+
webrtcsink.set_property("meta", meta_structure)
|
|
88
|
+
webrtcsink.set_property("run-signalling-server", True)
|
|
89
|
+
|
|
90
|
+
pipeline.add(webrtcsink)
|
|
91
|
+
|
|
92
|
+
return webrtcsink
|
|
93
|
+
|
|
94
|
+
def _configure_receiver(self, pipeline: Gst.Pipeline) -> None:
|
|
95
|
+
udpsrc = Gst.ElementFactory.make("udpsrc")
|
|
96
|
+
udpsrc.set_property("port", 5000)
|
|
97
|
+
caps = Gst.Caps.from_string(
|
|
98
|
+
"application/x-rtp,media=audio,encoding-name=OPUS,payload=96"
|
|
99
|
+
)
|
|
100
|
+
capsfilter = Gst.ElementFactory.make("capsfilter")
|
|
101
|
+
capsfilter.set_property("caps", caps)
|
|
102
|
+
rtpjitterbuffer = Gst.ElementFactory.make("rtpjitterbuffer")
|
|
103
|
+
rtpjitterbuffer.set_property(
|
|
104
|
+
"latency", 200
|
|
105
|
+
) # configure latency depending on network conditions
|
|
106
|
+
rtpopusdepay = Gst.ElementFactory.make("rtpopusdepay")
|
|
107
|
+
opusdec = Gst.ElementFactory.make("opusdec")
|
|
108
|
+
queue = Gst.ElementFactory.make("queue")
|
|
109
|
+
audioconvert = Gst.ElementFactory.make("audioconvert")
|
|
110
|
+
audioresample = Gst.ElementFactory.make("audioresample")
|
|
111
|
+
alsasink = Gst.ElementFactory.make("alsasink")
|
|
112
|
+
alsasink.set_property(
|
|
113
|
+
"device", "reachymini_audio_sink"
|
|
114
|
+
) # f"hw:{self._id_audio_card},0")
|
|
115
|
+
alsasink.set_property("sync", False)
|
|
116
|
+
|
|
117
|
+
pipeline.add(udpsrc)
|
|
118
|
+
pipeline.add(capsfilter)
|
|
119
|
+
pipeline.add(rtpjitterbuffer)
|
|
120
|
+
pipeline.add(rtpopusdepay)
|
|
121
|
+
pipeline.add(opusdec)
|
|
122
|
+
pipeline.add(queue)
|
|
123
|
+
pipeline.add(audioconvert)
|
|
124
|
+
pipeline.add(audioresample)
|
|
125
|
+
pipeline.add(alsasink)
|
|
126
|
+
|
|
127
|
+
udpsrc.link(capsfilter)
|
|
128
|
+
capsfilter.link(rtpjitterbuffer)
|
|
129
|
+
rtpjitterbuffer.link(rtpopusdepay)
|
|
130
|
+
rtpopusdepay.link(opusdec)
|
|
131
|
+
opusdec.link(queue)
|
|
132
|
+
queue.link(audioconvert)
|
|
133
|
+
audioconvert.link(audioresample)
|
|
134
|
+
audioresample.link(alsasink)
|
|
135
|
+
|
|
136
|
+
@property
|
|
137
|
+
def resolution(self) -> tuple[int, int]:
|
|
138
|
+
"""Get the current camera resolution as a tuple (width, height)."""
|
|
139
|
+
return (self._resolution.value[0], self._resolution.value[1])
|
|
140
|
+
|
|
141
|
+
@property
|
|
142
|
+
def framerate(self) -> int:
|
|
143
|
+
"""Get the current camera framerate."""
|
|
144
|
+
return self._resolution.value[2]
|
|
145
|
+
|
|
146
|
+
def _configure_video(
|
|
147
|
+
self, cam_path: str, pipeline: Gst.Pipeline, webrtcsink: Gst.Element
|
|
148
|
+
) -> None:
|
|
149
|
+
self._logger.debug(f"Configuring video {cam_path}")
|
|
150
|
+
camerasrc = Gst.ElementFactory.make("libcamerasrc")
|
|
151
|
+
caps = Gst.Caps.from_string(
|
|
152
|
+
f"video/x-raw,width={self.resolution[0]},height={self.resolution[1]},framerate={self.framerate}/1,format=YUY2,colorimetry=bt709,interlace-mode=progressive"
|
|
153
|
+
)
|
|
154
|
+
capsfilter = Gst.ElementFactory.make("capsfilter")
|
|
155
|
+
capsfilter.set_property("caps", caps)
|
|
156
|
+
tee = Gst.ElementFactory.make("tee")
|
|
157
|
+
# make camera accessible to other applications via unixfdsrc/sink
|
|
158
|
+
unixfdsink = Gst.ElementFactory.make("unixfdsink")
|
|
159
|
+
unixfdsink.set_property("socket-path", "/tmp/reachymini_camera_socket")
|
|
160
|
+
queue_unixfd = Gst.ElementFactory.make("queue", "queue_unixfd")
|
|
161
|
+
queue_encoder = Gst.ElementFactory.make("queue", "queue_encoder")
|
|
162
|
+
v4l2h264enc = Gst.ElementFactory.make("v4l2h264enc")
|
|
163
|
+
extra_controls_structure = Gst.Structure.new_empty("extra-controls")
|
|
164
|
+
extra_controls_structure.set_value("repeat_sequence_header", 1)
|
|
165
|
+
extra_controls_structure.set_value("video_bitrate", 5_000_000)
|
|
166
|
+
v4l2h264enc.set_property("extra-controls", extra_controls_structure)
|
|
167
|
+
caps_h264 = Gst.Caps.from_string(
|
|
168
|
+
"video/x-h264,stream-format=byte-stream,alignment=au,level=(string)4"
|
|
169
|
+
)
|
|
170
|
+
capsfilter_h264 = Gst.ElementFactory.make("capsfilter")
|
|
171
|
+
capsfilter_h264.set_property("caps", caps_h264)
|
|
172
|
+
|
|
173
|
+
if not all(
|
|
174
|
+
[
|
|
175
|
+
camerasrc,
|
|
176
|
+
capsfilter,
|
|
177
|
+
tee,
|
|
178
|
+
queue_unixfd,
|
|
179
|
+
unixfdsink,
|
|
180
|
+
queue_encoder,
|
|
181
|
+
v4l2h264enc,
|
|
182
|
+
capsfilter_h264,
|
|
183
|
+
]
|
|
184
|
+
):
|
|
185
|
+
raise RuntimeError("Failed to create GStreamer video elements")
|
|
186
|
+
|
|
187
|
+
pipeline.add(camerasrc)
|
|
188
|
+
pipeline.add(capsfilter)
|
|
189
|
+
pipeline.add(tee)
|
|
190
|
+
pipeline.add(queue_unixfd)
|
|
191
|
+
pipeline.add(unixfdsink)
|
|
192
|
+
pipeline.add(queue_encoder)
|
|
193
|
+
pipeline.add(v4l2h264enc)
|
|
194
|
+
pipeline.add(capsfilter_h264)
|
|
195
|
+
|
|
196
|
+
camerasrc.link(capsfilter)
|
|
197
|
+
capsfilter.link(tee)
|
|
198
|
+
tee.link(queue_unixfd)
|
|
199
|
+
queue_unixfd.link(unixfdsink)
|
|
200
|
+
tee.link(queue_encoder)
|
|
201
|
+
queue_encoder.link(v4l2h264enc)
|
|
202
|
+
v4l2h264enc.link(capsfilter_h264)
|
|
203
|
+
capsfilter_h264.link(webrtcsink)
|
|
204
|
+
|
|
205
|
+
def _configure_audio(self, pipeline: Gst.Pipeline, webrtcsink: Gst.Element) -> None:
|
|
206
|
+
self._logger.debug("Configuring audio")
|
|
207
|
+
|
|
208
|
+
alsasrc = Gst.ElementFactory.make("alsasrc")
|
|
209
|
+
alsasrc.set_property("device", "reachymini_audio_src")
|
|
210
|
+
|
|
211
|
+
if not all([alsasrc]):
|
|
212
|
+
raise RuntimeError("Failed to create GStreamer audio elements")
|
|
213
|
+
|
|
214
|
+
pipeline.add(alsasrc)
|
|
215
|
+
alsasrc.link(webrtcsink)
|
|
216
|
+
|
|
217
|
+
def _get_audio_input_device(self) -> Optional[str]:
|
|
218
|
+
"""Use Gst.DeviceMonitor to find the pipeire audio card.
|
|
219
|
+
|
|
220
|
+
Returns the device ID of the found audio card, None if not.
|
|
221
|
+
"""
|
|
222
|
+
monitor = Gst.DeviceMonitor()
|
|
223
|
+
monitor.add_filter("Audio/Source")
|
|
224
|
+
monitor.start()
|
|
225
|
+
|
|
226
|
+
snd_card_name = "Reachy Mini Audio"
|
|
227
|
+
|
|
228
|
+
devices = monitor.get_devices()
|
|
229
|
+
for device in devices:
|
|
230
|
+
name = device.get_display_name()
|
|
231
|
+
device_props = device.get_properties()
|
|
232
|
+
|
|
233
|
+
if snd_card_name in name:
|
|
234
|
+
if device_props and device_props.has_field("object.serial"):
|
|
235
|
+
serial = device_props.get_string("object.serial")
|
|
236
|
+
self._logger.debug(f"Found audio input device with serial {serial}")
|
|
237
|
+
monitor.stop()
|
|
238
|
+
return str(serial)
|
|
239
|
+
|
|
240
|
+
monitor.stop()
|
|
241
|
+
self._logger.warning("No source audio card found.")
|
|
242
|
+
return None
|
|
243
|
+
|
|
244
|
+
def _get_video_device(self) -> Tuple[str, Optional[CameraSpecs]]:
|
|
245
|
+
"""Use Gst.DeviceMonitor to find the unix camera path /dev/videoX.
|
|
246
|
+
|
|
247
|
+
Returns the device path (e.g., '/dev/video2'), or '' if not found.
|
|
248
|
+
"""
|
|
249
|
+
monitor = Gst.DeviceMonitor()
|
|
250
|
+
monitor.add_filter("Video/Source")
|
|
251
|
+
monitor.start()
|
|
252
|
+
|
|
253
|
+
cam_names = ["Reachy", "Arducam_12MP", "imx708"]
|
|
254
|
+
|
|
255
|
+
devices = monitor.get_devices()
|
|
256
|
+
for cam_name in cam_names:
|
|
257
|
+
for device in devices:
|
|
258
|
+
name = device.get_display_name()
|
|
259
|
+
device_props = device.get_properties()
|
|
260
|
+
|
|
261
|
+
if cam_name in name:
|
|
262
|
+
if device_props and device_props.has_field("api.v4l2.path"):
|
|
263
|
+
device_path = device_props.get_string("api.v4l2.path")
|
|
264
|
+
camera_specs = (
|
|
265
|
+
cast(CameraSpecs, ArducamSpecs)
|
|
266
|
+
if cam_name == "Arducam_12MP"
|
|
267
|
+
else cast(CameraSpecs, ReachyMiniLiteCamSpecs)
|
|
268
|
+
)
|
|
269
|
+
self._logger.debug(f"Found {cam_name} camera at {device_path}")
|
|
270
|
+
monitor.stop()
|
|
271
|
+
return str(device_path), camera_specs
|
|
272
|
+
elif cam_name == "imx708":
|
|
273
|
+
camera_specs = cast(CameraSpecs, ReachyMiniWirelessCamSpecs)
|
|
274
|
+
self._logger.debug(f"Found {cam_name} camera")
|
|
275
|
+
monitor.stop()
|
|
276
|
+
return cam_name, camera_specs
|
|
277
|
+
monitor.stop()
|
|
278
|
+
self._logger.warning("No camera found.")
|
|
279
|
+
return "", None
|
|
280
|
+
|
|
281
|
+
def _on_bus_message(self, bus: Gst.Bus, msg: Gst.Message, loop) -> bool: # type: ignore[no-untyped-def]
|
|
282
|
+
t = msg.type
|
|
283
|
+
if t == Gst.MessageType.EOS:
|
|
284
|
+
self._logger.warning("End-of-stream")
|
|
285
|
+
return False
|
|
286
|
+
|
|
287
|
+
elif t == Gst.MessageType.ERROR:
|
|
288
|
+
err, debug = msg.parse_error()
|
|
289
|
+
self._logger.error(f"Error: {err} {debug}")
|
|
290
|
+
return False
|
|
291
|
+
|
|
292
|
+
else:
|
|
293
|
+
# self._logger.warning(f"Unhandled message type: {t}")
|
|
294
|
+
pass
|
|
295
|
+
|
|
296
|
+
return True
|
|
297
|
+
|
|
298
|
+
def start(self) -> None:
|
|
299
|
+
"""Start the WebRTC pipeline."""
|
|
300
|
+
self._logger.debug("Starting WebRTC")
|
|
301
|
+
self._pipeline_sender.set_state(Gst.State.PLAYING)
|
|
302
|
+
self._pipeline_receiver.set_state(Gst.State.PLAYING)
|
|
303
|
+
|
|
304
|
+
def pause(self) -> None:
|
|
305
|
+
"""Pause the WebRTC pipeline."""
|
|
306
|
+
self._logger.debug("Pausing WebRTC")
|
|
307
|
+
self._pipeline_sender.set_state(Gst.State.PAUSED)
|
|
308
|
+
self._pipeline_receiver.set_state(Gst.State.PAUSED)
|
|
309
|
+
|
|
310
|
+
def stop(self) -> None:
|
|
311
|
+
"""Stop the WebRTC pipeline."""
|
|
312
|
+
self._logger.debug("Stopping WebRTC")
|
|
313
|
+
|
|
314
|
+
self._pipeline_sender.set_state(Gst.State.NULL)
|
|
315
|
+
self._pipeline_receiver.set_state(Gst.State.NULL)
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
if __name__ == "__main__":
|
|
319
|
+
import time
|
|
320
|
+
|
|
321
|
+
logging.basicConfig(
|
|
322
|
+
level=logging.DEBUG,
|
|
323
|
+
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
webrtc = GstWebRTC(log_level="DEBUG")
|
|
327
|
+
webrtc.start()
|
|
328
|
+
try:
|
|
329
|
+
while True:
|
|
330
|
+
time.sleep(1)
|
|
331
|
+
except KeyboardInterrupt:
|
|
332
|
+
logging.info("User interrupted")
|
|
333
|
+
finally:
|
|
334
|
+
webrtc.stop()
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""A goto move to a target head pose and/or antennas position."""
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
import numpy.typing as npt
|
|
5
|
+
|
|
6
|
+
from reachy_mini.utils.interpolation import (
|
|
7
|
+
InterpolationTechnique,
|
|
8
|
+
linear_pose_interpolation,
|
|
9
|
+
time_trajectory,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
from .move import Move
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class GotoMove(Move):
|
|
16
|
+
"""A goto move to a target head pose and/or antennas position."""
|
|
17
|
+
|
|
18
|
+
def __init__(
|
|
19
|
+
self,
|
|
20
|
+
start_head_pose: npt.NDArray[np.float64],
|
|
21
|
+
target_head_pose: npt.NDArray[np.float64] | None,
|
|
22
|
+
start_antennas: npt.NDArray[np.float64],
|
|
23
|
+
target_antennas: npt.NDArray[np.float64] | None,
|
|
24
|
+
start_body_yaw: float,
|
|
25
|
+
target_body_yaw: float | None,
|
|
26
|
+
duration: float,
|
|
27
|
+
method: InterpolationTechnique,
|
|
28
|
+
):
|
|
29
|
+
"""Set up the goto move."""
|
|
30
|
+
self.start_head_pose = start_head_pose
|
|
31
|
+
self.target_head_pose = (
|
|
32
|
+
target_head_pose if target_head_pose is not None else start_head_pose
|
|
33
|
+
)
|
|
34
|
+
self.start_antennas = start_antennas
|
|
35
|
+
self.target_antennas = (
|
|
36
|
+
target_antennas if target_antennas is not None else start_antennas
|
|
37
|
+
)
|
|
38
|
+
self.start_body_yaw = start_body_yaw
|
|
39
|
+
self.target_body_yaw = (
|
|
40
|
+
target_body_yaw if target_body_yaw is not None else start_body_yaw
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
self._duration = duration
|
|
44
|
+
self.method = method
|
|
45
|
+
|
|
46
|
+
@property
|
|
47
|
+
def duration(self) -> float:
|
|
48
|
+
"""Duration of the goto in seconds."""
|
|
49
|
+
return self._duration
|
|
50
|
+
|
|
51
|
+
def evaluate(
|
|
52
|
+
self, t: float
|
|
53
|
+
) -> tuple[
|
|
54
|
+
npt.NDArray[np.float64] | None, npt.NDArray[np.float64] | None, float | None
|
|
55
|
+
]:
|
|
56
|
+
"""Evaluate the goto at time t."""
|
|
57
|
+
interp_time = time_trajectory(t / self.duration, method=self.method)
|
|
58
|
+
|
|
59
|
+
interp_head_pose = linear_pose_interpolation(
|
|
60
|
+
self.start_head_pose, self.target_head_pose, interp_time
|
|
61
|
+
)
|
|
62
|
+
interp_antennas_joint = (
|
|
63
|
+
self.start_antennas
|
|
64
|
+
+ (self.target_antennas - self.start_antennas) * interp_time
|
|
65
|
+
)
|
|
66
|
+
interp_body_yaw_joint = (
|
|
67
|
+
self.start_body_yaw
|
|
68
|
+
+ (self.target_body_yaw - self.start_body_yaw) * interp_time
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
return interp_head_pose, interp_antennas_joint, interp_body_yaw_joint
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""Module for defining motion moves on the ReachyMini robot."""
|
|
2
|
+
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Optional
|
|
6
|
+
|
|
7
|
+
import numpy as np
|
|
8
|
+
import numpy.typing as npt
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Move(ABC):
|
|
12
|
+
"""Abstract base class for defining a move on the ReachyMini robot."""
|
|
13
|
+
|
|
14
|
+
@property
|
|
15
|
+
def sound_path(self) -> Optional[Path]:
|
|
16
|
+
"""Get the sound path associated with the move, if any."""
|
|
17
|
+
return None
|
|
18
|
+
|
|
19
|
+
@property
|
|
20
|
+
@abstractmethod
|
|
21
|
+
def duration(self) -> float:
|
|
22
|
+
"""Duration of the move in seconds."""
|
|
23
|
+
pass
|
|
24
|
+
|
|
25
|
+
@abstractmethod
|
|
26
|
+
def evaluate(
|
|
27
|
+
self,
|
|
28
|
+
t: float,
|
|
29
|
+
) -> tuple[
|
|
30
|
+
npt.NDArray[np.float64] | None, npt.NDArray[np.float64] | None, float | None
|
|
31
|
+
]:
|
|
32
|
+
"""Evaluate the move at time t, typically called at a high-frequency (eg. 100Hz).
|
|
33
|
+
|
|
34
|
+
Arguments:
|
|
35
|
+
t: The time at which to evaluate the move (in seconds). It will always be between 0 and duration.
|
|
36
|
+
|
|
37
|
+
Returns:
|
|
38
|
+
head: The head position (4x4 homogeneous matrix).
|
|
39
|
+
antennas: The antennas positions (rad).
|
|
40
|
+
body_yaw: The body yaw angle (rad).
|
|
41
|
+
|
|
42
|
+
"""
|
|
43
|
+
pass
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import bisect # noqa: D100
|
|
2
|
+
import json
|
|
3
|
+
import os
|
|
4
|
+
from glob import glob
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Any, Dict, List, Optional
|
|
7
|
+
|
|
8
|
+
import numpy as np
|
|
9
|
+
import numpy.typing as npt
|
|
10
|
+
from huggingface_hub import snapshot_download
|
|
11
|
+
|
|
12
|
+
from reachy_mini.motion.move import Move
|
|
13
|
+
from reachy_mini.utils.interpolation import linear_pose_interpolation
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def lerp(v0: float, v1: float, alpha: float) -> float:
|
|
17
|
+
"""Linear interpolation between two values."""
|
|
18
|
+
return v0 + alpha * (v1 - v0)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class RecordedMove(Move):
|
|
22
|
+
"""Represent a recorded move."""
|
|
23
|
+
|
|
24
|
+
def __init__(self, move: Dict[str, Any], sound_path: Optional[Path] = None) -> None:
|
|
25
|
+
"""Initialize RecordedMove."""
|
|
26
|
+
self.move = move
|
|
27
|
+
self._sound_path = sound_path
|
|
28
|
+
|
|
29
|
+
self.description: str = self.move["description"]
|
|
30
|
+
self.timestamps: List[float] = self.move["time"]
|
|
31
|
+
self.trajectory: List[Dict[str, List[List[float]] | List[float] | float]] = (
|
|
32
|
+
self.move["set_target_data"]
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
self.dt: float = (self.timestamps[-1] - self.timestamps[0]) / len(
|
|
36
|
+
self.timestamps
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
@property
|
|
40
|
+
def duration(self) -> float:
|
|
41
|
+
"""Get the duration of the recorded move."""
|
|
42
|
+
return len(self.trajectory) * self.dt
|
|
43
|
+
|
|
44
|
+
@property
|
|
45
|
+
def sound_path(self) -> Optional[Path]:
|
|
46
|
+
"""Get the sound path associated with the move, if any."""
|
|
47
|
+
return self._sound_path
|
|
48
|
+
|
|
49
|
+
def evaluate(
|
|
50
|
+
self, t: float
|
|
51
|
+
) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64], float]:
|
|
52
|
+
"""Evaluate the move at time t.
|
|
53
|
+
|
|
54
|
+
Returns:
|
|
55
|
+
head: The head position (4x4 homogeneous matrix).
|
|
56
|
+
antennas: The antennas positions (rad).
|
|
57
|
+
body_yaw: The body yaw angle (rad).
|
|
58
|
+
|
|
59
|
+
"""
|
|
60
|
+
# Under is Remi's emotions code, adapted
|
|
61
|
+
if t >= self.timestamps[-1]:
|
|
62
|
+
raise Exception("Tried to evaluate recorded move beyond its duration.")
|
|
63
|
+
|
|
64
|
+
# Locate the right interval in the recorded time array.
|
|
65
|
+
# 'index' is the insertion point which gives us the next timestamp.
|
|
66
|
+
index = bisect.bisect_right(self.timestamps, t)
|
|
67
|
+
# print(f"index: {index}, expected index: {t / self.dt:.0f}")
|
|
68
|
+
idx_prev = index - 1 if index > 0 else 0
|
|
69
|
+
idx_next = index if index < len(self.timestamps) else idx_prev
|
|
70
|
+
|
|
71
|
+
t_prev = self.timestamps[idx_prev]
|
|
72
|
+
t_next = self.timestamps[idx_next]
|
|
73
|
+
|
|
74
|
+
# Avoid division by zero (if by any chance two timestamps are identical).
|
|
75
|
+
if t_next == t_prev:
|
|
76
|
+
alpha = 0.0
|
|
77
|
+
else:
|
|
78
|
+
alpha = (t - t_prev) / (t_next - t_prev)
|
|
79
|
+
|
|
80
|
+
head_prev = np.array(self.trajectory[idx_prev]["head"], dtype=np.float64)
|
|
81
|
+
head_next = np.array(self.trajectory[idx_next]["head"], dtype=np.float64)
|
|
82
|
+
antennas_prev: List[float] = self.trajectory[idx_prev]["antennas"] # type: ignore[assignment]
|
|
83
|
+
antennas_next: List[float] = self.trajectory[idx_next]["antennas"] # type: ignore[assignment]
|
|
84
|
+
body_yaw_prev: float = self.trajectory[idx_prev].get("body_yaw", 0.0) # type: ignore[assignment]
|
|
85
|
+
body_yaw_next: float = self.trajectory[idx_next].get("body_yaw", 0.0) # type: ignore[assignment]
|
|
86
|
+
# check_collision = self.trajectory[idx_prev].get("check_collision", False)
|
|
87
|
+
|
|
88
|
+
# Interpolate to infer a better position at the current time.
|
|
89
|
+
# Joint interpolations are easy:
|
|
90
|
+
|
|
91
|
+
antennas_joints = np.array(
|
|
92
|
+
[
|
|
93
|
+
lerp(pos_prev, pos_next, alpha)
|
|
94
|
+
for pos_prev, pos_next in zip(antennas_prev, antennas_next)
|
|
95
|
+
],
|
|
96
|
+
dtype=np.float64,
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
body_yaw = lerp(body_yaw_prev, body_yaw_next, alpha)
|
|
100
|
+
|
|
101
|
+
# Head position interpolation is more complex:
|
|
102
|
+
head_pose = linear_pose_interpolation(head_prev, head_next, alpha)
|
|
103
|
+
|
|
104
|
+
return head_pose, antennas_joints, body_yaw
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class RecordedMoves:
|
|
108
|
+
"""Load a library of recorded moves from a HuggingFace dataset."""
|
|
109
|
+
|
|
110
|
+
def __init__(self, hf_dataset_name: str):
|
|
111
|
+
"""Initialize RecordedMoves."""
|
|
112
|
+
self.hf_dataset_name = hf_dataset_name
|
|
113
|
+
self.local_path = snapshot_download(self.hf_dataset_name, repo_type="dataset")
|
|
114
|
+
self.moves: Dict[str, Any] = {}
|
|
115
|
+
self.sounds: Dict[str, Optional[Path]] = {}
|
|
116
|
+
|
|
117
|
+
self.process()
|
|
118
|
+
|
|
119
|
+
def process(self) -> None:
|
|
120
|
+
"""Populate recorded moves and sounds."""
|
|
121
|
+
move_paths_tmp = glob(f"{self.local_path}/*.json")
|
|
122
|
+
move_paths = [Path(move_path) for move_path in move_paths_tmp]
|
|
123
|
+
for move_path in move_paths:
|
|
124
|
+
move_name = move_path.stem
|
|
125
|
+
|
|
126
|
+
move = json.load(open(move_path, "r"))
|
|
127
|
+
self.moves[move_name] = move
|
|
128
|
+
|
|
129
|
+
sound_path = move_path.with_suffix(".wav")
|
|
130
|
+
self.sounds[move_name] = None
|
|
131
|
+
|
|
132
|
+
if os.path.exists(sound_path):
|
|
133
|
+
self.sounds[move_name] = sound_path
|
|
134
|
+
|
|
135
|
+
def get(self, move_name: str) -> RecordedMove:
|
|
136
|
+
"""Get a recorded move by name."""
|
|
137
|
+
if move_name not in self.moves:
|
|
138
|
+
raise ValueError(
|
|
139
|
+
f"Move {move_name} not found in recorded moves library {self.hf_dataset_name}"
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
return RecordedMove(self.moves[move_name], self.sounds[move_name])
|
|
143
|
+
|
|
144
|
+
def list_moves(self) -> List[str]:
|
|
145
|
+
"""List all moves in the loaded library."""
|
|
146
|
+
return list(self.moves.keys())
|