Skip to content

Commit 3ce5307

Browse files
authored
Merge branch 'main' into ce
2 parents 52400d8 + 1d8f72e commit 3ce5307

File tree

27 files changed

+1036
-28
lines changed

27 files changed

+1036
-28
lines changed

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)

mjpc/CMakeLists.txt

Lines changed: 4 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

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
}

mjpc/planners/cross_entropy/planner.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ class CrossEntropyPlanner : public Planner {
8484
void Plots(mjvFigure* fig_planner, mjvFigure* fig_timer, int planner_shift,
8585
int timer_shift, int planning, int* shift) override;
8686

87+
// return number of parameters optimized by planner
88+
int NumParameters() override {
89+
return policy.num_spline_points * policy.model->nu;
90+
};
91+
8792
// ----- members ----- //
8893
mjModel* model;
8994
const Task* task;

mjpc/planners/gradient/planner.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ class GradientPlanner : public Planner {
8888
void Plots(mjvFigure* fig_planner, mjvFigure* fig_timer, int planner_shift,
8989
int timer_shift, int planning, int* shift) override;
9090

91+
// return number of parameters optimized by planner
92+
int NumParameters() override {
93+
return policy.num_spline_points * policy.model->nu;
94+
};
95+
9196
// ----- members ----- //
9297
mjModel* model;
9398
const Task* task;

mjpc/planners/ilqg/planner.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ void iLQGPlanner::NominalTrajectory(int horizon, ThreadPool& pool) {
165165
if (num_trajectory_ == 0) {
166166
return;
167167
}
168+
// set policy trajectory horizon
169+
policy.trajectory.horizon = horizon;
170+
168171
// resize data for rollouts
169172
ResizeMjData(model, pool.NumThreads());
170173

mjpc/planners/ilqg/planner.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ class iLQGPlanner : public Planner {
7171
void Plots(mjvFigure* fig_planner, mjvFigure* fig_timer, int planner_shift,
7272
int timer_shift, int planning, int* shift) override;
7373

74+
// return number of parameters optimized by planner
75+
int NumParameters() override {
76+
return policy.trajectory.dim_action * (policy.trajectory.horizon - 1);
77+
};
78+
7479
// single iLQG iteration
7580
void Iteration(int horizon, ThreadPool& pool);
7681

@@ -85,8 +90,6 @@ class iLQGPlanner : public Planner {
8590

8691
void UpdateNumTrajectoriesFromGUI();
8792

88-
//
89-
9093
// ----- members ----- //
9194
mjModel* model;
9295
const Task* task;

mjpc/planners/ilqs/planner.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ class iLQSPlanner : public Planner {
8181
void Plots(mjvFigure* fig_planner, mjvFigure* fig_timer, int planner_shift,
8282
int timer_shift, int planning, int* shift) override;
8383

84+
// return number of parameters optimized by planner
85+
int NumParameters() override {
86+
return sampling.NumParameters() + ilqg.NumParameters();
87+
};
88+
8489
// ----- planners ----- //
8590
SamplingPlanner sampling;
8691
iLQGPlanner ilqg;

mjpc/planners/planner.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ class Planner {
7171
int planner_shift, int timer_shift, int planning,
7272
int* shift) = 0;
7373

74+
// return number of parameters optimized by planner
75+
virtual int NumParameters() = 0;
76+
7477
std::vector<UniqueMjData> data_;
7578
void ResizeMjData(const mjModel* model, int num_threads);
7679
};

0 commit comments

Comments
 (0)