♻️ full agent refactor
This commit is contained in:
10
assets/motor/hardware.yaml
Normal file
10
assets/motor/hardware.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
# Motor-only hardware config
|
||||
# Encoder and motor constants for the motor-only sysid capture.
|
||||
|
||||
encoder:
|
||||
ppr: 11 # pulses per revolution (before quadrature)
|
||||
gear_ratio: 30.0 # gearbox ratio
|
||||
# counts_per_rev = ppr × gear_ratio × 4 (quadrature) = 1320
|
||||
|
||||
motor:
|
||||
max_pwm: 255 # maximum PWM command accepted by firmware
|
||||
40
assets/motor/motor.xml
Normal file
40
assets/motor/motor.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<mujoco model="motor_sysid">
|
||||
<compiler angle="radian" autolimits="true"/>
|
||||
<option timestep="0.002" integrator="Euler"/>
|
||||
|
||||
<worldbody>
|
||||
<light pos="0 0 1" dir="0 0 -1"/>
|
||||
|
||||
<!-- Fixed base (gearbox housing) -->
|
||||
<body name="base" pos="0 0 0.15">
|
||||
<geom type="cylinder" size="0.04 0.06" mass="0.921"
|
||||
rgba="0.3 0.3 0.3 1" contype="0" conaffinity="0"/>
|
||||
|
||||
<!-- Arm: rotates around motor_joint (z-axis) -->
|
||||
<body name="arm" pos="0 0 0">
|
||||
<joint name="motor_joint" type="hinge" axis="0 0 1"
|
||||
range="-1.5708 1.5708"
|
||||
damping="0.001" armature="0.0001" frictionloss="0.03"/>
|
||||
|
||||
<!-- Rotor disk: mass is tunable by the optimizer -->
|
||||
<geom name="rotor_disk" type="cylinder" size="0.008 0.004"
|
||||
mass="0.012" pos="0 0 0" rgba="0.6 0.6 0.6 1"
|
||||
contype="0" conaffinity="0"/>
|
||||
|
||||
<!-- Arm load: lightweight arm attached to motor shaft -->
|
||||
<geom name="arm_load" type="capsule" size="0.004"
|
||||
fromto="0 0 0 -0.014 0.002 0.016"
|
||||
mass="0.021" rgba="0.8 0.3 0.1 1"
|
||||
contype="0" conaffinity="0"/>
|
||||
</body>
|
||||
</body>
|
||||
</worldbody>
|
||||
|
||||
<actuator>
|
||||
<general name="motor" joint="motor_joint"
|
||||
gear="0.064"
|
||||
ctrllimited="true" ctrlrange="-1 1"
|
||||
dyntype="filter" dynprm="0.03"/>
|
||||
</actuator>
|
||||
</mujoco>
|
||||
42
assets/motor/motor_bare.xml
Normal file
42
assets/motor/motor_bare.xml
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Motor-only model WITHOUT arm/pendulum load.
|
||||
Use for arm-off sysid captures. arm_load mass set to ~0. -->
|
||||
<mujoco model="motor_sysid_bare">
|
||||
<compiler angle="radian" autolimits="true"/>
|
||||
<option timestep="0.002" integrator="Euler"/>
|
||||
|
||||
<worldbody>
|
||||
<light pos="0 0 1" dir="0 0 -1"/>
|
||||
|
||||
<!-- Fixed base (gearbox housing) -->
|
||||
<body name="base" pos="0 0 0.15">
|
||||
<geom type="cylinder" size="0.04 0.06" mass="0.921"
|
||||
rgba="0.3 0.3 0.3 1" contype="0" conaffinity="0"/>
|
||||
|
||||
<!-- Arm: rotates around motor_joint (z-axis) -->
|
||||
<body name="arm" pos="0 0 0">
|
||||
<joint name="motor_joint" type="hinge" axis="0 0 1"
|
||||
range="-1.5708 1.5708"
|
||||
damping="0.001" armature="0.0001" frictionloss="0.03"/>
|
||||
|
||||
<!-- Rotor disk: mass is tunable by the optimizer -->
|
||||
<geom name="rotor_disk" type="cylinder" size="0.008 0.004"
|
||||
mass="0.012" pos="0 0 0" rgba="0.6 0.6 0.6 1"
|
||||
contype="0" conaffinity="0"/>
|
||||
|
||||
<!-- Arm load: near-zero mass for bare-shaft sysid -->
|
||||
<geom name="arm_load" type="capsule" size="0.004"
|
||||
fromto="0 0 0 -0.014 0.002 0.016"
|
||||
mass="0.001" rgba="0.8 0.3 0.1 0.3"
|
||||
contype="0" conaffinity="0"/>
|
||||
</body>
|
||||
</body>
|
||||
</worldbody>
|
||||
|
||||
<actuator>
|
||||
<general name="motor" joint="motor_joint"
|
||||
gear="0.064"
|
||||
ctrllimited="true" ctrlrange="-1 1"
|
||||
dyntype="filter" dynprm="0.03"/>
|
||||
</actuator>
|
||||
</mujoco>
|
||||
BIN
assets/motor/motor_sysid_comparison.png
Normal file
BIN
assets/motor/motor_sysid_comparison.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 463 KiB |
67
assets/motor/motor_sysid_result.json
Normal file
67
assets/motor/motor_sysid_result.json
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"best_params": {
|
||||
"actuator_gear_pos": 0.3711939014035462,
|
||||
"actuator_gear_neg": 0.42814281188601877,
|
||||
"actuator_filter_tau": 0.022300731564787457,
|
||||
"motor_damping_pos": 0.0013836218905629106,
|
||||
"motor_damping_neg": 0.005196351489379768,
|
||||
"motor_armature": 0.0027534181478216656,
|
||||
"motor_frictionloss_pos": 0.03674406439012955,
|
||||
"motor_frictionloss_neg": 0.06908200024786905,
|
||||
"viscous_quadratic": 0.000958226218765762,
|
||||
"back_emf_gain": 0.0036492272912788297,
|
||||
"stribeck_friction_boost": 0.044748043677129666,
|
||||
"stribeck_vel": 4.0513395945623705,
|
||||
"rotor_mass": 0.03982640764507874,
|
||||
"motor_deadzone_pos": 0.14181963932762467,
|
||||
"motor_deadzone_neg": 0.031454276545010214,
|
||||
"action_bias": -0.007362969452509152,
|
||||
"gearbox_backlash": 1.4749880999407965e-09
|
||||
},
|
||||
"best_cost": 0.21167928018839952,
|
||||
"recording": "/Users/victormylle/Library/CloudStorage/SeaDrive-VictorMylle(cloud.optimize-it.be)/My Libraries/Projects/AI/RL-Framework/assets/motor/recordings/motor_from_cartpole_162432.npz",
|
||||
"param_names": [
|
||||
"actuator_gear_pos",
|
||||
"actuator_gear_neg",
|
||||
"actuator_filter_tau",
|
||||
"motor_damping_pos",
|
||||
"motor_damping_neg",
|
||||
"motor_armature",
|
||||
"motor_frictionloss_pos",
|
||||
"motor_frictionloss_neg",
|
||||
"viscous_quadratic",
|
||||
"back_emf_gain",
|
||||
"stribeck_friction_boost",
|
||||
"stribeck_vel",
|
||||
"rotor_mass",
|
||||
"motor_deadzone_pos",
|
||||
"motor_deadzone_neg",
|
||||
"action_bias",
|
||||
"gearbox_backlash"
|
||||
],
|
||||
"defaults": {
|
||||
"actuator_gear_pos": 0.064,
|
||||
"actuator_gear_neg": 0.064,
|
||||
"actuator_filter_tau": 0.03,
|
||||
"motor_damping_pos": 0.003,
|
||||
"motor_damping_neg": 0.003,
|
||||
"motor_armature": 0.0001,
|
||||
"motor_frictionloss_pos": 0.03,
|
||||
"motor_frictionloss_neg": 0.03,
|
||||
"viscous_quadratic": 0.0,
|
||||
"back_emf_gain": 0.0,
|
||||
"stribeck_friction_boost": 0.0,
|
||||
"stribeck_vel": 2.0,
|
||||
"rotor_mass": 0.012,
|
||||
"motor_deadzone_pos": 0.08,
|
||||
"motor_deadzone_neg": 0.08,
|
||||
"action_bias": 0.0,
|
||||
"gearbox_backlash": 0.0
|
||||
},
|
||||
"timestamp": "2026-03-23T20:50:53.648753",
|
||||
"history_summary": {
|
||||
"first_cost": 5.105499579419285,
|
||||
"final_cost": 0.21167928018839952,
|
||||
"generations": 500
|
||||
}
|
||||
}
|
||||
19
assets/motor/motor_tuned.xml
Normal file
19
assets/motor/motor_tuned.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<mujoco model="motor_sysid">
|
||||
<compiler angle="radian" autolimits="true" />
|
||||
<option timestep="0.002" integrator="Euler" />
|
||||
<worldbody>
|
||||
<light pos="0 0 1" dir="0 0 -1" />
|
||||
<body name="base" pos="0 0 0.15">
|
||||
<geom type="cylinder" size="0.04 0.06" mass="0.921" rgba="0.3 0.3 0.3 1" contype="0" conaffinity="0" />
|
||||
<body name="arm" pos="0 0 0">
|
||||
<joint name="motor_joint" type="hinge" axis="0 0 1" range="-1.5708 1.5708" damping="0" armature="0.0027534181478216656" frictionloss="0" />
|
||||
<geom name="rotor_disk" type="cylinder" size="0.008 0.004" mass="0.03982640764507874" pos="0 0 0" rgba="0.6 0.6 0.6 1" contype="0" conaffinity="0" />
|
||||
<geom name="arm_load" type="capsule" size="0.004" fromto="0 0 0 -0.014 0.002 0.016" mass="0.021" rgba="0.8 0.3 0.1 1" contype="0" conaffinity="0" />
|
||||
</body>
|
||||
</body>
|
||||
</worldbody>
|
||||
<actuator>
|
||||
<general name="motor" joint="motor_joint" gear="0.3996683566447825" ctrllimited="true" ctrlrange="-1 1" dyntype="filter" dynprm="0.022300731564787457" />
|
||||
</actuator>
|
||||
</mujoco>
|
||||
6
assets/motor/robot.yaml
Normal file
6
assets/motor/robot.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
# Motor-only sysid config
|
||||
# Minimal config for the motor-only identification pipeline.
|
||||
# The optimizer patches motor.xml in-memory; this file tells it
|
||||
# which MJCF to load and provides encoder/hardware constants.
|
||||
|
||||
mjcf: motor.xml
|
||||
4
assets/motor/robot_bare.yaml
Normal file
4
assets/motor/robot_bare.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
# Motor-only sysid config — bare shaft (no arm/pendulum load)
|
||||
# Use with arm-off captures to identify pure motor dynamics.
|
||||
|
||||
mjcf: motor_bare.xml
|
||||
23
assets/motor/robot_tuned.yaml
Normal file
23
assets/motor/robot_tuned.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
# Tuned motor config — generated by src.sysid.motor.optimize
|
||||
# Original: robot.yaml
|
||||
|
||||
mjcf: motor_tuned.xml
|
||||
joints:
|
||||
motor_joint:
|
||||
armature: 0.002753
|
||||
frictionloss: 0.052913
|
||||
hardware_realism:
|
||||
actuator_gear_pos: 0.371194
|
||||
actuator_gear_neg: 0.428143
|
||||
motor_damping_pos: 0.001384
|
||||
motor_damping_neg: 0.005196
|
||||
motor_frictionloss_pos: 0.036744
|
||||
motor_frictionloss_neg: 0.069082
|
||||
motor_deadzone_pos: 0.14182
|
||||
motor_deadzone_neg: 0.031454
|
||||
action_bias: -0.007363
|
||||
viscous_quadratic: 0.000958
|
||||
back_emf_gain: 0.003649
|
||||
stribeck_friction_boost: 0.044748
|
||||
stribeck_vel: 4.05134
|
||||
gearbox_backlash: 0.0
|
||||
Reference in New Issue
Block a user