Skip to content

Add Noise to the IMU sensors in the Mujoco simulation#854

Open
MegaIng wants to merge 3 commits into
mainfrom
simulation_imu_noise
Open

Add Noise to the IMU sensors in the Mujoco simulation#854
MegaIng wants to merge 3 commits into
mainfrom
simulation_imu_noise

Conversation

@MegaIng
Copy link
Copy Markdown
Contributor

@MegaIng MegaIng commented May 12, 2026

Summary

Adds noise for the IMU in the Mujoco simulation. The default parameters approximate a simple measurement of a real robot, but no systematic measurement has been done. No systematic biases have been measured, which matches others experiences. The ability to add these has still been provided incase people want to test this ability out.

Proposed changes

Add helper classes NoisySensor and NoisyQuternionSensor. This would also simplify if we ever want to add noise to the other sensors.

Add parameter handling for the noise parameters. Also update handling of a few of the older parameters, AFAICT, the get_parameter_or does not actually work the way it was used before (at least I couldn't get it to work with my new parameters).

Related issues

closes #825

Checklist

  • Run pixi run build
  • Write documentation
  • Test on your machine
  • Test on the robot
  • Create issues for future work
  • Triage this PR and label it

@github-project-automation github-project-automation Bot moved this to 🆕 New in Software May 12, 2026
@jaagut jaagut moved this from 🆕 New to 👀 In review in Software May 16, 2026
Comment thread src/bitbots_simulation/bitbots_mujoco_sim/bitbots_mujoco_sim/robot.py Outdated
Comment thread src/bitbots_simulation/bitbots_mujoco_sim/bitbots_mujoco_sim/sensor.py Outdated
Comment on lines +19 to +23
@property
def noisy_data(self) -> np.ndarray:
"""Gets the current sensor reading with measurement noise applied."""
return self.data

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not so happy with always calling noisy_data even for non-noisy Sensors. I would do the reverse, if there is no reason to get the raw non-noisy data of a NoisySensor.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can imagine usecases for getting the non-noisy data, e.g. when providing data for my automated testing framework developed in the context of StuFo (which is currently still on wolfgang and I wont try to merge it till StuFo is done).

But that can be done just as well using raw_data & data instead of data & noisy_data. I don't have a strong preference between the two, keeping data intact as the groundtruth felt less disruptive and more predictable to me. If you want it the other way around I can do it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, now I agree more with how you already did it.

Comment thread src/bitbots_simulation/bitbots_mujoco_sim/bitbots_mujoco_sim/sensor.py Outdated
Comment thread src/bitbots_simulation/bitbots_mujoco_sim/bitbots_mujoco_sim/robot.py Outdated
Comment thread src/bitbots_simulation/bitbots_mujoco_sim/bitbots_mujoco_sim/robot.py Outdated
Comment on lines 18 to 21
from bitbots_mujoco_sim.robot import Robot

if TYPE_CHECKING:
from bitbots_mujoco_sim.simulation import RobotSimulation
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You actually use this in line 66, so it will fail if TYPE_CHECKING == False

Suggested change
from bitbots_mujoco_sim.robot import Robot
from bitbots_mujoco_sim.simulation import RobotSimulation

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. GitHub's suggestions are broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

add imu noise to simulation

2 participants