# Sampling data at a lower frequency

**URL:** <https://opensourceleg.discourse.group/t/sampling-data-at-a-lower-frequency/175>\
**Category:** Software\
**Created:** [January 8, 2026, 1:01am UTC](https://opensourceleg.discourse.group/t/sampling-data-at-a-lower-frequency/175 "2026-01-08T01:01:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cangelid](https://avatars.discourse-cdn.com/v4/letter/c/5e9695/32.png) [@cangelid](https://opensourceleg.discourse.group/u/cangelid)\
**Post date:** [January 8, 2026, 1:01am UTC](https://opensourceleg.discourse.group/t/sampling-data-at-a-lower-frequency/175/1 "2026-01-08T01:01:13Z")

</div>

Hello all and happy new year:)

I was recording data using the OSL running the FSM with a set frequency at 200Hz, which is also the default set within the OSL github repos. However, I noticed that the t variable I am getting from the clock is actually at a much lower frequency (~30Hz). I noticed that while running the newest version of the [FSM walking controller.](https://opensourceleg/examples/fsm_walking_python_controller.py%20at%20main%20%C2%B7%20neurobionics/opensourceleg) Using the legacy version of the FSM, I am recording data at the set frequency (200Hz), but I am not sure why the frequency is kept in one version of the code and not the other.

Am I missing something here? Any ideas or insights would be appreciated.

---

<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:** [January 9, 2026, 9:02am UTC](https://opensourceleg.discourse.group/t/sampling-data-at-a-lower-frequency/175/2 "2026-01-09T09:02:17Z")

</div>

Hello and happy new year !

It is strange to reach this low frequency. Can you be more precise on which version of the codes you are using (referencing commit id or branches would help). Also are you using the same python environment for running both code ?

Louis

---

<div class="post-metadata">

**Author:** ![cangelid](https://avatars.discourse-cdn.com/v4/letter/c/5e9695/32.png) [@cangelid](https://opensourceleg.discourse.group/u/cangelid)\
**Post date:** [January 9, 2026, 8:01pm UTC](https://opensourceleg.discourse.group/t/sampling-data-at-a-lower-frequency/175/3 "2026-01-09T20:01:18Z")

</div>

Hi Louis. I am working with virtual environments, so I have 2 separate environments.

1. using the opensourceleg 3.4.1 version ([Commit 6a8ef34,](https://github.com/neurobionics/opensourceleg/commit/6a8ef3461967c8589ba1c8ca3ccb190fa9662082) main branch)
2. using the opensourceleg 2.3.0 version ([branch: legacy-opensourceleg](https://github.com/neurobionics/opensourceleg/tree/legacy-opensourceleg))

I am running Python 3.11.2 in both environments.

In both cases, the FSM code is different with respect to dependencies and packages, but effectively, it’s the same functionality. When using the most recent version of the osl (1), I am getting a data sampling frequency between 30 and 70Hz, although the set frequency in the code is 200Hz. The same happens when I set the frequency to 100Hz, I am still getting between 30-70Hz. As a sidenote, if I run the FSM code without commanding impedance, it seems like I am getting close to the 200Hz. However, once I send impedance commands to the motors (just uncommenting the section that is [commented out in this code](https://github.com/neurobionics/opensourceleg/blob/main/examples/fsm_walking_python_controller.py)), I am getting about 70Hz. Although I would expect some delay, going from 200Hz to 70Hz or lower is drastical.

When using the legacy version, the sampling rate is consistent with the set frequency.

---

<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:** [January 12, 2026, 8:00am UTC](https://opensourceleg.discourse.group/t/sampling-data-at-a-lower-frequency/175/4 "2026-01-12T08:00:26Z")

</div>

Hi

The `flexsea` python package (the package used to communicate with the dephy actuators) has some extra sleep when setting the gains: [see here](https://github.com/DephyInc/Actuator-Package/pull/142/files)

The version used in the legacy version is the 8.0.1. In this version I did not see the problematic sleep but I did not went through the complete code base either.

You can modify the local code of this package (That’s what I will do to confirm that is the root of the problem). You can also change the definition of the package in the `pyproject.toml`([example here](https://github.com/tkevinbest/opensourceleg/blob/main/pyproject.toml)) to use a fixed version of the package ([example here](https://github.com/tkevinbest/Actuator-Package)).

In any case pay attention if you need to update the package.

Regards,

---

<div class="post-metadata">

**Author:** ![cangelid](https://avatars.discourse-cdn.com/v4/letter/c/5e9695/32.png) [@cangelid](https://opensourceleg.discourse.group/u/cangelid)\
**Post date:** [January 21, 2026, 1:11am UTC](https://opensourceleg.discourse.group/t/sampling-data-at-a-lower-frequency/175/5 "2026-01-21T01:11:07Z")

</div>

Hi Louis, thanks for taking the time to look into this.

I am still unsure how to work around the sleep issue. I am using the flexsea 12.0.4 package with the opensourceleg 3.4.1. If I try to downgrade to a previous version of the flexsea package (the one I am using for the legacy version of the OSL) using the command _python3 -m pip install flexsea==8.0.1_ , I am not able to run the FSM code due to dependencies missing.

The way I have currently set up the leg is using the [standard installation](https://neurobionics.github.io/opensourceleg/installation/). The only pyproject.toml file that I can find within my virtual environment after installing all dependencies is under pandas and does not have the structure seen [here](https://github.com/tkevinbest/opensourceleg/blob/main/pyproject.toml). I am including a snapshot below just for reference. I am not sure if that is related to the way I have set up the leg, but it seems that i am not able to control the definition of the package in the `pyproject.toml.`I am currently looking into that.

Were you on your end able to confirm whether the extra sleep is what causes the sampling delay?

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/opensourceleg1/original/1X/dd6d5e8e85bb91efc4d6934616b103602c4001e1.png)

---

<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:** [January 21, 2026, 8:15am UTC](https://opensourceleg.discourse.group/t/sampling-data-at-a-lower-frequency/175/6 "2026-01-21T08:15:42Z")

</div>

Hi @cangelid,

I would suggest you to modify directly the `flexsea` package:

- Do a normal installation
- Go inside your `venv` and find the `flexsea` package
- Edit the `device.py` file
- Remove the `sleep` (~ line 491 in `set_gains`)

Test to run the FSM with this setup.

On my own I did not test the difference with or without the sleep. I always used this setup without the sleep. I do not have access to an OSL/Dephy actuator for now so I cannot try it either.

---

<div class="post-metadata">

**Author:** ![cangelid](https://avatars.discourse-cdn.com/v4/letter/c/5e9695/32.png) [@cangelid](https://opensourceleg.discourse.group/u/cangelid)\
**Post date:** [January 21, 2026, 8:06pm UTC](https://opensourceleg.discourse.group/t/sampling-data-at-a-lower-frequency/175/7 "2026-01-21T20:06:04Z")

</div>

That worked Louis, thank you for the help!
