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

Adding WeldJoint and ConstantSampler #146

Merged
merged 11 commits into from
Apr 4, 2017
Merged

Conversation

gilwoolee
Copy link
Contributor

@gilwoolee gilwoolee commented Apr 2, 2017

This PR adds the following:

  • dart/statespace/WeldJoint
  • constraint/uniform/ConstantSampler

and uses ConstantSampler as a sampler for WeldJoint.


This change is Reviewable

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.1%) to 84.256% when pulling 343e563 on statespace/WeldJoint into 4cd2795 on master.

Copy link
Member

@mkoval mkoval left a comment

Choose a reason for hiding this comment

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

The general procedure of implementing the statespace::dart::WeldJoint state space and helper functions (createDifferentiableFor, createTestableFor, createProjectableFor) looks reasonable.

However, I don't understand why ConstantSampler is necessary. Isn't that equivalent to a RnBoxConstraint with equal upper and lower bounds?

@gilwoolee
Copy link
Contributor Author

@mkoval I initially had that, which works fine, but it would unnecessarily try to "sample" when it can simply return a fixed value, so I thought this would be cleaner? I can switch back to using RnBoxConstraint if necessary.

Copy link
Member

@mkoval mkoval left a comment

Choose a reason for hiding this comment

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

If we were starting from scratch, I'd suggest using RnBoxConstraint to avoid having to implement - and test 😬 - a new constraint class. Since you've already implemented ConstantSampler, I see no harm in keeping it. 😃

I am happy to merge this as it stands if you add Rn to the name of the new constraint class and write unit tests for the new functionality. 👍

/// ConstantSampler for RealVectorStates.
/// Stub sampler for WeldJoint or any fixed constant state space.
class ConstantSampler
: public constraint::Sampleable
Copy link
Member

Choose a reason for hiding this comment

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

Rename ConstantSampler to RnConstantSampler since this only works on an Rn state space.


//=============================================================================
class ConstantSamplerSampleGenerator
: public constraint::SampleGenerator
Copy link
Member

Choose a reason for hiding this comment

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

  • Rename to RnConstantSamplerSampleGenerator (see above).
  • Define this class in an anonymous namespace since it is only used in this file.

void WeldJoint::convertPositionsToState(
const Eigen::VectorXd& _positions, StateSpace::State* _state) const
{
setValue(static_cast<State*>(_state), _positions);
Copy link
Member

Choose a reason for hiding this comment

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

I believe we don't need to convert any value here because the dimension of WeldJoint is zero.

void WeldJoint::convertStateToPositions(
const StateSpace::State* _state, Eigen::VectorXd& _positions) const
{
_positions = getValue(static_cast<const State*>(_state));
Copy link
Member

Choose a reason for hiding this comment

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

Nothing to get values from _state, which is zero dimensional. It would be sufficient to resize _positions to zero as _positions.resize(0); (see above)

@jslee02
Copy link
Member

jslee02 commented Apr 4, 2017

Addressed @mkoval 's comments.

@jslee02 jslee02 added this to the Aikido 0.1.0 milestone Apr 4, 2017
@coveralls
Copy link

Coverage Status

Coverage decreased (-1.1%) to 84.285% when pulling 3715bc3 on statespace/WeldJoint into 4cd2795 on master.

@gilwoolee
Copy link
Contributor Author

@jslee02 Sorry to ask you, but would you mind writing unit tests for the two classes? Thanks a lot!!

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling de46056 on statespace/WeldJoint into ** on master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 51446a6 on statespace/WeldJoint into ** on master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 6a3080c on statespace/WeldJoint into ** on master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 6a3080c on statespace/WeldJoint into ** on master**.

Copy link
Contributor Author

@gilwoolee gilwoolee 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!

@gilwoolee gilwoolee merged commit 6779dd2 into master Apr 4, 2017
@gilwoolee gilwoolee deleted the statespace/WeldJoint branch April 4, 2017 22:03
@aaronjoh aaronjoh mentioned this pull request Apr 6, 2017
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.

4 participants