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

Adds SE2BoxConstraint #135

Merged
merged 41 commits into from
Sep 23, 2017
Merged

Adds SE2BoxConstraint #135

merged 41 commits into from
Sep 23, 2017

Conversation

gilwoolee
Copy link
Contributor

@gilwoolee gilwoolee commented Feb 10, 2017

This PR adds:

  • SE2BoxConstraint which is Testable, Sampleable, and Projectable.
  • helper methods in JoinStateSpaceHelpers-Impl.hpp so that dart's SE2 joints with x, y constraints can use be tested, sampled, and projected.
  • SE2 distance metric distance::SE2 which takes l2 norm of (dx, dy, dw). (Happy to take other suggestions too.)

To be consistent with SO2 and SO3 samplers, this does not allow limit on rotational joint, but only on x, y dimensions.


This change is Reviewable

@gilwoolee gilwoolee requested a review from jslee02 February 10, 2017 22:15
@gilwoolee gilwoolee closed this Feb 10, 2017
@mkoval
Copy link
Member

mkoval commented Feb 13, 2017

Why did you close this? These look like a great set of changes.

@gilwoolee
Copy link
Contributor Author

gilwoolee commented Feb 13, 2017 via email

@gilwoolee gilwoolee reopened this Apr 4, 2017
@gilwoolee gilwoolee requested a review from aditya-vk April 4, 2017 02:22
@gilwoolee
Copy link
Contributor Author

This is not demo-priority but we'll need it eventually for base planning. I haven't made any changes I promised, but it'd be great if someone could take a quick pass and comment/agree on the general structure.

@gilwoolee gilwoolee self-assigned this Apr 4, 2017
@jslee02 jslee02 mentioned this pull request May 16, 2017
@codecov-io
Copy link

codecov-io commented May 16, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@00480ed). Click here to learn what that means.
The diff coverage is 54.54%.

@@            Coverage Diff            @@
##             master     #135   +/-   ##
=========================================
  Coverage          ?   73.19%           
=========================================
  Files             ?      148           
  Lines             ?     4092           
  Branches          ?      632           
=========================================
  Hits              ?     2995           
  Misses            ?      650           
  Partials          ?      447
Impacted Files Coverage Δ
src/statespace/SO3.cpp 83.87% <100%> (ø)
src/statespace/SE2.cpp 76.05% <100%> (ø)
include/aikido/distance/detail/defaults-impl.hpp 66.66% <100%> (ø)
...constraint/uniform/detail/RnBoxConstraint-impl.hpp 69.69% <100%> (ø)
.../constraint/detail/JointStateSpaceHelpers-impl.hpp 57.6% <16.66%> (ø)

@gilwoolee gilwoolee requested review from mkoval and brianhou May 22, 2017 20:50
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.

Changes look good overall. It'd be great if you have time to add the weighted norm and tests, but it might be easier to address it in a future PR and merge this now!

throw std::invalid_argument(
"Rotational component of SE2Joint must not have limits.");
}
else if (!joint->hasPositionLimit(1) && !joint->hasPositionLimit(2))
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 condition be !(joint->hasPositionLimit(1) && joint->hasPositionLimit(2))?

@@ -146,7 +146,7 @@ RBoxConstraint<N>::RBoxConstraint(std::shared_ptr<statespace::R<N>> _space,
{
std::stringstream msg;
msg << "Unable to sample from StateSpace because lower limit exeeds"
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: exeeds -> exceeds

, mRnDimension(2)
, mDimension(3)
{
mLowerLimits[0] = -M_PI;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: can we explicitly document that the limits are [theta, x, y]? It seems that this is a result of SE2::logMap.

Copy link
Member

Choose a reason for hiding this comment

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

👍 to adding documentation for this.

Also, I wonder why we don't take the bounds for the rotation angle of SE(2) here. @gilwoolee Do we have a reason not to do so?

Copy link
Contributor

Choose a reason for hiding this comment

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

@jslee02 was this documented somewhere? I don't seem to see it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Never mind, found it!

const aikido::statespace::StateSpace::State* _state1,
const aikido::statespace::StateSpace::State* _state2) const
{
Eigen::VectorXd tangent1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should these be Vector3d?

Copy link
Member

Choose a reason for hiding this comment

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

VectorXd is correct here. logMap, which is a virtual function of StateSpace, takes VectorXd and resize it if needed.

@jslee02
Copy link
Member

jslee02 commented Jun 1, 2017

It'd be great if you have time to add the weighted norm and tests, but it might be easier to address it in a future PR and merge this now!

👍 If we merge this without those great changes, then it would be less great to add issues to track this issues. 😄

@@ -29,7 +29,7 @@ class MotionValidatorTest : public ::testing::Test
std::make_shared<MockTranslationalRobotConstraint>(
stateSpace, Eigen::Vector3d(-0.1, -0.1, -0.1),
Eigen::Vector3d(0.1, 0.1, 0.1));
auto vchecker =
::ompl::base::StateValidityCheckerPtr vchecker =
Copy link
Contributor

Choose a reason for hiding this comment

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

@jslee02 not specifying explicitly the type was resulting in a build error due to ambiguity of the variable type, between StateValidityCheckerPtr and StateValidityCheckerFn. I thought you might want to confirm this change.

@aditya-vk
Copy link
Contributor

If we merge this without those great changes, then it would be less great to add issues to track this issues.

Introduced the weighted norm and added tests. Please do review. Thanks!

@jslee02 jslee02 added this to the Aikido 0.1.0 milestone Sep 18, 2017
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.

@aditya-vk Thanks for adding the tests.

I've made some style fixes and one minor but the necessary fix in computing SE2 distance (see the comment below).

As we have two distance metric classes, I would like to suggest changing the name of Weighted class to something like CartesianProductWeighted. For the backward compatibility, we could also alias Weighted to the new class name with a warning when a user tries to use Weighted.

To do this:
(1) create CartesianProductWeighted.hpp/cpp files and move class Weighted to them renaming the class name
(2) remove Weighted.cpp
(3) remove the original code in Weighted.hpp and alias Weighted to CartesianProductWeighted
(4) add the warning preprocessor directive #warning Weighted is deprecated. Please use CartesianProductWeighted instead by including CartesianProductWeighted.hpp.

if (angularDistance > M_PI)
{
angularDistance -= 2.0 * M_PI;
angularDistance = -angularDistance;
Copy link
Member

Choose a reason for hiding this comment

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

@aditya-vk I added this line to make angularDistance to be always positive. Previously, angluarDistance could be negative if we get in this if-statement.

@jslee02
Copy link
Member

jslee02 commented Sep 19, 2017

Unrelated issue: It seems the Travis tests on ubuntu isn't working due to http://packages.personalrobotics.ri.cmu.edu is down. Let me resolve this by switching to using PPA instead of running our own debian package server, as discussed.

@jslee02
Copy link
Member

jslee02 commented Sep 20, 2017

@aditya-vk After I changed the logic of SE2Weighted::distance(), SE2BoxConstraintTests::createSampleGenerator started to fail. I could make the test pass by increasing DISTANCE_THRESHOLD from 0.15 to 1.5, but am not sure if this is a proper change. Could you take a look at this as well? Thanks!

angularDistance -= 2.0 * M_PI;
angularDistance = -angularDistance;
}
angularDistance = 2*M_PI - angularDistance;
Copy link
Contributor

Choose a reason for hiding this comment

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

@jslee02 thanks for the change! Simplified it into a single statement.

@@ -24,7 +24,7 @@ class SE2BoxConstraintTests : public ::testing::Test
static constexpr size_t NUM_X_TARGETS { 10 };
static constexpr size_t NUM_Y_TARGETS { 10 };
static constexpr size_t NUM_SAMPLES { 1000 };
static constexpr double DISTANCE_THRESHOLD { 0.15 };
static constexpr double DISTANCE_THRESHOLD { 0.8 };
Copy link
Contributor

Choose a reason for hiding this comment

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

@jslee02 For the number of samples taken and the resolution, the maximum distance between a sample and a target in this case is ~0.74. increasing the threshold to 0.8 is sensible in my opinion.

@aditya-vk
Copy link
Contributor

aditya-vk commented Sep 20, 2017

@jslee02 I agree, the Weighted class needs to be renamed. Pushed the relevant changes and issued a warning message suggesting using the new class, in the Weighted.hpp file. Thanks!


} // namespace distance
} // namespace aikido
#warning Weighted is deprecated. Please use CartesianProductWeighted instead by including "CartesianProductWeighted".

Copy link
Member

Choose a reason for hiding this comment

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

Please add using Weighted = CartesianProductWeighted.

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.

LGTM! 👍

@brianhou brianhou merged commit 846ea27 into master Sep 23, 2017
@brianhou brianhou deleted the SE2constraint branch September 23, 2017 02:02
@aditya-vk aditya-vk mentioned this pull request Oct 9, 2018
5 tasks
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.

6 participants