Skip to content

Conversation

@oleflb
Copy link
Contributor

@oleflb oleflb commented Oct 31, 2025

Why? What?

This PR implements a simulator for the K1 robot in MuJoCo.
The main simulation loop is implemented in python, but the new mujoco-rust-server library controls how the simulation advances and can be connected to via Websockets.
Upon connection, a client has to send a ConnectionInfo, which specifies a schedule for events.
For example, the hulk_mujoco binary sends a ConnectionInfo which resets the simulation, and specifies the update rate of LowState and LowCommand to be of 10ms in the same phase.
The three-js webrenderer shows another application of this, where on connect, a description of the scene is sent and on every change in simulation, updated positions and rotations of all bodies are sent.

The simulation is not feature complete. While the architecture of the simulator is explicitly designed to handle connections from multiple frameworks, this is not yet implemented.
Also, the simulation scene is relatively boring and does not yet contain a field or a ball.

Fixes #2108

ToDo / Known Issues

  • The update rate of the simulation is independent of when a connection wants to have a LowState. For instance, if simulation time is t=5, step size is 2, and the controller asks for a LowState at t=6, the simulation step will not be shortened, leading to a delayed LowState at t=7.

Ideas for Next Iterations (Not This PR)

  • Multi-Robot
  • Play/Pause/Time Factor

How to Test

  • Frontend: go to frontend and run npm i && npm run dev
  • Simulator: go to mujoco-simulator and run uv run main.py
  • Framework controller: run pepsi run hulk_mujoco

@github-project-automation github-project-automation bot moved this to Request for Review in Development Oct 31, 2025
@alexschmander alexschmander added Booster tools:Simulator Bevyhavior Simulator, etc labels Nov 5, 2025
@oleflb oleflb marked this pull request as ready for review November 5, 2025 15:25
@oleflb oleflb enabled auto-merge November 5, 2025 15:26
@oleflb oleflb force-pushed the mujoco-simulator-python branch 2 times, most recently from 39a55c5 to 1a77f97 Compare November 5, 2025 15:37
Copy link
Contributor

@alexschmander alexschmander left a comment

Choose a reason for hiding this comment

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

Initially a few comments, not completed yet...

@oleflb oleflb force-pushed the mujoco-simulator-python branch from 7b57921 to 464d6b4 Compare November 6, 2025 09:36
@oleflb oleflb force-pushed the mujoco-simulator-python branch from 464d6b4 to 793bda2 Compare November 6, 2025 10:01
Copy link
Contributor

@alexschmander alexschmander left a comment

Choose a reason for hiding this comment

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

Just one more comment, otherwise looks good!

Copy link
Contributor

@alexschmander alexschmander left a comment

Choose a reason for hiding this comment

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

LGTM

@oleflb oleflb added this pull request to the merge queue Nov 6, 2025
Merged via the queue into HULKs:main with commit 4ecaaaf Nov 6, 2025
24 checks passed
@oleflb oleflb deleted the mujoco-simulator-python branch November 6, 2025 12:07
@github-project-automation github-project-automation bot moved this from Request for Review to Done in Development Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Mujoco Simulator

2 participants