-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Description
While using rolling buffers for longer or infinite simulations, logging joint actuators data results in error or wrong values when directly compared with the data from MuJoCo at the very same iteration.
Expected Behavior
With or without rolling buffers, the current iteration should always return the true recorded value from the sensors in the physics engine via FARMS data.
Actual Behavior
Values kept repeating while the underlying data from MuJoCo never changed
Proposed fix
The problem arises from the function def physicsactuators2data(physics, iteration, data, sensor_maps, units) in physics.py
The cumulative summing here expects an array pre-initialized to zeros, which is true in the default case. While using rolling/circular buffers, previous values are reused to cumulatively add to the previous values resulting in errors.
data.sensors.joints.array[iteration, :, sc.joint_torque] += (
physics.data.sensordata[sensor_maps['actuatorfrc_position2data']]
)*itorquesAdding the following line at the beginning of the function ensures that data at the current iteration is reset to zero.
This is not a good solution either if the same data has to edited outside the function.
In the future, we should avoid this and rather consider logging the individual components separately.
data.sensors.joints.array[iteration, :, sc.joint_torque] = 0.0Environment
- FARMS version: 0.1
- Python version: 3.11
- Operating System: [Ubuntu 20.04, Windows 10, macOS 12.1]
- Hardware: [e.g. CPU specs, GPU if relevant]
Additional Context
Error Messages
It is a soft error that does not cause any crashes.