forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds Ability to Clone a RigidBodyTree. (RobotLocomotion#4958)
* Adds ability to clone RigidBodyTree.
- Loading branch information
1 parent
5911b56
commit ecb94f8
Showing
15 changed files
with
719 additions
and
4 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#pragma once | ||
|
||
#include <iostream> | ||
#include <memory> | ||
|
||
#include <Eigen/Dense> | ||
|
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
58 changes: 58 additions & 0 deletions
58
drake/multibody/test/rigid_body_actuator_compare_to_clone.cc
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,58 @@ | ||
#include "drake/multibody/test/rigid_body_actuator_compare_to_clone.h" | ||
|
||
#include <memory> | ||
|
||
#include "drake/common/text_logging.h" | ||
#include "drake/multibody/rigid_body.h" | ||
|
||
namespace drake { | ||
namespace multibody { | ||
namespace test { | ||
namespace rigid_body_actuator { | ||
|
||
bool CompareToClone(const RigidBodyActuator& original, | ||
const RigidBodyActuator& clone) { | ||
if (original.name_ != clone.name_) { | ||
drake::log()->debug( | ||
"CompareToClone(RigidBodyActuator): Names mismatch:\n" | ||
" - original: {}\n" | ||
" - clone: {}", | ||
original.name_, clone.name_); | ||
return false; | ||
} | ||
if (!original.body_->CompareToClone(*clone.body_)) { | ||
drake::log()->debug( | ||
"CompareToClone(RigidBodyActuator): Bodies mismatch."); | ||
return false; | ||
} | ||
if (original.reduction_ != clone.reduction_) { | ||
drake::log()->debug( | ||
"CompareToClone(RigidBodyActuator): Reduction mismatch:\n" | ||
" - original: {}\n" | ||
" - clone: {}", | ||
original.reduction_, clone.reduction_); | ||
return false; | ||
} | ||
if (original.effort_limit_min_ != clone.effort_limit_min_) { | ||
drake::log()->debug( | ||
"CompareToClone(RigidBodyActuator): Minimum effort limits mismatch:\n" | ||
" - original: {}\n" | ||
" - clone: {}", | ||
original.effort_limit_min_, clone.effort_limit_min_); | ||
return false; | ||
} | ||
if (original.effort_limit_max_ != clone.effort_limit_max_) { | ||
drake::log()->debug( | ||
"CompareToClone(RigidBodyActuator): Maximum effort limits mismatch:\n" | ||
" - original: {}\n" | ||
" - clone: {}", | ||
original.effort_limit_max_, clone.effort_limit_max_); | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
} // namespace rigid_body_actuator | ||
} // namespace test | ||
} // namespace multibody | ||
} // namespace drake |
23 changes: 23 additions & 0 deletions
23
drake/multibody/test/rigid_body_actuator_compare_to_clone.h
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,23 @@ | ||
#pragma once | ||
|
||
#include "drake/multibody/rigid_body_actuator.h" | ||
|
||
namespace drake { | ||
namespace multibody { | ||
namespace test { | ||
namespace rigid_body_actuator { | ||
|
||
/** | ||
* This method compares the provided @p original and @p clone RigidBodyActuator | ||
* objects, which are clones, and verifies their correctness. Since this method | ||
* is intended to compare a clone, an *exact* match is performed. This method | ||
* will only return `true` if the provided %RigidBodyActuator is exactly the | ||
* same as its clone. | ||
*/ | ||
bool CompareToClone(const RigidBodyActuator& original, | ||
const RigidBodyActuator& clone); | ||
|
||
} // namespace rigid_body_actuator | ||
} // namespace test | ||
} // namespace multibody | ||
} // namespace drake |
Oops, something went wrong.