Skip to content

Conversation

@hello-robot-shehab
Copy link
Contributor

@hello-robot-shehab hello-robot-shehab commented Jun 24, 2025

Added the ability to specify the start translation and rotation.

To test, run this start_pose.py example script (https://github.com/hello-robot/stretch_mujoco/pull/98/changes#diff-c99c383503c8304ed2a4a454ff0f836b58ef84a2f05401ddd43bf6ffc7f6c5ae):

from stretch_mujoco.stretch_mujoco_simulator import StretchMujocoSimulator
from scipy.spatial.transform import Rotation as R

if __name__ == "__main__":

    translation_m = [0.1, -0.2, 0]

    # Convert euler angles to quaternion
    euler_angles_degrees = [0, 0, -90] # Example: roll, pitch, yaw (x, y, z)
    rotation_obj = R.from_euler('xyz', euler_angles_degrees, degrees=True)
    rotation_quat = rotation_obj.as_quat(scalar_first=True)


    sim = StretchMujocoSimulator(
        start_translation=translation_m,
        start_rotation_quat=rotation_quat
    )

    sim.start(headless=False)

    while sim.is_running(): ...

@hello-binit
Copy link
Contributor

Hey @hello-robot-shehab, I'm seeing this error when running uv run examples/test_one_process.py. Are you seeing this too?

Traceback (most recent call last):
  File "/home/binitshah/repos/new_work_on_mujoco/stretch_mujoco/examples/test_one_process.py", line 16, in <module>
    MujocoServer.launch_server(
  File "/home/binitshah/repos/new_work_on_mujoco/stretch_mujoco/stretch_mujoco/mujoco_server.py", line 198, in launch_server
    server = cls(scene_xml_path, model, stop_mujoco_process_event, data_proxies,start_translation , start_rotation_quat)
  File "/home/binitshah/repos/new_work_on_mujoco/stretch_mujoco/stretch_mujoco/mujoco_server.py", line 233, in __init__
    model = self.change_start_pose(translation = start_translation,  rotation_quat=start_rotation_quat, xml_path=scene_xml_path)
  File "/home/binitshah/repos/new_work_on_mujoco/stretch_mujoco/stretch_mujoco/mujoco_server.py", line 211, in change_start_pose
    return MjModel.from_xml_string(spec.to_xml())
ValueError: Error: Error opening file 'assets/base_link_0.obj': No such file or directory

@hello-robot-shehab
Copy link
Contributor Author

Hey @hello-robot-shehab, I'm seeing this error when running uv run examples/test_one_process.py. Are you seeing this too?

Traceback (most recent call last):
  File "/home/binitshah/repos/new_work_on_mujoco/stretch_mujoco/examples/test_one_process.py", line 16, in <module>
    MujocoServer.launch_server(
  File "/home/binitshah/repos/new_work_on_mujoco/stretch_mujoco/stretch_mujoco/mujoco_server.py", line 198, in launch_server
    server = cls(scene_xml_path, model, stop_mujoco_process_event, data_proxies,start_translation , start_rotation_quat)
  File "/home/binitshah/repos/new_work_on_mujoco/stretch_mujoco/stretch_mujoco/mujoco_server.py", line 233, in __init__
    model = self.change_start_pose(translation = start_translation,  rotation_quat=start_rotation_quat, xml_path=scene_xml_path)
  File "/home/binitshah/repos/new_work_on_mujoco/stretch_mujoco/stretch_mujoco/mujoco_server.py", line 211, in change_start_pose
    return MjModel.from_xml_string(spec.to_xml())
ValueError: Error: Error opening file 'assets/base_link_0.obj': No such file or directory

Yes, pushing a fix now, thanks!

@hello-robot-shehab
Copy link
Contributor Author

Fixed! Thanks for catching that @hello-binit! I also fixed the quaternion real-part [1,0,0,0] that we talked about before. Thanks!

@hello-robot-shehab hello-robot-shehab marked this pull request as ready for review January 5, 2026 19:28
@hello-robot-shehab hello-robot-shehab merged commit 86e5ac8 into main Jan 5, 2026
1 check passed
@hello-robot-shehab hello-robot-shehab deleted the feature/start-pose branch January 5, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants