Skip to content
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

Const changes to support new VFP Planner API refactor. #429

Merged
merged 16 commits into from
May 18, 2018
Merged

Conversation

sniyaz
Copy link

@sniyaz sniyaz commented May 18, 2018

This PR has const changes to support the upcoming VFP refactor onto the new Planner API. #426 is currently blocking on this PR. Once this PR has been merged, I will rebase #426, and we can tackle that PR.

Because the new Problem derivate classes from the new Planner API (#314) make most members const, this requires shoving a bunch of const variables through AIKIDO (we probably don't want to cast the const-ness away, since this would break a promise to the user).

These changes are necessary to make planToEndEffectorOffset possible with the new Planner API. planToEndEffectorPose may require more changes- my plan is to get planToEndEffectorOffset refactored first, then tackle planToEndEffectorPose.

Summary of changes

  1. Const all the things.

  2. Update old planToEndEffectorOffset with the signature it needs to have in Refactor VFP with new Planner API #426.


Before creating a pull request

  • Document new methods and classes
  • Format code with make format

Before merging a pull request

  • Set version target by selecting a milestone on the right side
  • Summarize this change in CHANGELOG.md
  • Add unit test(s) for this change

@sniyaz sniyaz requested review from brianhou, jslee02 and dqyi11 May 18, 2018 01:35
@sniyaz sniyaz mentioned this pull request May 18, 2018
5 tasks
Copy link
Contributor

@brianhou brianhou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly good! I don't think we need to make all statespaces and testables const in this PR, but we should at least do that within each file that we've touched. I left comments on instances that I saw where there was a mix of the two, maybe the next person to review will find more.

@@ -57,7 +57,7 @@ class FramePairDifferentiable : public Differentiable
std::vector<ConstraintType> getConstraintTypes() const override;

// Documentation inherited.
statespace::StateSpacePtr getStateSpace() const override;
statespace::ConstStateSpacePtr getStateSpace() const override;

private:
statespace::dart::MetaSkeletonStateSpacePtr mMetaSkeletonStateSpace;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be statespace::dart::ConstMetaSkeletonStateSpacePtr?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we need the return type to match for the override to work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this comment was about mMetaSkeletonStateSpace.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Derp derp, you're right! 😅

@@ -62,7 +62,7 @@ class FrameDifferentiable : public Differentiable
std::vector<ConstraintType> getConstraintTypes() const override;

// Documentation inherited.
statespace::StateSpacePtr getStateSpace() const override;
statespace::ConstStateSpacePtr getStateSpace() const override;

private:
statespace::dart::MetaSkeletonStateSpacePtr mMetaSkeletonStateSpace;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be statespace::dart::ConstMetaSkeletonStateSpacePtr?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we need the return type to match for the override to work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this comment was about mMetaSkeletonStateSpace.

@@ -20,7 +20,7 @@ class SequentialSampleable : public Sampleable

// Documentation inherited.
// TODO (avk): const-correctness after planner API is merged.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this line.

@@ -20,7 +20,7 @@ class SequentialSampleable : public Sampleable

// Documentation inherited.
// TODO (avk): const-correctness after planner API is merged.
statespace::StateSpacePtr getStateSpace() const override;
statespace::ConstStateSpacePtr getStateSpace() const override;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the private member mStateSpace should be ConstStateSpacePtr.

@@ -34,7 +34,7 @@ class DifferentiableIntersection : public Differentiable
std::vector<ConstraintType> getConstraintTypes() const override;

// Documentation inherited.
statespace::StateSpacePtr getStateSpace() const override;
statespace::ConstStateSpacePtr getStateSpace() const override;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the private member mStateSpace should be ConstStateSpacePtr.

@@ -36,7 +36,7 @@ class FiniteSampleable : public Sampleable
virtual ~FiniteSampleable();

// Documentation inherited.
statespace::StateSpacePtr getStateSpace() const override;
statespace::ConstStateSpacePtr getStateSpace() const override;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the private member mStateSpace should be ConstStateSpacePtr.

@@ -30,7 +30,7 @@ class RejectionSampleable : public Sampleable
int _maxTrialPerSample);

// Documentation inherited.
statespace::StateSpacePtr getStateSpace() const override;
statespace::ConstStateSpacePtr getStateSpace() const override;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the private member mStateSpace should be ConstStateSpacePtr.

@@ -45,14 +45,14 @@ class FrameTestable : public Testable
std::unique_ptr<TestableOutcome> createOutcome() const override;

// Documentation inherited
std::shared_ptr<statespace::StateSpace> getStateSpace() const override;
statespace::ConstStateSpacePtr getStateSpace() const override;

private:
statespace::dart::MetaSkeletonStateSpacePtr mMetaSkeletonStateSpace;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be statespace::dart::ConstMetaSkeletonStateSpacePtr.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this breaks the override.

@@ -41,7 +41,7 @@ class InverseKinematicsSampleable : public Sampleable
virtual ~InverseKinematicsSampleable() = default;

// Documentation inherited.
statespace::StateSpacePtr getStateSpace() const override;
statespace::ConstStateSpacePtr getStateSpace() const override;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think mMetaSkeletonStateSpace should be ConstMetaSkeletonStateSpacePtr.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this breaks the override.

@@ -24,7 +24,7 @@ std::unique_ptr<Differentiable> createDifferentiableBoundsFor(
/// Differtiable is created.
/// \param _stateSpace The StateSpace where the Differentiable will be applied
std::unique_ptr<Differentiable> createDifferentiableBounds(
std::shared_ptr<statespace::dart::JointStateSpace> _stateSpace);
std::shared_ptr<const statespace::dart::JointStateSpace> _stateSpace);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make all the statespaces in this file const?

@codecov
Copy link

codecov bot commented May 18, 2018

Codecov Report

Merging #429 into master will increase coverage by 0.06%.
The diff coverage is 73.52%.

@@            Coverage Diff             @@
##           master     #429      +/-   ##
==========================================
+ Coverage   79.69%   79.76%   +0.06%     
==========================================
  Files         231      231              
  Lines        5990     5986       -4     
==========================================
+ Hits         4774     4775       +1     
+ Misses       1216     1211       -5
Impacted Files Coverage Δ
.../aikido/constraint/CartesianProductProjectable.hpp 100% <ø> (ø) ⬆️
.../aikido/statespace/dart/MetaSkeletonStateSpace.hpp 100% <ø> (ø) ⬆️
...ude/aikido/constraint/uniform/SE2BoxConstraint.hpp 100% <ø> (ø) ⬆️
include/aikido/constraint/SequentialSampleable.hpp 100% <ø> (ø) ⬆️
...e/aikido/constraint/DifferentiableIntersection.hpp 100% <ø> (ø) ⬆️
include/aikido/distance/DistanceMetric.hpp 100% <ø> (ø) ⬆️
...do/planner/vectorfield/BodyNodePoseVectorField.hpp 100% <ø> (ø) ⬆️
include/aikido/distance/SO2Angular.hpp 100% <ø> (ø) ⬆️
...ude/aikido/constraint/CartesianProductTestable.hpp 100% <ø> (ø) ⬆️
src/planner/ompl/Planner.cpp 88.76% <ø> (ø) ⬆️
... and 75 more

@sniyaz
Copy link
Author

sniyaz commented May 18, 2018

Responded to @brianhou's comments- @jslee02, could you take a look when you have the chance?

jslee02
jslee02 previously approved these changes May 18, 2018
Copy link
Member

@jslee02 jslee02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks for the fix! 👍

brianhou
brianhou previously approved these changes May 18, 2018
dqyi11
dqyi11 previously approved these changes May 18, 2018
@brianhou brianhou added this to the Aikido 0.3.0 milestone May 18, 2018
@brianhou brianhou dismissed stale reviews from dqyi11, jslee02, and themself via e7f3e94 May 18, 2018 22:37
@brianhou brianhou merged commit e7b3758 into master May 18, 2018
@brianhou brianhou deleted the VFP_const branch May 18, 2018 22:37
gilwoolee pushed a commit that referenced this pull request Jan 21, 2019
* Make types play nice by changing old VFP code, but problem has now been pushed deeper into AIKIDO.

* Propograte const-ness to more of AIKIDO, but not done yet.

* Even more const-ing. Builds more, but still not all the way.

* Add const-ness to some OMPL stuff. Bumped issues back to VFP code.

* Make VFP Offset changes build. Needed to muck around with Robot class.

* Yet more const-ing to make tests build.

* Tests now build as well.

* Clean up createDistanceMetricFor_impl code.

* Add file left out from last commit

* Clean up JointStateSpaceHelpers code.

* Run `make format`.

* Respond to Brian's comments.

* Update CHANGELOG.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants