Skip to content

Commit ed4f0d5

Browse files
authored
Merge branch 'main' into direct_optimizer_python
2 parents f416293 + 0f1c648 commit ed4f0d5

30 files changed

+1666
-20
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ real-time predictive control with [MuJoCo](https://mujoco.org/), developed by
1616
Google DeepMind.
1717

1818
MJPC allows the user to easily author and solve complex robotics tasks, and
19-
currently supports three shooting-based planners: derivative-based iLQG and
20-
Gradient Descent, and a simple yet very competitive derivative-free method
21-
called Predictive Sampling.
19+
currently supports multiple shooting-based planners. Derivative-based methods include iLQG and
20+
Gradient Descent, while derivative-free methods include a simple yet very competitive planner
21+
called Predictive Sampling and the Cross Entropy Method (with diagonal covariance).
2222

2323
- [Overview](#overview)
2424
- [Graphical User Interface](#graphical-user-interface)

cmake/MujocoLinkOptions.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function(get_mujoco_extra_link_options OUTPUT_VAR)
2323
set(EXTRA_LINK_OPTIONS)
2424

2525
if(WIN32)
26-
set(CMAKE_REQUIRED_FLAGS "-fuse-ld=lld-link")
26+
set(CMAKE_REQUIRED_LINK_OPTIONS "-fuse-ld=lld-link")
2727
check_c_source_compiles("int main() {}" SUPPORTS_LLD)
2828
if(SUPPORTS_LLD)
2929
set(EXTRA_LINK_OPTIONS
@@ -34,24 +34,24 @@ function(get_mujoco_extra_link_options OUTPUT_VAR)
3434
)
3535
endif()
3636
else()
37-
set(CMAKE_REQUIRED_FLAGS "-fuse-ld=lld")
37+
set(CMAKE_REQUIRED_LINK_OPTIONS "-fuse-ld=lld")
3838
check_c_source_compiles("int main() {}" SUPPORTS_LLD)
3939
if(SUPPORTS_LLD)
4040
set(EXTRA_LINK_OPTIONS ${EXTRA_LINK_OPTIONS} -fuse-ld=lld)
4141
else()
42-
set(CMAKE_REQUIRED_FLAGS "-fuse-ld=gold")
42+
set(CMAKE_REQUIRED_LINK_OPTIONS "-fuse-ld=gold")
4343
check_c_source_compiles("int main() {}" SUPPORTS_GOLD)
4444
if(SUPPORTS_GOLD)
4545
set(EXTRA_LINK_OPTIONS ${EXTRA_LINK_OPTIONS} -fuse-ld=gold)
4646
endif()
4747
endif()
4848

49-
set(CMAKE_REQUIRED_FLAGS ${EXTRA_LINK_OPTIONS} "-Wl,--gc-sections")
49+
set(CMAKE_REQUIRED_LINK_OPTIONS ${EXTRA_LINK_OPTIONS} "-Wl,--gc-sections")
5050
check_c_source_compiles("int main() {}" SUPPORTS_GC_SECTIONS)
5151
if(SUPPORTS_GC_SECTIONS)
5252
set(EXTRA_LINK_OPTIONS ${EXTRA_LINK_OPTIONS} -Wl,--gc-sections)
5353
else()
54-
set(CMAKE_REQUIRED_FLAGS ${EXTRA_LINK_OPTIONS} "-Wl,-dead_strip")
54+
set(CMAKE_REQUIRED_LINK_OPTIONS ${EXTRA_LINK_OPTIONS} "-Wl,-dead_strip")
5555
check_c_source_compiles("int main() {}" SUPPORTS_DEAD_STRIP)
5656
if(SUPPORTS_DEAD_STRIP)
5757
set(EXTRA_LINK_OPTIONS ${EXTRA_LINK_OPTIONS} -Wl,-dead_strip)

docs/OVERVIEW.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Values in brackets should be replaced by the designer.
132132

133133
`Agent` settings can be specified by prepending `agent_` for corresponding class members.
134134

135-
`Planner` settings can similarly be specified by prepending the corresponding optimizer name, (e.g., `sampling_`, `gradient_`, `ilqg_`).
135+
`Planner` settings can similarly be specified by prepending the corresponding optimizer name, (e.g., `sampling_`, `cross_entropy_`, `gradient_`, `ilqg_`).
136136

137137
It is also possible to create GUI elements for parameters that are passed to the residual function. These are specified by the prefix `residual_`, when the suffix will be the display name of the slider:
138138

@@ -280,12 +280,15 @@ Additionally, custom labeled buttons can be added to the GUI by specifying a str
280280

281281
The purpose of `Planner` is to find improved policies using numerical optimization.
282282

283-
This library includes three planners that use different techniques to perform this search:
283+
This library includes multiple planners that use different techniques to perform this search:
284284

285285
- **Predictive Sampling**
286286
- random search
287287
- derivative free
288288
- spline representation for controls
289+
- **Cross Entropy Method**
290+
- all properties of Predictive Sampling
291+
- refits a nominal policy to mean of elite samples instead of using the best
289292
- **Gradient Descent**
290293
- requires gradients
291294
- spline representation for controls

mjpc/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ add_library(
4040
tasks/acrobot/acrobot.h
4141
tasks/cartpole/cartpole.cc
4242
tasks/cartpole/cartpole.h
43+
tasks/cube/solve.cc
44+
tasks/cube/solve.h
4345
tasks/fingers/fingers.cc
4446
tasks/fingers/fingers.h
4547
tasks/hand/hand.cc
@@ -54,6 +56,8 @@ add_library(
5456
tasks/manipulation/common.h
5557
tasks/manipulation/manipulation.cc
5658
tasks/manipulation/manipulation.h
59+
tasks/op3/stand.cc
60+
tasks/op3/stand.h
5761
tasks/panda/panda.cc
5862
tasks/panda/panda.h
5963
tasks/particle/particle.cc
@@ -75,6 +79,8 @@ add_library(
7579
planners/cost_derivatives.h
7680
planners/model_derivatives.cc
7781
planners/model_derivatives.h
82+
planners/cross_entropy/planner.cc
83+
planners/cross_entropy/planner.h
7884
planners/robust/robust_planner.cc
7985
planners/robust/robust_planner.h
8086
planners/sampling/planner.cc

mjpc/grpc/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ findorfetch(
3737

3838
find_package(ZLIB REQUIRED)
3939
set(gRPC_ZLIB_PROVIDER "package" CACHE INTERNAL "")
40-
40+
set(ZLIB_BUILD_EXAMPLES OFF)
4141
set(_PROTOBUF_LIBPROTOBUF libprotobuf)
4242
set(_REFLECTION grpc++_reflection)
4343
set(_PROTOBUF_PROTOC $<TARGET_FILE:protoc>)

mjpc/main.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ int main(int argc, char** argv) {
4747
#endif
4848
absl::ParseCommandLine(argc, argv);
4949

50-
mjpc::StartApp(mjpc::GetTasks(), 6); // start with manipulation bring
50+
mjpc::StartApp(mjpc::GetTasks(), 14); // start with quadruped flat
5151
return 0;
5252
}

0 commit comments

Comments
 (0)