mirror of
https://github.com/apirrone/Open_Duck_Mini_Runtime.git
synced 2025-09-02 19:23:54 +00:00
standardizing, renaming
This commit is contained in:
parent
76f501da99
commit
d498df2e63
40 changed files with 71 additions and 59 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,5 +1,5 @@
|
|||
__pycache__/
|
||||
mini_bdx_runtime.egg-info/
|
||||
open_duck_mini_runtime.egg-info/
|
||||
build
|
||||
dist
|
||||
.DS_Store
|
||||
|
|
|
@ -133,7 +133,7 @@ pip install lgpio
|
|||
|
||||
4. Test the connection:
|
||||
```bash
|
||||
python3 mini_bdx_runtime/xbox_controller.py
|
||||
python3 open_duck_mini_runtime/xbox_controller.py
|
||||
```
|
||||
|
||||
## Hardware Configuration
|
||||
|
@ -149,7 +149,7 @@ Follow this Adafruit tutorial for wiring the speaker: [Adafruit MAX98357 I2S Cla
|
|||
|
||||
Run a basic test to ensure the IMU is working:
|
||||
```bash
|
||||
python3 mini_bdx_runtime/raw_imu.py
|
||||
python3 open_duck_mini_runtime/raw_imu.py
|
||||
```
|
||||
|
||||
To visualize the IMU data, run the server on the robot and the client on your computer:
|
||||
|
|
3
TODO.md
3
TODO.md
|
@ -1,3 +0,0 @@
|
|||
- [] Better handle xbox controller
|
||||
- It's a little bit of a mess right now, how we handle directions and buttons etc
|
||||
- [] Make the offsets flashing work. This will be in the motor configuration script
|
|
@ -4,22 +4,28 @@ Sets up the robot in init position, you control the head with the xbox controlle
|
|||
|
||||
import time
|
||||
import numpy as np
|
||||
from mini_bdx_runtime.rustypot_position_hwi import HWI
|
||||
from mini_bdx_runtime.duck_config import DuckConfig
|
||||
from mini_bdx_runtime.xbox_controller import XBoxController
|
||||
from open_duck_mini_runtime.hwi import HWI
|
||||
from open_duck_mini_runtime.duck_config import DuckConfig
|
||||
from open_duck_mini_runtime.xbox_controller import XBoxController
|
||||
|
||||
|
||||
from mini_bdx_runtime.eyes import Eyes
|
||||
from mini_bdx_runtime.sounds import Sounds
|
||||
from mini_bdx_runtime.antennas import Antennas
|
||||
from mini_bdx_runtime.projector import Projector
|
||||
from open_duck_mini_runtime.eyes import Eyes
|
||||
from open_duck_mini_runtime.sounds import Sounds
|
||||
from open_duck_mini_runtime.antennas import Antennas
|
||||
from open_duck_mini_runtime.projector import Projector
|
||||
|
||||
|
||||
from importlib.resources import files
|
||||
import open_duck_mini_runtime
|
||||
|
||||
ASSETS_ROOT_PATH: str = str(files(open_duck_mini_runtime).joinpath("assets/"))
|
||||
|
||||
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/")
|
||||
sounds = Sounds(volume=1.0, sound_directory=ASSETS_ROOT_PATH)
|
||||
if duck_config.antennas:
|
||||
antennas = Antennas()
|
||||
if duck_config.eyes:
|
||||
|
@ -45,7 +51,6 @@ limits = {
|
|||
|
||||
try:
|
||||
while True:
|
||||
|
||||
last_commands, buttons, left_trigger, right_trigger = (
|
||||
xbox_controller.get_last_command()
|
||||
)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import socket
|
||||
import time
|
||||
import pickle
|
||||
from mini_bdx_runtime.imu import Imu
|
||||
from open_duck_mini_runtime.imu import Imu
|
||||
from threading import Thread
|
||||
import time
|
||||
|
||||
|
|
13
setup.cfg
13
setup.cfg
|
@ -1,10 +1,10 @@
|
|||
[metadata]
|
||||
name = mini-bdx-runtime
|
||||
version = 0.0.1
|
||||
name = open-duck-mini-runtime
|
||||
version = 1.0.0
|
||||
author = Antoine Pirrone
|
||||
author_email = antoine.pirrone@gmail.com
|
||||
url = https://github.com/apirrone/mini_BDX_runtime
|
||||
description = Runtime code for mini BDX
|
||||
url = https://github.com/apirrone/Open_Duck_Mini_Runtime
|
||||
description = Runtime code for Open Duck Mini
|
||||
long_description = file: README.md
|
||||
long_description_content_type = text/markdown
|
||||
|
||||
|
@ -14,7 +14,7 @@ packages = find:
|
|||
zip_safe = True
|
||||
include_package_data = True
|
||||
package_dir=
|
||||
=mini_bdx_runtime
|
||||
=src
|
||||
install_requires =
|
||||
RPi.GPIO==0.7.1
|
||||
rustypot==0.1.0
|
||||
|
@ -29,7 +29,7 @@ install_requires =
|
|||
# adafruit_extended_bus
|
||||
|
||||
[options.packages.find]
|
||||
where=mini_bdx_runtime
|
||||
where=src
|
||||
|
||||
[options.package_data]
|
||||
|
||||
|
@ -37,3 +37,4 @@ where=mini_bdx_runtime
|
|||
|
||||
[options.entry_points]
|
||||
console_scripts =
|
||||
walk = open_duck_mini_runtime.walk:main
|
||||
|
|
|
@ -50,7 +50,7 @@ class Buttons:
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from mini_bdx_runtime.xbox_controller import XBoxController
|
||||
from open_duck_mini_runtime.xbox_controller import XBoxController
|
||||
|
||||
xbox_controller = XBoxController(30)
|
||||
buttons = Buttons()
|
|
@ -2,7 +2,7 @@ import time
|
|||
|
||||
import numpy as np
|
||||
import rustypot
|
||||
from mini_bdx_runtime.duck_config import DuckConfig
|
||||
from open_duck_mini_runtime.duck_config import DuckConfig
|
||||
|
||||
|
||||
class HWI:
|
|
@ -2,23 +2,27 @@ import time
|
|||
import pickle
|
||||
|
||||
import numpy as np
|
||||
from mini_bdx_runtime.rustypot_position_hwi import HWI
|
||||
from mini_bdx_runtime.onnx_infer import OnnxInfer
|
||||
from open_duck_mini_runtime.hwi import HWI
|
||||
from open_duck_mini_runtime.onnx_infer import OnnxInfer
|
||||
|
||||
from mini_bdx_runtime.raw_imu import Imu
|
||||
from mini_bdx_runtime.poly_reference_motion import PolyReferenceMotion
|
||||
from mini_bdx_runtime.xbox_controller import XBoxController
|
||||
from mini_bdx_runtime.feet_contacts import FeetContacts
|
||||
from mini_bdx_runtime.eyes import Eyes
|
||||
from mini_bdx_runtime.sounds import Sounds
|
||||
from mini_bdx_runtime.antennas import Antennas
|
||||
from mini_bdx_runtime.projector import Projector
|
||||
from mini_bdx_runtime.rl_utils import make_action_dict, LowPassActionFilter
|
||||
from mini_bdx_runtime.duck_config import DuckConfig
|
||||
from open_duck_mini_runtime.raw_imu import Imu
|
||||
from open_duck_mini_runtime.poly_reference_motion import PolyReferenceMotion
|
||||
from open_duck_mini_runtime.xbox_controller import XBoxController
|
||||
from open_duck_mini_runtime.feet_contacts import FeetContacts
|
||||
from open_duck_mini_runtime.eyes import Eyes
|
||||
from open_duck_mini_runtime.sounds import Sounds
|
||||
from open_duck_mini_runtime.antennas import Antennas
|
||||
from open_duck_mini_runtime.projector import Projector
|
||||
from open_duck_mini_runtime.rl_utils import make_action_dict, LowPassActionFilter
|
||||
from open_duck_mini_runtime.duck_config import DuckConfig
|
||||
|
||||
from importlib.resources import files
|
||||
import open_duck_mini_runtime
|
||||
|
||||
import os
|
||||
|
||||
HOME_DIR = os.path.expanduser("~")
|
||||
ASSETS_ROOT_PATH: str = str(files(open_duck_mini_runtime).joinpath("assets/"))
|
||||
|
||||
|
||||
class RLWalk:
|
||||
|
@ -36,7 +40,6 @@ class RLWalk:
|
|||
replay_obs=None,
|
||||
cutoff_frequency=None,
|
||||
):
|
||||
|
||||
self.duck_config = DuckConfig(config_json_path=duck_config_path)
|
||||
|
||||
self.commands = commands
|
||||
|
@ -99,8 +102,9 @@ class RLWalk:
|
|||
self.xbox_controller = XBoxController(self.command_freq)
|
||||
|
||||
# Reference motion, but we only really need the length of one phase
|
||||
# TODO
|
||||
self.PRM = PolyReferenceMotion("./polynomial_coefficients.pkl")
|
||||
self.PRM = PolyReferenceMotion(
|
||||
f"{ASSETS_ROOT_PATH}/polynomial_coefficients.pkl"
|
||||
)
|
||||
self.imitation_i = 0
|
||||
self.imitation_phase = np.array([0, 0])
|
||||
self.phase_frequency_factor = 1.0
|
||||
|
@ -114,14 +118,11 @@ class RLWalk:
|
|||
if self.duck_config.projector:
|
||||
self.projector = Projector()
|
||||
if self.duck_config.speaker:
|
||||
self.sounds = Sounds(
|
||||
volume=1.0, sound_directory="mini_bdx_runtime/assets/"
|
||||
)
|
||||
self.sounds = Sounds(volume=1.0, sound_directory=ASSETS_ROOT_PATH)
|
||||
if self.duck_config.antennas:
|
||||
self.antennas = Antennas()
|
||||
|
||||
def get_obs(self):
|
||||
|
||||
imu_data = self.imu.get_data()
|
||||
|
||||
dof_pos = self.hwi.get_present_positions(
|
||||
|
@ -185,7 +186,6 @@ class RLWalk:
|
|||
time.sleep(2)
|
||||
|
||||
def get_phase_frequency_factor(self, x_velocity):
|
||||
|
||||
max_phase_frequency = 1.2
|
||||
min_phase_frequency = 1.0
|
||||
|
||||
|
@ -345,7 +345,12 @@ if __name__ == "__main__":
|
|||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--onnx_model_path", type=str, required=True)
|
||||
parser.add_argument(
|
||||
"--onnx_model_path",
|
||||
type=str,
|
||||
required=False,
|
||||
default=f"{HOME_DIR}/BEST_WALK_ONNX_2.onnx",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--duck_config_path",
|
||||
type=str,
|
|
@ -3,7 +3,7 @@ from threading import Thread
|
|||
from queue import Queue
|
||||
import time
|
||||
import numpy as np
|
||||
from mini_bdx_runtime.buttons import Buttons
|
||||
from open_duck_mini_runtime.buttons import Buttons
|
||||
|
||||
|
||||
X_RANGE = [-0.15, 0.15]
|
|
@ -1,5 +1,5 @@
|
|||
from mini_bdx_runtime.xbox_controller import XBoxController
|
||||
from mini_bdx_runtime.antennas import Antennas
|
||||
from open_duck_mini_runtime.xbox_controller import XBoxController
|
||||
from open_duck_mini_runtime.antennas import Antennas
|
||||
import time
|
||||
|
||||
controller = XBoxController(60)
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
"""
|
||||
Warning, Obsolete code, kept for reference.
|
||||
"""
|
||||
|
||||
from openai import OpenAI
|
||||
import time
|
||||
import json
|
||||
|
@ -5,10 +9,10 @@ import os
|
|||
from io import BytesIO
|
||||
import base64
|
||||
|
||||
from v2_rl_walk_mujoco import RLWalk
|
||||
from v2_rl_walk_mujoco import RLWalk # TODO
|
||||
from threading import Thread
|
||||
import cv2
|
||||
from mini_bdx_runtime.camera import Cam
|
||||
from open_duck_mini_runtime.camera import Cam
|
||||
|
||||
# TODO mission : find an object ?
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ Debug script to check all motors in the robot.
|
|||
Verifies each motor is accessible and allows testing movement.
|
||||
"""
|
||||
|
||||
from mini_bdx_runtime.rustypot_position_hwi import HWI
|
||||
from mini_bdx_runtime.duck_config import DuckConfig
|
||||
from open_duck_mini_runtime.hwi import HWI
|
||||
from open_duck_mini_runtime.duck_config import DuckConfig
|
||||
import time
|
||||
import numpy as np
|
||||
import traceback
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
from mini_bdx_runtime.raw_imu import Imu
|
||||
from open_duck_mini_runtime.raw_imu import Imu
|
||||
|
||||
if __name__ == "__main__":
|
||||
imu = Imu(50, calibrate=True, upside_down=False)
|
|
@ -2,8 +2,8 @@
|
|||
Find the offsets to set in self.joints_offsets in hwi_feetech_pwm_control.py
|
||||
"""
|
||||
|
||||
from mini_bdx_runtime.rustypot_position_hwi import HWI
|
||||
from mini_bdx_runtime.duck_config import DuckConfig
|
||||
from open_duck_mini_runtime.hwi import HWI
|
||||
from open_duck_mini_runtime.duck_config import DuckConfig
|
||||
import time
|
||||
|
||||
dummy_config = DuckConfig(config_json_path=None, ignore_default=True)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from mini_bdx_runtime.rustypot_position_hwi import HWI
|
||||
from mini_bdx_runtime.duck_config import DuckConfig
|
||||
from open_duck_mini_runtime.hwi import HWI
|
||||
from open_duck_mini_runtime.duck_config import DuckConfig
|
||||
import time
|
||||
|
||||
duck_config = DuckConfig()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from mini_bdx_runtime.rustypot_position_hwi import HWI
|
||||
from mini_bdx_runtime.duck_config import DuckConfig
|
||||
from open_duck_mini_runtime.hwi import HWI
|
||||
from open_duck_mini_runtime.duck_config import DuckConfig
|
||||
import time
|
||||
|
||||
duck_config = DuckConfig()
|
||||
|
|
Loading…
Reference in a new issue