Skip to content

Log MuJoCo errors through BSKLogger #1022

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

juan-g-bonilla
Copy link
Contributor

Description

Original issue:

This happens whenever MuJoCo raises a warning or error. This is not ideal, as it contaminates the workspace and Basilisk already has established logging practices. Standard Basilisk logging should be used in place of printing to a file.

To address this, we set the custom error/warning callbacks in MuJoCo to call BSKLogger::bskLog. For the case of the error callback, we also throw an exception (as the program is expected to be interrupted).

Verification

Manually triggered erroneous behavior and asserted that no log file is created, but rather the logger is used. Feature is considered non-critical and small enough to not require a regtest.

Documentation

Release notes updated.

@juan-g-bonilla juan-g-bonilla self-assigned this Jun 20, 2025
@juan-g-bonilla juan-g-bonilla requested a review from a team as a code owner June 20, 2025 06:20
@juan-g-bonilla juan-g-bonilla added the enhancement New feature or request label Jun 20, 2025
@juan-g-bonilla juan-g-bonilla force-pushed the feature/1021-mujoco-logging branch from 2d48046 to 41040e0 Compare June 20, 2025 06:21
Copy link
Contributor

@schaubh schaubh left a comment

Choose a reason for hiding this comment

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

small comment on adding a hyperlink in the release notes statement. Otherwise branch is good. But, you need to rebase this branch onto develop, not merge into develop. Let me know when it is rebased onto latest develop and I'll do final approval.

@@ -46,6 +46,7 @@ Version |release|
- Fixed a bug in :ref:`spiceInterface` where required kernels were being unloaded before they were no longer needed.
- Fixed an issue where the :ref:`spaceToGroundTransmitter` would check for the amount of data remaining in a different partition than the one being downlinked.
- Fixed an issue where a high baud rate prevented the :ref:`spaceToGroundTransmitter` from downlinking data from the :ref:`simpleStorageUnit` or :ref:`partitionedStorageUnit`.
- Redirected MuJoCo errors and warnings to ``BSKLogger`` instead of printing to file.
Copy link
Contributor

Choose a reason for hiding this comment

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

make BSKLogger a hyperlink using

:ref:`bskLogging`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

MJScene simulations create MUJOCO_LOG.txt files
2 participants