Skip to content

Commit

Permalink
Merge branch 'main' into estimator_update
Browse files Browse the repository at this point in the history
  • Loading branch information
erez-tom authored Mar 3, 2024
2 parents 6c90606 + c1b15e5 commit 15221bd
Show file tree
Hide file tree
Showing 9 changed files with 485 additions and 76 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ set(MUJOCO_MPC_MUJOCO_GIT_TAG
)

set(MUJOCO_MPC_MENAGERIE_GIT_TAG
8ef01e87fffaa8ec634a4826c5b2092733b2f3c8
8a5f659ac3607dc5adb988e0187f683fe0f4edf4
CACHE STRING "Git revision for MuJoCo Menagerie."
)

Expand Down
24 changes: 24 additions & 0 deletions mjpc/tasks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,30 @@ add_custom_target(
${CMAKE_CURRENT_BINARY_DIR}/bimanual/aloha.xml
<${CMAKE_CURRENT_SOURCE_DIR}/bimanual/aloha.patch

# MJX ALOHA
COMMAND ${CMAKE_COMMAND} -E copy
${menagerie_SOURCE_DIR}/aloha/mjx_aloha.patch
${CMAKE_CURRENT_BINARY_DIR}/bimanual/mjx_aloha.patch
COMMAND patch -o ${CMAKE_CURRENT_BINARY_DIR}/bimanual/mjx_aloha.xml
${CMAKE_CURRENT_BINARY_DIR}/bimanual/aloha.xml
<${CMAKE_CURRENT_BINARY_DIR}/bimanual/mjx_aloha.patch
COMMAND ${CMAKE_COMMAND} -E copy
${menagerie_SOURCE_DIR}/aloha/scene.xml
${CMAKE_CURRENT_BINARY_DIR}/bimanual/scene.xml
COMMAND ${CMAKE_COMMAND} -E copy
${menagerie_SOURCE_DIR}/aloha/mjx_scene.patch
${CMAKE_CURRENT_BINARY_DIR}/bimanual/mjx_scene.patch
COMMAND patch -o ${CMAKE_CURRENT_BINARY_DIR}/bimanual/mjx_scene.xml
${CMAKE_CURRENT_BINARY_DIR}/bimanual/scene.xml
<${CMAKE_CURRENT_BINARY_DIR}/bimanual/mjx_scene.patch

COMMAND ${CMAKE_COMMAND} -E copy
${menagerie_SOURCE_DIR}/aloha/mjx_integrated_cartesian_actuators.patch
${CMAKE_CURRENT_BINARY_DIR}/bimanual/mjx_integrated_cartesian_actuators.patch
COMMAND patch -o ${CMAKE_CURRENT_BINARY_DIR}/bimanual/mjx_integrated_cartesian_actuators.xml
${CMAKE_CURRENT_BINARY_DIR}/bimanual/integrated_cartesian_actuators.xml
<${CMAKE_CURRENT_BINARY_DIR}/bimanual/mjx_integrated_cartesian_actuators.patch

COMMAND ${CMAKE_COMMAND} -E copy
${menagerie_SOURCE_DIR}/robotis_op3/op3.xml
${CMAKE_CURRENT_BINARY_DIR}/op3/op3.xml
Expand Down
7 changes: 3 additions & 4 deletions python/mujoco_mpc/demos/agent/cartpole.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import mediapy as media
import mujoco
import numpy as np
import os
import pathlib

# set current directory: mujoco_mpc/python/mujoco_mpc
Expand All @@ -27,9 +26,9 @@
# %%
# model
model_path = (
pathlib.Path(os.path.abspath("")).parent.parent.parent
/ "mujoco_mpc/mjpc/tasks/cartpole/task.xml"
)
pathlib.Path(__file__).parent.parent.parent
/ "../../build/mjpc/tasks/cartpole/task.xml"
)
model = mujoco.MjModel.from_xml_path(str(model_path))

# data
Expand Down
35 changes: 35 additions & 0 deletions python/mujoco_mpc/demos/agent/cartpole_gui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright 2022 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import pathlib
import mujoco
from mujoco_mpc import agent as agent_lib

# Cartpole model
model_path = (
pathlib.Path(__file__).parent.parent.parent
/ "../../build/mjpc/tasks/cartpole/task.xml"
)
model = mujoco.MjModel.from_xml_path(str(model_path))

# Run GUI
with agent_lib.Agent(
server_binary_path=pathlib.Path(agent_lib.__file__).parent
/ "mjpc"
/ "ui_agent_server",
task_id="Cartpole",
model=model,
) as agent:
while True:
None
Loading

0 comments on commit 15221bd

Please sign in to comment.