Skip to content

Fix compass observation floating point bounds (#579) - #2233

Open
Functionhx wants to merge 1 commit into
facebookresearch:mainfrom
Functionhx:fix/compass-bounds
Open

Fix compass observation floating point bounds (#579)#2233
Functionhx wants to merge 1 commit into
facebookresearch:mainfrom
Functionhx:fix/compass-bounds

Conversation

@Functionhx

Copy link
Copy Markdown

Fixes #579

The compass sensor's observation space declares an upper bound of pi (3.141592653589793), but the sensor can return slightly higher values due to floating point error when converting the arctan2 result to float32. This commit adds np.clip() in _quat_to_xy_heading() to keep the heading value within the declared bounds of [-pi, pi].

Fixed by: np.clip(phi, -np.pi, np.pi) before creating the output array.

np.clip the heading value from _quat_to_xy_heading to [-pi, pi]
to prevent floating point errors from producing values slightly
outside the declared observation space bounds.

Fixes facebookresearch#579
@meta-cla meta-cla Bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Do not delete this pull request or issue due to inactivity.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect compass observation space

1 participant