-
Notifications
You must be signed in to change notification settings - Fork 0
mujoco sim bridge #989
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
base: dev
Are you sure you want to change the base?
mujoco sim bridge #989
Conversation
Greptile SummaryImplements MuJoCo simulation bridge for xArm7 manipulator, enabling unified driver code to work with both hardware and simulation. The implementation follows a clean architecture with a base bridge class and xArm-specific extensions that mimic the UFACTORY SDK interface. Key changes:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant XArmSimDriver
participant XArmSimSDKWrapper
participant XArmSimBridge
participant MujocoSimBridgeBase
participant MuJoCo
participant Viewer
User->>XArmSimDriver: Initialize with config
XArmSimDriver->>XArmSimSDKWrapper: Create SDK wrapper
XArmSimDriver->>XArmSimDriver: Setup components
User->>XArmSimSDKWrapper: connect(config)
XArmSimSDKWrapper->>XArmSimBridge: Create bridge instance
XArmSimBridge->>MujocoSimBridgeBase: __init__()
MujocoSimBridgeBase->>MuJoCo: Load robot description
MujocoSimBridgeBase-->>XArmSimBridge: Model & Data ready
XArmSimSDKWrapper->>XArmSimBridge: connect()
XArmSimBridge->>MujocoSimBridgeBase: connect()
MujocoSimBridgeBase->>MujocoSimBridgeBase: Start sim_thread
XArmSimBridge->>XArmSimBridge: Start report_thread
par Simulation Loop (sim_thread)
loop Control Frequency (100 Hz)
MujocoSimBridgeBase->>Viewer: launch_passive()
MujocoSimBridgeBase->>XArmSimBridge: _apply_control()
XArmSimBridge->>MuJoCo: Update ctrl[] with targets
MujocoSimBridgeBase->>MuJoCo: mj_step()
MuJoCo-->>MujocoSimBridgeBase: Updated state
MujocoSimBridgeBase->>Viewer: sync()
MujocoSimBridgeBase->>XArmSimBridge: _update_joint_state()
XArmSimBridge->>XArmSimBridge: Update positions/velocities/efforts
end
and Report Loop (report_thread)
loop Report Frequency (100 Hz)
XArmSimBridge->>XArmSimBridge: _notify_report()
XArmSimBridge->>User: report_callback(state data)
end
end
User->>XArmSimSDKWrapper: set_joint_positions(positions)
XArmSimSDKWrapper->>XArmSimBridge: set_servo_angle_j()
XArmSimBridge->>XArmSimBridge: Update _joint_position_targets
Note over XArmSimBridge,MuJoCo: Targets applied in next control loop
User->>XArmSimSDKWrapper: get_joint_positions()
XArmSimSDKWrapper->>XArmSimBridge: get_servo_angle()
XArmSimBridge-->>XArmSimSDKWrapper: Current joint angles
XArmSimSDKWrapper-->>User: Joint positions
User->>XArmSimSDKWrapper: disconnect()
XArmSimSDKWrapper->>XArmSimBridge: disconnect()
XArmSimBridge->>XArmSimBridge: Stop report_thread
XArmSimBridge->>MujocoSimBridgeBase: disconnect()
MujocoSimBridgeBase->>MujocoSimBridgeBase: Stop sim_thread
MujocoSimBridgeBase->>Viewer: Close viewer
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
54 files reviewed, 1 comment
|
@jca0 thanks for attempting agents_deprecated rip out but thats out of scope here and needs to be done carefully since we are using some code in there still. revert those deletions |
|
oops must've deleted on accident, it's added back now |
sim bridge to simulate xarm7 in mujoco
created xarm7 sim driver, general sim bridge, xarm specific sim bridge
command to test:
python3 -m dimos.simulation.sim_blueprintstodos: add sim support for piper arm, mujoco viewer doesn't work on mac