-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding WeldJoint and ConstantSampler (#146)
* WeldJoint * Removing empty lines. * Changing header name * Adding to CMakeList * Remove unnecessary operations in WeldJoint * Add prefix 'Rn-' to ConstantSampler * Add unit tests for WeldJoint and RnConstantSampler * Remove unnecessary static variables * Add RnConstantSampler::getConstantValue() * Return const reference
- Loading branch information
Showing
15 changed files
with
453 additions
and
12 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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#ifndef AIKIDO_CONSTRAINT_RNCONSTANTSAMPLER_HPP_ | ||
#define AIKIDO_CONSTRAINT_RNCONSTANTSAMPLER_HPP_ | ||
#include "../../statespace/Rn.hpp" | ||
#include "../Sampleable.hpp" | ||
|
||
namespace aikido { | ||
namespace constraint { | ||
|
||
/// ConstantSampler for RealVectorStates. | ||
/// Stub sampler for WeldJoint or any fixed constant state space. | ||
class RnConstantSampler : public constraint::Sampleable | ||
{ | ||
public: | ||
/// Constructor. | ||
/// \param _space Space in which this constraint operates. | ||
/// \param _value Value to return when sampled. | ||
RnConstantSampler( | ||
std::shared_ptr<statespace::Rn> _space, | ||
const Eigen::VectorXd& _value); | ||
|
||
// Documentation inherited. | ||
statespace::StateSpacePtr getStateSpace() const override; | ||
|
||
// Documentation inherited. | ||
std::unique_ptr<constraint::SampleGenerator> | ||
createSampleGenerator() const override; | ||
|
||
/// Returns constant value to be generated by this sampler. | ||
const Eigen::VectorXd& getConstantValue() const; | ||
|
||
private: | ||
std::shared_ptr<statespace::Rn> mSpace; | ||
Eigen::VectorXd mValue; | ||
}; | ||
|
||
} // namespace constraint | ||
} // namespace aikido | ||
|
||
#endif // AIKIDO_CONSTRAINT_RNCONSTANTSAMPLER_HPP_ |
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,40 @@ | ||
#ifndef AIKIDO_STATESPACE_DART_WELDJOINTSTATESPACE_HPP_ | ||
#define AIKIDO_STATESPACE_DART_WELDJOINTSTATESPACE_HPP_ | ||
#include "../Rn.hpp" | ||
#include "JointStateSpace.hpp" | ||
|
||
namespace aikido { | ||
namespace statespace { | ||
namespace dart { | ||
|
||
/// \c Weld for DART \c WeldJoint. This class treats the | ||
/// joint's positions as a real vector space. | ||
class WeldJoint | ||
: public Rn | ||
, public JointStateSpace | ||
, public std::enable_shared_from_this<WeldJoint> | ||
{ | ||
public: | ||
using Rn::State; | ||
|
||
/// Create a real vector state space for \c _joint. | ||
/// | ||
/// \param _joint joint to create a state space for | ||
explicit WeldJoint(::dart::dynamics::WeldJoint* _joint); | ||
|
||
// Documentation inherited. | ||
void convertPositionsToState( | ||
const Eigen::VectorXd& _positions, | ||
StateSpace::State* _state) const override; | ||
|
||
// Documentation inherited. | ||
void convertStateToPositions( | ||
const StateSpace::State* _state, | ||
Eigen::VectorXd& _positions) const override; | ||
}; | ||
|
||
} // namespace dart | ||
} // namespace statespace | ||
} // namespace aikido | ||
|
||
#endif // ifndef AIKIDO_STATESPACE_WELDJOINTSTATESPACE_HPP_ |
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
Oops, something went wrong.