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,111 @@
|
|
|
1
|
+
"""Base classes for audio implementations.
|
|
2
|
+
|
|
3
|
+
The audio implementations support various backends and provide a unified
|
|
4
|
+
interface for audio input/output.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import logging
|
|
8
|
+
from abc import ABC, abstractmethod
|
|
9
|
+
from typing import Optional
|
|
10
|
+
|
|
11
|
+
import numpy as np
|
|
12
|
+
import numpy.typing as npt
|
|
13
|
+
|
|
14
|
+
from reachy_mini.media.audio_control_utils import ReSpeaker, init_respeaker_usb
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class AudioBase(ABC):
|
|
18
|
+
"""Abstract class for opening and managing audio devices."""
|
|
19
|
+
|
|
20
|
+
SAMPLE_RATE = 16000 # respeaker samplerate
|
|
21
|
+
CHANNELS = 2 # respeaker channels
|
|
22
|
+
|
|
23
|
+
def __init__(self, log_level: str = "INFO") -> None:
|
|
24
|
+
"""Initialize the audio device."""
|
|
25
|
+
self.logger = logging.getLogger(__name__)
|
|
26
|
+
self.logger.setLevel(log_level)
|
|
27
|
+
self._respeaker: Optional[ReSpeaker] = init_respeaker_usb()
|
|
28
|
+
|
|
29
|
+
def __del__(self) -> None:
|
|
30
|
+
"""Destructor to ensure resources are released."""
|
|
31
|
+
if self._respeaker:
|
|
32
|
+
self._respeaker.close()
|
|
33
|
+
|
|
34
|
+
@abstractmethod
|
|
35
|
+
def start_recording(self) -> None:
|
|
36
|
+
"""Start recording audio."""
|
|
37
|
+
pass
|
|
38
|
+
|
|
39
|
+
@abstractmethod
|
|
40
|
+
def get_audio_sample(self) -> Optional[npt.NDArray[np.float32]]:
|
|
41
|
+
"""Read audio data from the device. Returns the data or None if error."""
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
def get_input_audio_samplerate(self) -> int:
|
|
45
|
+
"""Get the input samplerate of the audio device."""
|
|
46
|
+
return self.SAMPLE_RATE
|
|
47
|
+
|
|
48
|
+
def get_output_audio_samplerate(self) -> int:
|
|
49
|
+
"""Get the outputsamplerate of the audio device."""
|
|
50
|
+
return self.SAMPLE_RATE
|
|
51
|
+
|
|
52
|
+
def get_input_channels(self) -> int:
|
|
53
|
+
"""Get the number of input channels of the audio device."""
|
|
54
|
+
return self.CHANNELS
|
|
55
|
+
|
|
56
|
+
def get_output_channels(self) -> int:
|
|
57
|
+
"""Get the number of output channels of the audio device."""
|
|
58
|
+
return self.CHANNELS
|
|
59
|
+
|
|
60
|
+
@abstractmethod
|
|
61
|
+
def stop_recording(self) -> None:
|
|
62
|
+
"""Close the audio device and release resources."""
|
|
63
|
+
pass
|
|
64
|
+
|
|
65
|
+
@abstractmethod
|
|
66
|
+
def start_playing(self) -> None:
|
|
67
|
+
"""Start playing audio."""
|
|
68
|
+
pass
|
|
69
|
+
|
|
70
|
+
@abstractmethod
|
|
71
|
+
def push_audio_sample(self, data: npt.NDArray[np.float32]) -> None:
|
|
72
|
+
"""Push audio data to the output device."""
|
|
73
|
+
pass
|
|
74
|
+
|
|
75
|
+
@abstractmethod
|
|
76
|
+
def stop_playing(self) -> None:
|
|
77
|
+
"""Stop playing audio and release resources."""
|
|
78
|
+
pass
|
|
79
|
+
|
|
80
|
+
@abstractmethod
|
|
81
|
+
def play_sound(self, sound_file: str) -> None:
|
|
82
|
+
"""Play a sound file.
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
sound_file (str): Path to the sound file to play.
|
|
86
|
+
|
|
87
|
+
"""
|
|
88
|
+
pass
|
|
89
|
+
|
|
90
|
+
def get_DoA(self) -> tuple[float, bool] | None:
|
|
91
|
+
"""Get the Direction of Arrival (DoA) value from the ReSpeaker device.
|
|
92
|
+
|
|
93
|
+
The spatial angle is given in radians:
|
|
94
|
+
0 radians is left, π/2 radians is front/back, π radians is right.
|
|
95
|
+
|
|
96
|
+
Note: The microphone array requires firmware version 2.1.0 or higher to support this feature.
|
|
97
|
+
The firmware is located in src/reachy_mini/assets/firmware/*.bin.
|
|
98
|
+
Refer to https://wiki.seeedstudio.com/respeaker_xvf3800_introduction/#update-firmware for the upgrade process.
|
|
99
|
+
|
|
100
|
+
Returns:
|
|
101
|
+
tuple: A tuple containing the DoA value as a float (radians) and the speech detection as a bool, or None if the device is not found.
|
|
102
|
+
|
|
103
|
+
"""
|
|
104
|
+
if not self._respeaker:
|
|
105
|
+
self.logger.warning("ReSpeaker device not found.")
|
|
106
|
+
return None
|
|
107
|
+
|
|
108
|
+
result = self._respeaker.read("DOA_VALUE_RADIANS")
|
|
109
|
+
if result is None:
|
|
110
|
+
return None
|
|
111
|
+
return float(result[0]), bool(result[1])
|
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
"""Allows tuning of the XMOS XVF3800 chip.
|
|
2
|
+
|
|
3
|
+
Example usage:
|
|
4
|
+
|
|
5
|
+
# Read a parameter
|
|
6
|
+
python reachy_host.py AUDIO_MGR_OP_L
|
|
7
|
+
# Output:
|
|
8
|
+
# ReadCMD: cmdid: 143, resid: 35, response: array('B', [0, 8, 0])
|
|
9
|
+
# AUDIO_MGR_OP_L: [0, 8, 0]
|
|
10
|
+
|
|
11
|
+
# Write a parameter
|
|
12
|
+
python reachy_host.py AUDIO_MGR_OP_L --values 3 0
|
|
13
|
+
# Output:
|
|
14
|
+
# Writing to AUDIO_MGR_OP_L with values: [3, 0]
|
|
15
|
+
# WriteCMD: cmdid: 15, resid: 35, payload: [3, 0]
|
|
16
|
+
# Write operation completed successfully
|
|
17
|
+
|
|
18
|
+
More details about the parameters is available at:
|
|
19
|
+
https://www.xmos.com/documentation/XM-014888-PC/html/modules/fwk_xvf/doc/user_guide/AA_control_command_appendix.html
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
import argparse
|
|
23
|
+
import logging
|
|
24
|
+
import struct
|
|
25
|
+
import sys
|
|
26
|
+
import time
|
|
27
|
+
from typing import Any, Optional
|
|
28
|
+
|
|
29
|
+
import usb.core
|
|
30
|
+
import usb.util
|
|
31
|
+
from libusb_package import get_libusb1_backend
|
|
32
|
+
|
|
33
|
+
CONTROL_SUCCESS = 0
|
|
34
|
+
SERVICER_COMMAND_RETRY = 64
|
|
35
|
+
|
|
36
|
+
# name, resid, cmdid, length, type
|
|
37
|
+
PARAMETERS = {
|
|
38
|
+
# APPLICATION_SERVICER_RESID commands
|
|
39
|
+
"VERSION": (48, 0, 3, "ro", "uint8"),
|
|
40
|
+
"BLD_MSG": (48, 1, 50, "ro", "char"),
|
|
41
|
+
"BLD_HOST": (48, 2, 30, "ro", "char"),
|
|
42
|
+
"BLD_REPO_HASH": (48, 3, 40, "ro", "char"),
|
|
43
|
+
"BLD_MODIFIED": (48, 4, 6, "ro", "char"),
|
|
44
|
+
"BOOT_STATUS": (48, 5, 3, "ro", "char"),
|
|
45
|
+
"TEST_CORE_BURN": (48, 6, 1, "rw", "uint8"),
|
|
46
|
+
"REBOOT": (48, 7, 1, "wo", "uint8"),
|
|
47
|
+
"USB_BIT_DEPTH": (48, 8, 2, "rw", "uint8"),
|
|
48
|
+
"SAVE_CONFIGURATION": (48, 9, 1, "wo", "uint8"),
|
|
49
|
+
"CLEAR_CONFIGURATION": (48, 10, 1, "wo", "uint8"),
|
|
50
|
+
# AEC_RESID commands
|
|
51
|
+
"SHF_BYPASS": (33, 70, 1, "rw", "uint8"),
|
|
52
|
+
"AEC_NUM_MICS": (33, 71, 1, "ro", "int32"),
|
|
53
|
+
"AEC_NUM_FARENDS": (33, 72, 1, "ro", "int32"),
|
|
54
|
+
"AEC_MIC_ARRAY_TYPE": (33, 73, 1, "ro", "int32"),
|
|
55
|
+
"AEC_MIC_ARRAY_GEO": (33, 74, 12, "ro", "float"),
|
|
56
|
+
"AEC_AZIMUTH_VALUES": (33, 75, 4, "ro", "radians"),
|
|
57
|
+
"TEST_AEC_DISABLE_CONTROL": (33, 76, 1, "wo", "uint32"),
|
|
58
|
+
"AEC_CURRENT_IDLE_TIME": (33, 77, 1, "ro", "uint32"),
|
|
59
|
+
"AEC_MIN_IDLE_TIME": (33, 78, 1, "ro", "uint32"),
|
|
60
|
+
"AEC_RESET_MIN_IDLE_TIME": (33, 79, 1, "wo", "uint32"),
|
|
61
|
+
"AEC_SPENERGY_VALUES": (33, 80, 4, "ro", "float"),
|
|
62
|
+
"AEC_FIXEDBEAMSAZIMUTH_VALUES": (33, 81, 2, "rw", "radians"),
|
|
63
|
+
"AEC_FIXEDBEAMSELEVATION_VALUES": (33, 82, 2, "rw", "radians"),
|
|
64
|
+
"AEC_FIXEDBEAMSGATING": (33, 83, 1, "rw", "uint8"),
|
|
65
|
+
"SPECIAL_CMD_AEC_FAR_MIC_INDEX": (33, 90, 2, "wo", "int32"),
|
|
66
|
+
"SPECIAL_CMD_AEC_FILTER_COEFF_START_OFFSET": (33, 91, 1, "rw", "int32"),
|
|
67
|
+
"SPECIAL_CMD_AEC_FILTER_COEFFS": (33, 92, 15, "rw", "float"),
|
|
68
|
+
"SPECIAL_CMD_AEC_FILTER_LENGTH": (33, 93, 1, "ro", "int32"),
|
|
69
|
+
"AEC_FILTER_CMD_ABORT": (33, 94, 1, "wo", "int32"),
|
|
70
|
+
"AEC_AECPATHCHANGE": (33, 0, 1, "ro", "int32"),
|
|
71
|
+
"AEC_HPFONOFF": (33, 1, 1, "rw", "int32"),
|
|
72
|
+
"AEC_AECSILENCELEVEL": (33, 2, 2, "rw", "float"),
|
|
73
|
+
"AEC_AECCONVERGED": (33, 3, 1, "ro", "int32"),
|
|
74
|
+
"AEC_AECEMPHASISONOFF": (33, 4, 1, "rw", "int32"),
|
|
75
|
+
"AEC_FAR_EXTGAIN": (33, 5, 1, "rw", "float"),
|
|
76
|
+
"AEC_PCD_COUPLINGI": (33, 6, 1, "rw", "float"),
|
|
77
|
+
"AEC_PCD_MINTHR": (33, 7, 1, "rw", "float"),
|
|
78
|
+
"AEC_PCD_MAXTHR": (33, 8, 1, "rw", "float"),
|
|
79
|
+
"AEC_RT60": (33, 9, 1, "ro", "float"),
|
|
80
|
+
"AEC_ASROUTONOFF": (33, 35, 1, "rw", "int32"),
|
|
81
|
+
"AEC_ASROUTGAIN": (33, 36, 1, "rw", "float"),
|
|
82
|
+
"AEC_FIXEDBEAMSONOFF": (33, 37, 1, "rw", "int32"),
|
|
83
|
+
"AEC_FIXEDBEAMNOISETHR": (33, 38, 2, "rw", "float"),
|
|
84
|
+
# AUDIO_MGR_RESID commands
|
|
85
|
+
"AUDIO_MGR_MIC_GAIN": (35, 0, 1, "rw", "float"),
|
|
86
|
+
"AUDIO_MGR_REF_GAIN": (35, 1, 1, "rw", "float"),
|
|
87
|
+
"AUDIO_MGR_CURRENT_IDLE_TIME": (35, 2, 1, "ro", "int32"),
|
|
88
|
+
"AUDIO_MGR_MIN_IDLE_TIME": (35, 3, 1, "ro", "int32"),
|
|
89
|
+
"AUDIO_MGR_RESET_MIN_IDLE_TIME": (35, 4, 1, "wo", "int32"),
|
|
90
|
+
"MAX_CONTROL_TIME": (35, 5, 1, "ro", "int32"),
|
|
91
|
+
"RESET_MAX_CONTROL_TIME": (35, 6, 1, "wo", "int32"),
|
|
92
|
+
"I2S_CURRENT_IDLE_TIME": (35, 7, 1, "ro", "int32"),
|
|
93
|
+
"I2S_MIN_IDLE_TIME": (35, 8, 1, "ro", "int32"),
|
|
94
|
+
"I2S_RESET_MIN_IDLE_TIME": (35, 9, 1, "wo", "int32"),
|
|
95
|
+
"I2S_INPUT_PACKED": (35, 10, 1, "rw", "uint8"),
|
|
96
|
+
"AUDIO_MGR_SELECTED_AZIMUTHS": (35, 11, 2, "ro", "radians"),
|
|
97
|
+
"AUDIO_MGR_SELECTED_CHANNELS": (35, 12, 2, "rw", "uint8"),
|
|
98
|
+
"AUDIO_MGR_OP_PACKED": (35, 13, 2, "rw", "uint8"),
|
|
99
|
+
"AUDIO_MGR_OP_UPSAMPLE": (35, 14, 2, "rw", "uint8"),
|
|
100
|
+
"AUDIO_MGR_OP_L": (35, 15, 2, "rw", "uint8"),
|
|
101
|
+
"AUDIO_MGR_OP_L_PK0": (35, 16, 2, "rw", "uint8"),
|
|
102
|
+
"AUDIO_MGR_OP_L_PK1": (35, 17, 2, "rw", "uint8"),
|
|
103
|
+
"AUDIO_MGR_OP_L_PK2": (35, 18, 2, "rw", "uint8"),
|
|
104
|
+
"AUDIO_MGR_OP_R": (35, 19, 2, "rw", "uint8"),
|
|
105
|
+
"AUDIO_MGR_OP_R_PK0": (35, 20, 2, "rw", "uint8"),
|
|
106
|
+
"AUDIO_MGR_OP_R_PK1": (35, 21, 2, "rw", "uint8"),
|
|
107
|
+
"AUDIO_MGR_OP_R_PK2": (35, 22, 2, "rw", "uint8"),
|
|
108
|
+
"AUDIO_MGR_OP_ALL": (35, 23, 12, "rw", "uint8"),
|
|
109
|
+
"I2S_INACTIVE": (35, 24, 1, "ro", "uint8"),
|
|
110
|
+
"AUDIO_MGR_FAR_END_DSP_ENABLE": (35, 25, 1, "rw", "uint8"),
|
|
111
|
+
"AUDIO_MGR_SYS_DELAY": (35, 26, 1, "rw", "int32"),
|
|
112
|
+
"I2S_DAC_DSP_ENABLE": (35, 27, 1, "rw", "uint8"),
|
|
113
|
+
# GPO_SERVICER_RESID commands
|
|
114
|
+
"GPO_READ_VALUES": (20, 0, 5, "ro", "uint8"),
|
|
115
|
+
"GPO_WRITE_VALUE": (20, 1, 2, "wo", "uint8"),
|
|
116
|
+
"GPO_PORT_PIN_INDEX": (20, 2, 2, "rw", "uint32"),
|
|
117
|
+
"GPO_PIN_VAL": (20, 3, 3, "wo", "uint8"),
|
|
118
|
+
"GPO_PIN_ACTIVE_LEVEL": (20, 4, 1, "rw", "uint32"),
|
|
119
|
+
"GPO_PIN_PWM_DUTY": (20, 5, 1, "rw", "uint8"),
|
|
120
|
+
"GPO_PIN_FLASH_MASK": (20, 6, 1, "rw", "uint32"),
|
|
121
|
+
"LED_EFFECT": (20, 12, 1, "rw", "uint8"),
|
|
122
|
+
"LED_BRIGHTNESS": (20, 13, 1, "rw", "uint8"),
|
|
123
|
+
"LED_GAMMIFY": (20, 14, 1, "rw", "uint8"),
|
|
124
|
+
"LED_SPEED": (20, 15, 1, "rw", "uint8"),
|
|
125
|
+
"LED_COLOR": (20, 16, 1, "rw", "uint32"),
|
|
126
|
+
"LED_DOA_COLOR": (20, 17, 2, "rw", "uint32"),
|
|
127
|
+
"DOA_VALUE": (20, 18, 2, "ro", "uint32"),
|
|
128
|
+
"DOA_VALUE_RADIANS": (20, 19, 2, "ro", "radians"),
|
|
129
|
+
# PP_RESID commands
|
|
130
|
+
"PP_CURRENT_IDLE_TIME": (17, 70, 1, "ro", "uint32"),
|
|
131
|
+
"PP_MIN_IDLE_TIME": (17, 71, 1, "ro", "uint32"),
|
|
132
|
+
"PP_RESET_MIN_IDLE_TIME": (17, 72, 1, "wo", "uint32"),
|
|
133
|
+
"SPECIAL_CMD_PP_NLMODEL_NROW_NCOL": (17, 90, 2, "ro", "int32"),
|
|
134
|
+
"SPECIAL_CMD_NLMODEL_START": (17, 91, 1, "wo", "int32"),
|
|
135
|
+
"SPECIAL_CMD_NLMODEL_COEFF_START_OFFSET": (17, 92, 1, "rw", "int32"),
|
|
136
|
+
"SPECIAL_CMD_PP_NLMODEL": (17, 93, 15, "rw", "float"),
|
|
137
|
+
"PP_NL_MODEL_CMD_ABORT": (17, 94, 1, "wo", "int32"),
|
|
138
|
+
"SPECIAL_CMD_PP_NLMODEL_BAND": (17, 95, 1, "rw", "uint8"),
|
|
139
|
+
"SPECIAL_CMD_PP_EQUALIZATION_NUM_BANDS": (17, 96, 1, "ro", "int32"),
|
|
140
|
+
"SPECIAL_CMD_EQUALIZATION_START": (17, 97, 1, "wo", "int32"),
|
|
141
|
+
"SPECIAL_CMD_EQUALIZATION_COEFF_START_OFFSET": (17, 98, 1, "rw", "int32"),
|
|
142
|
+
"SPECIAL_CMD_PP_EQUALIZATION": (17, 99, 15, "rw", "float"),
|
|
143
|
+
"PP_EQUALIZATION_CMD_ABORT": (17, 100, 1, "wo", "int32"),
|
|
144
|
+
"PP_AGCONOFF": (17, 10, 1, "rw", "int32"),
|
|
145
|
+
"PP_AGCMAXGAIN": (17, 11, 1, "rw", "float"),
|
|
146
|
+
"PP_AGCDESIREDLEVEL": (17, 12, 1, "rw", "float"),
|
|
147
|
+
"PP_AGCGAIN": (17, 13, 1, "rw", "float"),
|
|
148
|
+
"PP_AGCTIME": (17, 14, 1, "rw", "float"),
|
|
149
|
+
"PP_AGCFASTTIME": (17, 15, 1, "rw", "float"),
|
|
150
|
+
"PP_AGCALPHAFASTGAIN": (17, 16, 1, "rw", "float"),
|
|
151
|
+
"PP_AGCALPHASLOW": (17, 17, 1, "rw", "float"),
|
|
152
|
+
"PP_AGCALPHAFAST": (17, 18, 1, "rw", "float"),
|
|
153
|
+
"PP_LIMITONOFF": (17, 19, 1, "rw", "int32"),
|
|
154
|
+
"PP_LIMITPLIMIT": (17, 20, 1, "rw", "float"),
|
|
155
|
+
"PP_MIN_NS": (17, 21, 1, "rw", "float"),
|
|
156
|
+
"PP_MIN_NN": (17, 22, 1, "rw", "float"),
|
|
157
|
+
"PP_ECHOONOFF": (17, 23, 1, "rw", "int32"),
|
|
158
|
+
"PP_GAMMA_E": (17, 24, 1, "rw", "float"),
|
|
159
|
+
"PP_GAMMA_ETAIL": (17, 25, 1, "rw", "float"),
|
|
160
|
+
"PP_GAMMA_ENL": (17, 26, 1, "rw", "float"),
|
|
161
|
+
"PP_NLATTENONOFF": (17, 27, 1, "rw", "int32"),
|
|
162
|
+
"PP_NLAEC_MODE": (17, 28, 1, "rw", "int32"),
|
|
163
|
+
"PP_MGSCALE": (17, 29, 3, "rw", "float"),
|
|
164
|
+
"PP_FMIN_SPEINDEX": (17, 30, 1, "rw", "float"),
|
|
165
|
+
"PP_DTSENSITIVE": (17, 31, 1, "rw", "int32"),
|
|
166
|
+
"PP_ATTNS_MODE": (17, 32, 1, "rw", "int32"),
|
|
167
|
+
"PP_ATTNS_NOMINAL": (17, 33, 1, "rw", "float"),
|
|
168
|
+
"PP_ATTNS_SLOPE": (17, 34, 1, "rw", "float"),
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
class ReSpeaker:
|
|
173
|
+
"""Class to interface with the ReSpeaker XVF3800 USB device."""
|
|
174
|
+
|
|
175
|
+
TIMEOUT = 100000
|
|
176
|
+
|
|
177
|
+
def __init__(self, dev: usb.core.Device) -> None:
|
|
178
|
+
"""Initialize the ReSpeaker interface with the given USB device."""
|
|
179
|
+
self.dev = dev
|
|
180
|
+
|
|
181
|
+
def write(self, name: str, data_list: Any) -> None:
|
|
182
|
+
"""Write data to a specified parameter on the ReSpeaker device."""
|
|
183
|
+
try:
|
|
184
|
+
data = PARAMETERS[name]
|
|
185
|
+
except KeyError:
|
|
186
|
+
return
|
|
187
|
+
|
|
188
|
+
if data[3] == "ro":
|
|
189
|
+
raise ValueError("{} is read-only".format(name))
|
|
190
|
+
|
|
191
|
+
if len(data_list) != data[2]:
|
|
192
|
+
raise ValueError("{} value count is not {}".format(name, data[2]))
|
|
193
|
+
|
|
194
|
+
windex = data[0] # resid
|
|
195
|
+
wvalue = data[1] # cmdid
|
|
196
|
+
data_cnt = data[2] # cnt
|
|
197
|
+
data_type = data[4] # data type
|
|
198
|
+
payload = [] # type: ignore[var-annotated]
|
|
199
|
+
|
|
200
|
+
if data_type == "float" or data_type == "radians":
|
|
201
|
+
for i in range(data_cnt):
|
|
202
|
+
payload += struct.pack(b"f", float(data_list[i]))
|
|
203
|
+
elif data_type == "char":
|
|
204
|
+
# For char arrays, convert string to bytes
|
|
205
|
+
payload = (
|
|
206
|
+
bytearray(data_list, "utf-8") # type: ignore[assignment]
|
|
207
|
+
if isinstance(data_list, str)
|
|
208
|
+
else bytearray(data_list)
|
|
209
|
+
)
|
|
210
|
+
elif data_type == "uint8":
|
|
211
|
+
for i in range(data_cnt):
|
|
212
|
+
payload += data_list[i].to_bytes(1, byteorder="little")
|
|
213
|
+
elif data_type == "uint32" or data_type == "int32":
|
|
214
|
+
for i in range(data_cnt):
|
|
215
|
+
payload += struct.pack(
|
|
216
|
+
b"I" if data_type == "uint32" else b"i", data_list[i]
|
|
217
|
+
)
|
|
218
|
+
else:
|
|
219
|
+
# Default to int32 for other types
|
|
220
|
+
for i in range(data_cnt):
|
|
221
|
+
payload += struct.pack(b"i", data_list[i])
|
|
222
|
+
|
|
223
|
+
logging.debug(
|
|
224
|
+
"WriteCMD: cmdid: {}, resid: {}, payload: {}".format(
|
|
225
|
+
wvalue, windex, payload
|
|
226
|
+
)
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
self.dev.ctrl_transfer(
|
|
230
|
+
usb.util.CTRL_OUT
|
|
231
|
+
| usb.util.CTRL_TYPE_VENDOR
|
|
232
|
+
| usb.util.CTRL_RECIPIENT_DEVICE,
|
|
233
|
+
0,
|
|
234
|
+
wvalue,
|
|
235
|
+
windex,
|
|
236
|
+
payload,
|
|
237
|
+
self.TIMEOUT,
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
def read(self, name: str) -> Any:
|
|
241
|
+
"""Read data from a specified parameter on the ReSpeaker device."""
|
|
242
|
+
try:
|
|
243
|
+
data = PARAMETERS[name]
|
|
244
|
+
except KeyError:
|
|
245
|
+
return
|
|
246
|
+
|
|
247
|
+
read_attempts = 1
|
|
248
|
+
windex = data[0] # resid
|
|
249
|
+
wvalue = 0x80 | data[1] # cmdid
|
|
250
|
+
data_cnt = data[2] # cnt
|
|
251
|
+
data_type = data[4] # data type
|
|
252
|
+
if data_type == "uint8" or data_type == "char":
|
|
253
|
+
length = data_cnt + 1 # 1 byte for status
|
|
254
|
+
elif (
|
|
255
|
+
data_type == "float"
|
|
256
|
+
or data_type == "radians"
|
|
257
|
+
or data_type == "uint32"
|
|
258
|
+
or data_type == "int32"
|
|
259
|
+
):
|
|
260
|
+
length = data_cnt * 4 + 1 # 1 byte for status
|
|
261
|
+
|
|
262
|
+
response = self.dev.ctrl_transfer(
|
|
263
|
+
usb.util.CTRL_IN
|
|
264
|
+
| usb.util.CTRL_TYPE_VENDOR
|
|
265
|
+
| usb.util.CTRL_RECIPIENT_DEVICE,
|
|
266
|
+
0,
|
|
267
|
+
wvalue,
|
|
268
|
+
windex,
|
|
269
|
+
length,
|
|
270
|
+
self.TIMEOUT,
|
|
271
|
+
)
|
|
272
|
+
while True:
|
|
273
|
+
if read_attempts > 100:
|
|
274
|
+
raise ValueError("Read attempt exceeds 100 times")
|
|
275
|
+
if response[0] == CONTROL_SUCCESS:
|
|
276
|
+
break
|
|
277
|
+
elif response[0] == SERVICER_COMMAND_RETRY:
|
|
278
|
+
read_attempts += 1
|
|
279
|
+
response = self.dev.ctrl_transfer(
|
|
280
|
+
usb.util.CTRL_IN
|
|
281
|
+
| usb.util.CTRL_TYPE_VENDOR
|
|
282
|
+
| usb.util.CTRL_RECIPIENT_DEVICE,
|
|
283
|
+
0,
|
|
284
|
+
wvalue,
|
|
285
|
+
windex,
|
|
286
|
+
length,
|
|
287
|
+
self.TIMEOUT,
|
|
288
|
+
)
|
|
289
|
+
else:
|
|
290
|
+
raise ValueError("Unknown status code: {}".format(response[0]))
|
|
291
|
+
time.sleep(0.01)
|
|
292
|
+
|
|
293
|
+
logging.info(
|
|
294
|
+
"ReadCMD: cmdid: {}, resid: {}, response: {}".format(
|
|
295
|
+
wvalue, windex, response
|
|
296
|
+
)
|
|
297
|
+
)
|
|
298
|
+
|
|
299
|
+
if data_type == "uint8":
|
|
300
|
+
result = response.tolist()
|
|
301
|
+
elif data_type == "char":
|
|
302
|
+
# For char arrays, convert bytes to string
|
|
303
|
+
byte_data = response.tobytes()
|
|
304
|
+
# Remove status byte and null terminators
|
|
305
|
+
result = byte_data[1:].rstrip(b"\x00").decode("utf-8", errors="ignore")
|
|
306
|
+
elif data_type == "radians" or data_type == "float":
|
|
307
|
+
byte_data = response.tobytes()
|
|
308
|
+
match_str = "<"
|
|
309
|
+
for i in range(data_cnt):
|
|
310
|
+
match_str += "f"
|
|
311
|
+
result = struct.unpack(match_str, byte_data[1:])
|
|
312
|
+
elif data_type == "uint32" or data_type == "int32":
|
|
313
|
+
result = response.tolist()
|
|
314
|
+
|
|
315
|
+
return result
|
|
316
|
+
|
|
317
|
+
def close(self) -> None:
|
|
318
|
+
"""Close the interface."""
|
|
319
|
+
usb.util.dispose_resources(self.dev)
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
def find(vid: int = 0x2886, pid: int = 0x001A) -> ReSpeaker | None:
|
|
323
|
+
"""Find and return the ReSpeaker USB device with the given Vendor ID and Product ID."""
|
|
324
|
+
dev = usb.core.find(idVendor=vid, idProduct=pid, backend=get_libusb1_backend())
|
|
325
|
+
if not dev:
|
|
326
|
+
return None
|
|
327
|
+
|
|
328
|
+
return ReSpeaker(dev)
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
def init_respeaker_usb() -> Optional[ReSpeaker]:
|
|
332
|
+
"""Initialize the ReSpeaker USB device. Looks for both new and beta device IDs."""
|
|
333
|
+
try:
|
|
334
|
+
# Try new firmware first
|
|
335
|
+
dev = usb.core.find(
|
|
336
|
+
idVendor=0x38FB, idProduct=0x1001, backend=get_libusb1_backend()
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
# If not found, try old firmware
|
|
340
|
+
if dev is None:
|
|
341
|
+
dev = usb.core.find(
|
|
342
|
+
idVendor=0x2886, idProduct=0x001A, backend=get_libusb1_backend()
|
|
343
|
+
)
|
|
344
|
+
if dev is not None:
|
|
345
|
+
logging.warning("Old firmware detected. Please update the firmware!")
|
|
346
|
+
|
|
347
|
+
# If still not found, raise error
|
|
348
|
+
if dev is None:
|
|
349
|
+
logging.error("No Reachy Mini Audio USB device found!")
|
|
350
|
+
return None
|
|
351
|
+
|
|
352
|
+
return ReSpeaker(dev)
|
|
353
|
+
|
|
354
|
+
except usb.core.NoBackendError:
|
|
355
|
+
logging.error(
|
|
356
|
+
"No USB backend was found! Make sure libusb_package is correctly installed with `pip install libusb_package`."
|
|
357
|
+
)
|
|
358
|
+
return None
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
def main() -> None:
|
|
362
|
+
"""Parse arguments and execute read/write commands."""
|
|
363
|
+
parser = argparse.ArgumentParser(
|
|
364
|
+
description="Reachy Mini Audio Host Control Script"
|
|
365
|
+
)
|
|
366
|
+
parser.add_argument(
|
|
367
|
+
"command",
|
|
368
|
+
choices=PARAMETERS.keys(),
|
|
369
|
+
help="Command to execute (e.g., VERSION, DOA_VALUE, etc.)",
|
|
370
|
+
)
|
|
371
|
+
parser.add_argument(
|
|
372
|
+
"--vid",
|
|
373
|
+
type=lambda x: int(x, 0),
|
|
374
|
+
default=0x38FB,
|
|
375
|
+
help="Vendor ID (default: 0x38FB)",
|
|
376
|
+
)
|
|
377
|
+
parser.add_argument(
|
|
378
|
+
"--pid",
|
|
379
|
+
type=lambda x: int(x, 0),
|
|
380
|
+
default=0x1001,
|
|
381
|
+
help="Product ID (default: 0x1001)",
|
|
382
|
+
)
|
|
383
|
+
parser.add_argument(
|
|
384
|
+
"--values",
|
|
385
|
+
nargs="+",
|
|
386
|
+
type=float,
|
|
387
|
+
help="Values for write commands (only for write operations)",
|
|
388
|
+
)
|
|
389
|
+
|
|
390
|
+
args = parser.parse_args()
|
|
391
|
+
|
|
392
|
+
# Allow user overrides if provided, else use known defaults
|
|
393
|
+
if args.vid is not None and args.pid is not None:
|
|
394
|
+
dev = find(vid=args.vid, pid=args.pid)
|
|
395
|
+
else:
|
|
396
|
+
dev = init_respeaker_usb()
|
|
397
|
+
|
|
398
|
+
if not dev:
|
|
399
|
+
print("No device found")
|
|
400
|
+
sys.exit(1)
|
|
401
|
+
|
|
402
|
+
try:
|
|
403
|
+
if args.values:
|
|
404
|
+
if PARAMETERS[args.command][3] == "ro":
|
|
405
|
+
print(f"Error: {args.command} is read-only and cannot be written to")
|
|
406
|
+
sys.exit(1)
|
|
407
|
+
|
|
408
|
+
if (
|
|
409
|
+
PARAMETERS[args.command][4] != "float"
|
|
410
|
+
and PARAMETERS[args.command][4] != "radians"
|
|
411
|
+
):
|
|
412
|
+
args.values = [int(v) for v in args.values]
|
|
413
|
+
|
|
414
|
+
if PARAMETERS[args.command][2] != len(args.values):
|
|
415
|
+
print(
|
|
416
|
+
f"Error: {args.command} value count is {PARAMETERS[args.command][2]}, but {len(args.values)} values provided"
|
|
417
|
+
)
|
|
418
|
+
sys.exit(1)
|
|
419
|
+
|
|
420
|
+
print(f"Writing to {args.command} with values: {args.values}")
|
|
421
|
+
dev.write(args.command, args.values)
|
|
422
|
+
time.sleep(0.1)
|
|
423
|
+
print("Write operation completed successfully")
|
|
424
|
+
else:
|
|
425
|
+
if PARAMETERS[args.command][3] == "wo":
|
|
426
|
+
print(f"Error: {args.command} is write-only and cannot be read")
|
|
427
|
+
sys.exit(1)
|
|
428
|
+
|
|
429
|
+
result = dev.read(args.command)
|
|
430
|
+
print(f"{args.command}: {result}")
|
|
431
|
+
|
|
432
|
+
except Exception as e:
|
|
433
|
+
error_msg = f"Error executing command {args.command}: {e}"
|
|
434
|
+
print(error_msg)
|
|
435
|
+
|
|
436
|
+
# Check if it's a permission error, so far only seen on Linux
|
|
437
|
+
if (
|
|
438
|
+
"Errno 13" in str(e)
|
|
439
|
+
or "Access denied" in str(e)
|
|
440
|
+
or "insufficient permissions" in str(e)
|
|
441
|
+
):
|
|
442
|
+
print("\nThis looks like a permissions error.")
|
|
443
|
+
print(
|
|
444
|
+
"\n - You are most likely on Linux and need to adjust udev rules for USB permissions."
|
|
445
|
+
)
|
|
446
|
+
print(
|
|
447
|
+
"\n - If you are not on Linux or have additional questions contact the team."
|
|
448
|
+
)
|
|
449
|
+
sys.exit(1)
|
|
450
|
+
finally:
|
|
451
|
+
dev.close()
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
if __name__ == "__main__":
|
|
455
|
+
main()
|