# Signals for dynamic parameter identification

**URL:** <https://opensourceleg.discourse.group/t/signals-for-dynamic-parameter-identification/187>\
**Category:** Software\
**Created:** [January 30, 2026, 2:57pm UTC](https://opensourceleg.discourse.group/t/signals-for-dynamic-parameter-identification/187 "2026-01-30T14:57:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mioki](https://avatars.discourse-cdn.com/v4/letter/m/f19dbf/32.png) [@mioki](https://opensourceleg.discourse.group/u/mioki)\
**Post date:** [January 30, 2026, 2:57pm UTC](https://opensourceleg.discourse.group/t/signals-for-dynamic-parameter-identification/187/1 "2026-01-30T14:57:23Z")

</div>

Hi everyone,

I’m opening a new thread to better explain my use case and ask for guidance on **dynamic parameter identification** with the OpenSourceLeg 2.0 (knee + ankle, Dephy Actpack).

### Context

My final goal is **offline inverse-dynamics / least-squares identification** of the leg dynamics. For this reason, I need to reliably acquire:

- joint position qqq

- joint velocity q˙\dot{q}q˙​

- joint acceleration q¨\ddot{q}q¨​ (offline estimation is fine)

- joint torque τ\tauτ

I’m currently using **position control only** (no impedance / current control), with excitation trajectories designed to be LS-friendly (multisine, chirp, decoupled motions, etc.).

One source of confusion for me is that some of the scripts I started from were shown to us directly during a lab demo of the **OpenSourceLeg 2.0** (by Humotech), while the repository examples sometimes use slightly different APIs or signal names. So I’m not fully confident about **which signals are measured, which are estimated, and which are recommended for identification**. Below is a **minimal version** of the acquisition code, stripped down to only the essential control commands and logged signals.

My doubts are mainly about **signal meaning and best practices** :

1. **Joint torque**

2. **Gear ratio**

3. **Joint velocity**

4. **Acceleration**

Any advice, clarification, or reference to **recommended practices for system identification with OSL + Dephy Actpack** would be extremely valuable for me.

Thanks **very much in advance** for your time and help — any suggestion is genuinely useful.

import time import numpy as np from opensourceleg.osl import OpenSourceLeg from opensourceleg.tools import units

frequency = 200 # Hz run\_seconds = 40.0

# Simple excitation trajectories

def knee\_traj(t): return 40.0 \* np.sin(1.2 \* t) + 40.0 # deg

def ankle\_traj(t): return 20.0 \* np.sin(1.0 \* t) # deg

# -------------------- OSL INIT --------------------

osl = OpenSourceLeg(frequency=frequency) osl.add\_joint(“knee”, gear\_ratio=9 \* 83 / 18, port=“/dev/ttyACM0”) osl.add\_joint(“ankle”, gear\_ratio=9 \* 83 / 18, port=“/dev/ttyACM1”)

t\_log = qk\_log = ; qa\_log = qkp\_log = ; qap\_log = tau\_k\_log = ; tau\_a\_log = ik\_log = ; ia\_log =

with osl: osl.home() input(“Homing complete. Press ENTER to start.”)

```auto
osl.knee.set_mode(osl.knee.control_modes.position)
osl.ankle.set_mode(osl.ankle.control_modes.position)

osl.knee.set_position_gains(kp=10)
osl.ankle.set_position_gains(kp=10)

# Warm-up
for _ in range(20):
    osl.update()
    time.sleep(0.01)

t0 = time.time()

for t in osl.clock:
    if time.time() - t0 > run_seconds:
        break

    osl.update()

    # Commanded positions
    qk_cmd = units.convert_to_default(knee_traj(t), units.position.deg)
    qa_cmd = units.convert_to_default(ankle_traj(t), units.position.deg)

    osl.knee.set_output_position(qk_cmd)
    osl.ankle.set_output_position(qa_cmd)

    # ---------------- Measurements ----------------
    qk = float(osl.knee.output_position)
    qa = float(osl.ankle.output_position)

    qkp = float(getattr(osl.knee, "output_velocity", np.nan))
    qap = float(getattr(osl.ankle, "output_velocity", np.nan))

    tau_k = float(getattr(osl.knee, "joint_torque", np.nan))
    tau_a = float(getattr(osl.ankle, "joint_torque", np.nan))

    ik = float(getattr(osl.knee, "motor_current", np.nan))
    ia = float(getattr(osl.ankle, "motor_current", np.nan))

    # Log
    t_log.append(t)
    qk_log.append(qk); qa_log.append(qa)
    qkp_log.append(qkp); qap_log.append(qap)
    tau_k_log.append(tau_k); tau_a_log.append(tau_a)
    ik_log.append(ik); ia_log.append(ia)

```

---

<div class="post-metadata">

**Author:** ![ldevillez](https://yyz2.discourse-cdn.com/flex036/user_avatar/opensourceleg.discourse.group/ldevillez/32/71_2.png) [@ldevillez](https://opensourceleg.discourse.group/u/ldevillez)\
**Post date:** [February 8, 2026, 4:54pm UTC](https://opensourceleg.discourse.group/t/signals-for-dynamic-parameter-identification/187/2 "2026-02-08T16:54:08Z")

</div>

Hi @mioki,

The best way to start would be the documentation: [opensourceleg](https://neurobionics.github.io/opensourceleg/). Looking at the source code can also be a great help.

The `joint_torque` is computed from the current: [opensourceleg/opensourceleg/actuators/dephy.py at main · neurobionics/opensourceleg · GitHub](https://github.com/neurobionics/opensourceleg/blob/main/opensourceleg/actuators/dephy.py#L795)

The gear ratio is specified to have a generic library to allow people to modify their OSL or create other robot with the same library.

When there is `output` in the name of the variable is should be in the joint frame. I don’t really know which `joint_torque` do you speak about. However, there is the `output_torque` variable.

There is a 14-bit encoder inside the dephy actuator so the velocity is probably measured from it.

---

<div class="post-metadata">

**Author:** ![mioki](https://avatars.discourse-cdn.com/v4/letter/m/f19dbf/32.png) [@mioki](https://opensourceleg.discourse.group/u/mioki)\
**Post date:** [February 9, 2026, 8:43am UTC](https://opensourceleg.discourse.group/t/signals-for-dynamic-parameter-identification/187/3 "2026-02-09T08:43:28Z")

</div>

thank you so much for your help!
