mirror of
https://github.com/apirrone/Open_Duck_Mini_Runtime.git
synced 2025-09-02 19:23:54 +00:00
serial port in duck_config
This commit is contained in:
parent
4ce2bca4d5
commit
d16f47430c
4 changed files with 5 additions and 3 deletions
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"serial_port": "/dev/ttyACM0",
|
||||
"start_paused": false,
|
||||
"imu_upside_down": false,
|
||||
"phase_frequency_factor_offset": 0.0,
|
||||
|
|
|
@ -46,6 +46,7 @@ class DuckConfig:
|
|||
print("Exiting...")
|
||||
exit(1)
|
||||
|
||||
self.serial_port = self.json_config.get("serial_port", "/dev/ttyACM0")
|
||||
self.start_paused = self.json_config.get("start_paused", False)
|
||||
self.imu_upside_down = self.json_config.get("imu_upside_down", False)
|
||||
self.phase_frequency_factor_offset = self.json_config.get(
|
||||
|
|
|
@ -6,7 +6,7 @@ from mini_bdx_runtime.duck_config import DuckConfig
|
|||
|
||||
|
||||
class HWI:
|
||||
def __init__(self, duck_config: DuckConfig, usb_port: str = "/dev/ttyACM0"):
|
||||
def __init__(self, duck_config: DuckConfig, usb_port: str = None):
|
||||
|
||||
self.duck_config = duck_config
|
||||
|
||||
|
@ -74,6 +74,7 @@ class HWI:
|
|||
self.kds = np.ones(len(self.joints)) * 0 # default kd
|
||||
self.low_torque_kps = np.ones(len(self.joints)) * 2
|
||||
|
||||
usb_port = usb_port if usb_port else self.duck_config.serial_port
|
||||
self.io = rustypot.feetech(usb_port, 1000000)
|
||||
|
||||
def set_kps(self, kps):
|
||||
|
|
|
@ -27,7 +27,6 @@ class RLWalk:
|
|||
self,
|
||||
onnx_model_path: str,
|
||||
duck_config_path: str = f"{HOME_DIR}/duck_config.json",
|
||||
serial_port: str = "/dev/ttyACM0",
|
||||
control_freq: float = 50,
|
||||
pid=[30, 0, 0],
|
||||
action_scale=0.25,
|
||||
|
@ -67,7 +66,7 @@ class RLWalk:
|
|||
self.control_freq, cutoff_frequency
|
||||
)
|
||||
|
||||
self.hwi = HWI(self.duck_config, serial_port)
|
||||
self.hwi = HWI(self.duck_config)
|
||||
|
||||
self.start()
|
||||
|
||||
|
|
Loading…
Reference in a new issue