Skip to content

Commit

Permalink
[gym/core] Fix corrupted robot proxy if model changes. (#746)
Browse files Browse the repository at this point in the history
* [gym/core] Fix corrupted robot proxy if model changes.
* [misc] Fix compilation on Windows ARM64.
  • Loading branch information
duburcqa committed Mar 22, 2024
1 parent a51cc10 commit 083e6f5
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 70 deletions.
2 changes: 1 addition & 1 deletion build_tools/build_install_deps_unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if [ "$(uname -s)" = "Darwin" ]; then

### Set the build architecture if undefined
if [ -z ${OSX_ARCHITECTURES} ]; then
OSX_ARCHITECTURES="arm64"
OSX_ARCHITECTURES="x86_64;arm64"
echo "OSX_ARCHITECTURES is unset. Defaulting to '${OSX_ARCHITECTURES}'."
fi
fi
Expand Down
149 changes: 90 additions & 59 deletions build_tools/build_install_deps_windows.ps1

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build_tools/patch_deps_windows/eigenpy.patch
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -206,7 +206,7 @@
src/optional.cpp
src/version.cpp)

-add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SOURCES}
+add_library(${PROJECT_NAME} ${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_HEADERS})
Expand All @@ -27,7 +27,7 @@ diff --git a/cmake/boost.cmake b/cmake/boost.cmake
+ endif()
+ set(Boost_USE_STATIC_LIBS ON)
string(TOUPPER ${BOOST_PYTHON_NAME} UPPERCOMPONENT)

list(APPEND LOGGING_WATCHED_VARIABLES Boost_${UPPERCOMPONENT}_FOUND
@@ -192,7 +200,6 @@
string(REPLACE "_" "." Boost_SHORT_VERSION ${Boost_LIB_VERSION})
Expand Down
8 changes: 4 additions & 4 deletions build_tools/patch_deps_windows/hppfcl.patch
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
+ ADD_PROJECT_DEPENDENCY(Boost REQUIRED system)
- find_package(Boost REQUIRED COMPONENTS system)
endif(BUILD_PYTHON_INTERFACE)

if(Boost_VERSION_STRING VERSION_LESS 1.81)
# Default C++ version should be C++11
CHECK_MINIMAL_CXX_STANDARD(11 ENFORCE)
Expand Down Expand Up @@ -51,7 +51,7 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -283,7 +274,6 @@
include/hpp/fcl/timings.h
)

-add_subdirectory(doc)
add_subdirectory(src)
if (BUILD_PYTHON_INTERFACE)
Expand All @@ -70,7 +70,7 @@ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
@@ -179,6 +178,7 @@
ADD_SOURCE_GROUP(${LIBRARY_NAME}_SOURCES)
ADD_HEADER_GROUP(PROJECT_HEADERS_FULL_PATH)

+ADD_PROJECT_DEPENDENCY(assimp REQUIRED)
MODERNIZE_TARGET_LINK_LIBRARIES(${LIBRARY_NAME} SCOPE PRIVATE
TARGETS assimp::assimp
Expand Down Expand Up @@ -101,7 +101,7 @@ diff --git a/cmake/boost.cmake b/cmake/boost.cmake
+ endif()
+ set(Boost_USE_STATIC_LIBS ON)
string(TOUPPER ${BOOST_PYTHON_NAME} UPPERCOMPONENT)

list(APPEND LOGGING_WATCHED_VARIABLES Boost_${UPPERCOMPONENT}_FOUND
@@ -192,7 +200,6 @@
string(REPLACE "_" "." Boost_SHORT_VERSION ${Boost_LIB_VERSION})
Expand Down
6 changes: 3 additions & 3 deletions build_tools/patch_deps_windows/pinocchio.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
SET_BOOST_DEFAULT_OPTIONS()
EXPORT_BOOST_DEFAULT_OPTIONS()
-ADD_PROJECT_DEPENDENCY(Boost REQUIRED COMPONENTS ${BOOST_REQUIRED_COMPONENTS})

IF(Boost_VERSION_STRING VERSION_LESS 1.81)
IF(BUILD_WITH_URDF_SUPPORT AND ${urdfdom_VERSION} VERSION_GREATER "0.4.2")
@@ -163,6 +162,9 @@
Expand Down Expand Up @@ -49,7 +49,7 @@ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -17,7 +17,7 @@
${PROJECT_NAME}_CORE_PUBLIC_HEADERS)

# Create target libpinocchio.so
-ADD_LIBRARY(${PROJECT_NAME} SHARED
+ADD_LIBRARY(${PROJECT_NAME}
Expand All @@ -73,7 +73,7 @@ diff --git a/cmake/boost.cmake b/cmake/boost.cmake
+ endif()
+ set(Boost_USE_STATIC_LIBS ON)
string(TOUPPER ${BOOST_PYTHON_NAME} UPPERCOMPONENT)

list(APPEND LOGGING_WATCHED_VARIABLES Boost_${UPPERCOMPONENT}_FOUND
@@ -192,7 +200,6 @@
string(REPLACE "_" "." Boost_SHORT_VERSION ${Boost_LIB_VERSION})
Expand Down
1 change: 1 addition & 0 deletions python/gym_jiminy/common/gym_jiminy/common/envs/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ def reset(self, # type: ignore[override]

# Re-initialize some shared memories.
# It is necessary because the robot may have changed.
self.robot = self.simulator.robot
self.robot_state = self.simulator.robot_state
self.sensor_measurements = OrderedDict(self.robot.sensor_measurements)

Expand Down
3 changes: 2 additions & 1 deletion python/jiminy_py/src/jiminy_py/viewer/replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,8 @@ def play_trajectories(
# of the whole recording process (~75% on discrete gpu).
buffer = Viewer.capture_frame(
*record_video_size, raw_data=True)
memoryview(frame.planes[0])[:] = buffer
memoryview(
frame.planes[0])[:] = buffer # type: ignore[arg-type]

# Write frame
for packet in stream.encode(frame):
Expand Down

0 comments on commit 083e6f5

Please sign in to comment.