-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issues discovered during demo. #442
Conversation
… also use ScopedState internally.
…urn bodyNode direction if passed direction was zero vector.
…at problems can store a cloned, scoped version of the passed state.
…for moving straight).
I fixed the nits, but I'm trying to fix a build issue with Clan/OSX on Travis. |
Hmm, it looks like a potentially weird dependency issue with dart/nlopt/libccd? Here's the error message (which is repeated several times):
|
Yeah, after some googling a CMake file in DART may be the issue? Did we change which version of DART gets used in the OSX test environment? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The macOS failure seems not related to the changes of this PR.
Could you please check if the master branch also fails to build on macOS? If so, let's create an issue to track it and merge this PR as it is.
I believe the macOS build failure is due to that the bottles of |
@@ -44,6 +49,9 @@ class Planner | |||
protected: | |||
/// State space associated with this planner. | |||
statespace::ConstStateSpacePtr mStateSpace; | |||
|
|||
/// RNG the planner uses. | |||
std::unique_ptr<common::RNG> mRng; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're taking in a raw RNG
pointer, do we need to store this as a unique_ptr
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could store is as either, since this is hidden from the user. I picked a unique pointer for convenience, since I create a default RNG if one isn't given, and unique pointers handle memory management once the Planner
object is destructed (if my understadning of C++ is correct, which it might not be 😅). Otherwise I think we'd need a custom destructor, since we'd malloc
a new RNG.
: Problem(stateSpace, std::move(constraint)) | ||
, mMetaSkeletonStateSpace(stateSpace) | ||
, mMetaSkeleton(std::move(metaSkeleton)) | ||
, mStartState(std::move(mMetaSkeletonStateSpace->createState())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jslee02 Are these explicit std::move
s for mStartState
and mGoalState
necessary? Based on my limited understanding of rvalues, those expressions might already be rvalues and therefore std::move
is unnecessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree with this. @jslee02 can you confirm?
// instance variable to avoid dangling pointers. | ||
if (mMetaSkeleton) | ||
{ | ||
auto startState = mMetaSkeletonStateSpace->createState(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this just be
if (mMetaSkeleton)
mMetaSkeletonStateSpace->getState(mMetaSkeleton.get(), mStartState);
It seems that mStartState
is already a MetaSkeletonStateSpace::ScopedState
, so I'm not sure why mStateSpace
needs to be used here.
namespace dart { | ||
|
||
class ConfigurationToConfiguration_to_ConfigurationToConfiguration | ||
: public PlannerAdapter<aikido::planner:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I think aikido::
is unnecessary here?
@@ -57,30 +63,27 @@ ConfigurationToConfiguration_to_ConfigurationToTSR::plan( | |||
auto ik = InverseKinematics::create(endEffectorBodyNode); | |||
ik->setDofs(mMetaSkeleton->getDofs()); | |||
|
|||
// Convert TSR constraint into IK constraint | |||
// Get the start state form the MetaSkeleton, since this is a DART planner. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: form
-> from
@@ -16,27 +17,85 @@ namespace dart { | |||
class ConfigurationToEndEffectorOffset : public Problem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should augment this documentation here with the types of constructors that are supported.
// instance variable to avoid dangling pointers. | ||
if (mMetaSkeleton) | ||
{ | ||
auto startState = mMetaSkeletonStateSpace->createState(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above?
// limits, as well as the passed constraint. | ||
/// \param[in] metaSkeleton The MetaSkeleton whose limits must be respected. | ||
std::shared_ptr<aikido::planner::TrajectoryPostProcessor> | ||
getTrajectoryPostProcessor( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with this for now, but in light of the discussion from #443 it seems that maybe it doesn't make sense to have this here? I think we should probably set up the postprocessor in the concrete robot constructor, similar to how we set up the metaplanner.
statespace::dart::ConstMetaSkeletonStateSpacePtr stateSpace, | ||
::dart::dynamics::ConstMetaSkeletonPtr metaSkeleton, | ||
const statespace::dart::MetaSkeletonStateSpace::State* goalState, | ||
constraint::ConstTestablePtr constraint); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we allow nullptr
for constraint and make it default to Satisfied
if nullptr
is passed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the default Problem
class handles this:
aikido/src/planner/Problem.cpp
Line 17 in fe09cbb
if (!mConstraint) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sniyaz That's true. I think all we need to do here is just to pass nullptr
as the default value to constraint
.
ConfigurationToConfigurationPlanner> | ||
{ | ||
public: | ||
ConfigurationToConfiguration_to_ConfigurationToConfiguration( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add docstring to this. :)
@@ -10,12 +10,14 @@ namespace planner { | |||
namespace dart { | |||
|
|||
class ConfigurationToConfiguration_to_ConfigurationToTSR | |||
: public PlannerAdapter<ConfigurationToConfigurationPlanner, | |||
: public PlannerAdapter<aikido::planner:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: same as @brianhou 's comment above, aikido::planner
wouldn't be necessary here.
/// | ||
/// \param[in] stateSpace State space. | ||
/// param[in] metaSkeleton MetaSkeleton that getStartState will return the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: typo. \param[in]
, mDistance(signedDistance) | ||
{ | ||
if (direction.squaredNorm() == 0) | ||
if (mDirection.get().squaredNorm() == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be <= 1e-3
or something that's not exactly zero?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is only here because normalizing a zero vector throws an error. I don't think it's wrong to pass in a small-magnitude vector and use that resulting direction, so I think comparing exactly to zero is fine. However, I think it might be better to use .isZero()
rather than .squaredNorm() == 0
.
, mDirection(direction) | ||
, mDistance(signedDistance) | ||
{ | ||
if (mDirection.get().squaredNorm() == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few nit comments. Almost there. 😄
/// end-effector BodyNode's current direction. | ||
/// | ||
/// \param[in] stateSpace State space. | ||
/// param[in] metaSkeleton MetaSkeleton that getStartState will return the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: \param[in]
@@ -47,26 +111,34 @@ class ConfigurationToEndEffectorOffset : public Problem | |||
/// while maintaining the current orientation. | |||
::dart::dynamics::ConstBodyNodePtr getEndEffectorBodyNode() const; | |||
|
|||
/// Returns the start state. | |||
/// Return the start state to plan from, either set on construction or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Returns
const statespace::dart::MetaSkeletonStateSpace::State* startState, | ||
::dart::dynamics::ConstBodyNodePtr endEffectorBodyNode, | ||
double signedDistance, | ||
constraint::ConstTestablePtr constraint); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Let's pass nullptr
to constraint
as the default value for the same reason.
/// Returns the direction of motion specified in the world frame. Note that | ||
/// if no direction was passed, the current direction of the end effector body | ||
/// node is returned. | ||
const Eigen::Vector3d getDirection() const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: No point to return const value.
/// | ||
/// \param[in] stateSpace State space. | ||
/// param[in] metaSkeleton MetaSkeleton that getStartState will return the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: \param[in]
::dart::dynamics::ConstBodyNodePtr endEffectorBodyNode, | ||
const Eigen::Isometry3d& goalPose, | ||
constraint::ConstTestablePtr constraint); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Let's pass nullptr
to constraint as the default value for the same reason.
const statespace::dart::MetaSkeletonStateSpace::State* startState, | ||
::dart::dynamics::ConstBodyNodePtr endEffectorBodyNode, | ||
const Eigen::Isometry3d& goalPose, | ||
constraint::ConstTestablePtr constraint); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Let's pass nullptr
to constraint as the default value for the same reason.
::dart::dynamics::ConstBodyNodePtr endEffectorBodyNode, | ||
std::size_t maxSamples, | ||
constraint::dart::ConstTSRPtr goalTSR, | ||
constraint::ConstTestablePtr constraint); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Let's pass nullptr
to constraint as the default value for the same reason.
const statespace::dart::MetaSkeletonStateSpace::State* startState, | ||
::dart::dynamics::ConstBodyNodePtr endEffectorBodyNode, | ||
std::size_t maxSamples, | ||
constraint::dart::ConstTSRPtr goalTSR, | ||
constraint::ConstTestablePtr constraint); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Let's pass nullptr
to constraint as the default value for the same reason.
@@ -46,22 +68,30 @@ class ConfigurationToTSR : public Problem | |||
/// Returns the maximum number of TSR samples to plan to. | |||
std::size_t getMaxSamples() const; | |||
|
|||
/// Returns the start state. | |||
/// Return the start state to plan from, either set on construction or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Returns
It looks like the only failures are due to the pending Homebrew PR, so I'm going to merge this. Thanks for all the changes! |
* Test with COnfitoConf and seems to work! * Add getTrajectoryPostProcessor() method to ConcreteRobot class. * Make ConfigurationToEndEffectorOffset and ConfigurationToTSR problems also use ScopedState internally. * HACK: Make ConfigurationToEndEffectorOffset getDirection() method return bodyNode direction if passed direction was zero vector. * Fix ConfigurationToConfiguration_to_ConfigurationToTSR adapter now that problems can store a cloned, scoped version of the passed state. * HACK: Fix hack for returning current BN direction in Offset problem (for moving straight). * HACK: Get around HERB hand BN not being in arm metaSkeleton, and nullptr RNG. * HACK: Update hacks to work with MAGI. * HACK: Got left out of last commit. * HACK: Cap samples in DART TSR adapter. Use better random seed. * Make getTrajectoryPostProcessor take needed args. * Make getTrajectoryPostProcessor take constraint checking params. * Do BN check in TSR adapter correctly by using the skeleton. * Add RNG to ConfigurationToConfiguration_to_ConfigurationToTSR. * Remove startState from DART problems. Need to fix tests. * Add DART ConfigurationToConfigurationPlanner. * Add new adapter that turns non-DART ConfTOConf planner into a DART one. * Update tests for removing startState from DART problems. * Run make format on last commit. * Fix tests from adding RNG to TSR adapter. * Fix naming ambiguity that made TSR adapter not build. * Use boost:none instead of zero vector to get straight direction in offset problem. * Make Offset problem take optional as reference. * Clean up Offset problem comments and restore zero vector check. * Remove TSR adapter hack to prevent inf loops. * HACK BODY NODE FALLS OFF * HACK HACK HACK. * HACK HACK JH * HACK: IKJDSHFKJDSHFKJDSHFKDSHFLJDHFSKJHDSFKJDHF * Revert "HACK: IKJDSHFKJDSHFKJDSHFKDSHFLJDHFSKJHDSFKJDHF" This reverts commit 40482d3. * Revert "HACK HACK JH" This reverts commit 42cd655. * Revert "HACK HACK HACK." This reverts commit 85eee66. * Revert "HACK BODY NODE FALLS OFF" This reverts commit 40b1207. * Update ConfigurationToEndEffectorOffset to use multiple constructors. * Update getStartState in ConfigurationToEndEffectorOffset. * Update ConfigurationToEndEffectorPose to use two constructors and restore getStartState. Fix state passing in ConfigurationToEndEffectorOffset. * Update ConfigurationToTSR to use multiple constructors and restore getStartState. * Update TSR adapter to just use getStartState(). * Pass start state to VFP. * Revert "Update TSR adapter to just use getStartState()." This reverts commit 976b443. * UpdateDART planning problems to not return dangling pointers with getStateState(). * Draft dart/ConfigurationToConfiguration.hpp * Draft dart/ConfigurationToConfiguration.cpp * Make adapter use right ConfigToConfig Problem. * Trim fat in new getTrajectoryPostProcessor method. * Fix tests with what we have now. * Run make format. * Make Planner take RNG. * Add rng arg to SingleProblemPlanner and ConfigurationToConfigurationPlanner constructors to enable future OMPL planners to take RNG. * Use delegate RNG in TSR adapter. Make tests build again. * Move getEndEffectorDirection into robot/util * Create planner/dart/util and put getEndEffectorDirection there instead. * Change Planner to take raw RNG pointer, and getRng to return this raw pointer. * Respond to nits. * Fix RNG destruction in Planner class. * Repond to latest review comments. * Remove some std::moves to fix RVO build issue with OSX. * Nab one std::move missed by the last commit.. * Use getState in DART planning problems. * Remove uneeded aikido::'s in ConfigurationToConfiguration_to_ConfigurationToConfiguration. * Run make format. * Respond to all but one of Gilwoo's nits. * Respond to some more nits.
This reverts commit f05e40b.
This PR adresses issues related to the new Planner. These issues were discovered while trying to use the new code with the soda demo.
Summary of Changes
Change
Problem
derivative classes relative to the demo to useScopedState
internally to prevent dangling pointers.Add a
ConfigurationToConfigurationPlanner
in the DART planner space that takes a MetaSkeleton.Add
ConfigurationToConfiguration_to_ConfigurationToConfiguration
adapter that turns the standardConfigurationToConfiguration
planner into the DART one.Remove start states from DART
Problem
classes. This is because the start state should be taken form the MetaSkeleton, and it's why 2 and 3 are necessary.Make
direction
passed toConfigurationToEndEffectorOffset
constructor aboost::optional
. If it's empty,getDirection
returns the current direction of the end effector body node (needed to make planning straight with VFP possible in the demo).Add
getTrajectoryPostProcessor
method toConcreteRobot
class. We need this in libherb.ConfigurationToConfiguration_to_ConfigurationToTSR
has been fixed by taking an RNG in the constructor and using this when creating the sampler. The plan() method now checks whether the problem's bodynode is in the skeleton the MetaSkeleton corresponds to (in cases where the hand is not in the MetaSkeleton itself, such as with HERB).Before creating a pull request
make format
Before merging a pull request
CHANGELOG.md