mirror of
https://github.com/apirrone/Open_Duck_Mini_Runtime.git
synced 2025-09-02 11:13:55 +00:00
support resource file read
This commit is contained in:
parent
34c60ef80c
commit
ba20e5f85c
30 changed files with 19 additions and 7 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,2 +1,4 @@
|
|||
__pycache__/
|
||||
mini_bdx_runtime.egg-info/
|
||||
mini_bdx_runtime.egg-info/
|
||||
build
|
||||
dist
|
|
@ -2,6 +2,7 @@ import pygame
|
|||
import time
|
||||
import os
|
||||
import random
|
||||
from importlib.resources import files
|
||||
|
||||
|
||||
class Sounds:
|
||||
|
@ -50,7 +51,8 @@ class Sounds:
|
|||
|
||||
# Example usage
|
||||
if __name__ == "__main__":
|
||||
sound_player = Sounds(1.0, "../assets/")
|
||||
assets_dir = files("mini_bdx_runtime") / "assets"
|
||||
sound_player = Sounds(1.0, assets_dir.__str__())
|
||||
time.sleep(1)
|
||||
while True:
|
||||
# sound_player.play_random_sound()
|
|
@ -19,7 +19,9 @@ duck_config = DuckConfig()
|
|||
xbox_controller = XBoxController(50, only_head_control=True)
|
||||
|
||||
if duck_config.speaker:
|
||||
sounds = Sounds(volume=1.0, sound_directory="../mini_bdx_runtime/assets/")
|
||||
from importlib.resources import files
|
||||
assets_dir = files("mini_bdx_runtime") / "assets"
|
||||
sounds = Sounds(volume=1.0, sound_directory=assets_dir.__str__())
|
||||
if duck_config.antennas:
|
||||
antennas = Antennas()
|
||||
if duck_config.eyes:
|
||||
|
|
|
@ -100,7 +100,9 @@ class RLWalk:
|
|||
|
||||
# Reference motion, but we only really need the length of one phase
|
||||
# TODO
|
||||
self.PRM = PolyReferenceMotion("./polynomial_coefficients.pkl")
|
||||
from pathlib import Path
|
||||
polynomial_coefficients = Path(__file__).parent / "polynomial_coefficients.pkl"
|
||||
self.PRM = PolyReferenceMotion(polynomial_coefficients.as_posix())
|
||||
self.imitation_i = 0
|
||||
self.imitation_phase = np.array([0, 0])
|
||||
self.phase_frequency_factor = 1.0
|
||||
|
@ -114,8 +116,10 @@ class RLWalk:
|
|||
if self.duck_config.projector:
|
||||
self.projector = Projector()
|
||||
if self.duck_config.speaker:
|
||||
from importlib.resources import files
|
||||
assets_dir = files("mini_bdx_runtime") / "assets"
|
||||
self.sounds = Sounds(
|
||||
volume=1.0, sound_directory="../mini_bdx_runtime/assets/"
|
||||
volume=1.0, sound_directory=assets_dir.__str__()
|
||||
)
|
||||
if self.duck_config.antennas:
|
||||
self.antennas = Antennas()
|
||||
|
|
|
@ -14,7 +14,7 @@ packages = find:
|
|||
zip_safe = True
|
||||
include_package_data = True
|
||||
package_dir=
|
||||
=mini_bdx_runtime
|
||||
=mini_bdx_runtime_src
|
||||
install_requires =
|
||||
rustypot==0.1.0
|
||||
onnxruntime==1.18.1
|
||||
|
@ -28,9 +28,11 @@ install_requires =
|
|||
# adafruit_extended_bus
|
||||
|
||||
[options.packages.find]
|
||||
where=mini_bdx_runtime
|
||||
where=mini_bdx_runtime_src
|
||||
|
||||
[options.package_data]
|
||||
mini_bdx_runtime =
|
||||
assets/*.wav
|
||||
|
||||
[options.extras_require]
|
||||
|
||||
|
|
Loading…
Reference in a new issue