-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PiperOrigin-RevId: 690624747 Change-Id: Ibd4199b2b861e6a52acaa6aad861af72337745c4
- Loading branch information
Showing
17 changed files
with
985 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// 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. | ||
|
||
#include "mjpc/tasks/humanoid/interact/contact_keyframe.h" | ||
|
||
namespace mjpc::humanoid { | ||
|
||
void ContactPair::Reset() { | ||
body1 = kNotSelectedInteract; | ||
body2 = kNotSelectedInteract; | ||
geom1 = kNotSelectedInteract; | ||
geom2 = kNotSelectedInteract; | ||
for (int i = 0; i < 3; i++) { | ||
local_pos1[i] = 0.; | ||
local_pos2[i] = 0.; | ||
} | ||
} | ||
|
||
void ContactKeyframe::Reset() { | ||
name.clear(); | ||
for (auto& contact_pair : contact_pairs) contact_pair.Reset(); | ||
|
||
facing_target.clear(); | ||
weight.clear(); | ||
} | ||
} // namespace mjpc::humanoid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// 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. | ||
|
||
#ifndef MJPC_TASKS_HUMANOID_INTERACT_CONTACT_KEYFRAME_H_ | ||
#define MJPC_TASKS_HUMANOID_INTERACT_CONTACT_KEYFRAME_H_ | ||
|
||
#include <map> | ||
#include <string> | ||
#include <vector> | ||
|
||
#include <mujoco/mujoco.h> | ||
|
||
namespace mjpc::humanoid { | ||
|
||
// ---------- Constants ----------------- // | ||
constexpr int kNotSelectedInteract = -1; | ||
constexpr int kNumberOfContactPairsInteract = 5; | ||
|
||
class ContactPair { | ||
public: | ||
int body1, body2, geom1, geom2; | ||
mjtNum local_pos1[3], local_pos2[3]; | ||
|
||
ContactPair() | ||
: body1(kNotSelectedInteract), | ||
body2(kNotSelectedInteract), | ||
geom1(kNotSelectedInteract), | ||
geom2(kNotSelectedInteract), | ||
local_pos1{0.}, | ||
local_pos2{0.} {} | ||
|
||
void Reset(); | ||
}; | ||
|
||
class ContactKeyframe { | ||
public: | ||
std::string name; | ||
ContactPair contact_pairs[kNumberOfContactPairsInteract]; | ||
|
||
// the direction on the xy-plane for the torso to point towards | ||
std::vector<mjtNum> facing_target; | ||
|
||
// weight of all residual terms (name -> value map) | ||
std::map<std::string, mjtNum> weight; | ||
|
||
ContactKeyframe() : name(""), contact_pairs{}, facing_target(), weight() {} | ||
|
||
void Reset(); | ||
}; | ||
|
||
} // namespace mjpc::humanoid | ||
|
||
#endif // MJPC_TASKS_HUMANOID_INTERACT_CONTACT_KEYFRAME_H_ |
Oops, something went wrong.