-
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
New vector field planner impelementation #268
Changes from 8 commits
5a30b77
15e7fe0
57d342e
b7fc1b5
99a3706
8870a96
a6f9ace
b471f86
2c80af7
5aa1f22
e7f506a
3d501b6
cec4bf3
0c89b74
c35fc80
28dc85f
45ee24a
ced7229
2ef5f78
78d57c1
74272f6
a5221d6
81f3ba2
5be7e08
cda62da
fdd6562
85c93d7
b2dc8f2
46c0bae
8ba6b05
daf3120
a4c3fd1
79e9f1d
cbca871
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#ifndef AIKIDO_PLANNER_VECTORFIELD_CONFIGURATIONSPACEVECTORFIELD_HPP_ | ||
#define AIKIDO_PLANNER_VECTORFIELD_CONFIGURATIONSPACEVECTORFIELD_HPP_ | ||
|
||
#include <aikido/planner/vectorfield/VectorFieldPlannerStatus.hpp> | ||
#include <aikido/statespace/dart/MetaSkeletonStateSpace.hpp> | ||
|
||
namespace aikido { | ||
namespace planner { | ||
namespace vectorfield { | ||
|
||
/// This class defines a vector field in a configuration space | ||
/// | ||
/// Any vector filed should inherit this class to implememnt functions | ||
/// for calculating joint velocities giving joint positions and time, | ||
/// and checking planning status. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know what "and time" means here. I think this should just say "joint positions." To be pedantic, we shouldn't be referring to joints at all in this class. A vector field is defined over an abstract state space - it does not technically even have to be a |
||
class ConfigurationSpaceVectorField | ||
{ | ||
public: | ||
/// Constructor | ||
/// | ||
/// \param[in] _stateSpace MetaSkeleton state space | ||
/// \param[in] _bn Body node of end-effector | ||
ConfigurationSpaceVectorField( | ||
aikido::statespace::dart::MetaSkeletonStateSpacePtr _stateSpace, | ||
dart::dynamics::BodyNodePtr _bodyNode) | ||
: mStateSpace(_stateSpace) | ||
, mMetaSkeleton(_stateSpace->getMetaSkeleton()) | ||
, mBodyNode(_bodyNode) | ||
{ | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please move the function definitions to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Add |
||
|
||
/// Vectorfield callback function | ||
/// | ||
/// \param[out] _qd Joint velocities | ||
/// \return Whether joint velocities are successfully computed | ||
virtual bool getJointVelocities(Eigen::VectorXd& _qd) = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this function can be a const function. |
||
|
||
/// Vectorfield planning status callback function | ||
/// | ||
/// \return Status of planning | ||
virtual VectorFieldPlannerStatus checkPlanningStatus() = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this function can be a const function. |
||
|
||
/// Meta skeleton spate space | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo: spate --> state |
||
virtual aikido::statespace::dart::MetaSkeletonStateSpacePtr | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are these functions (and below getters) virtual? Any possibility that a subclass overrides this function? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No. I don't know why I wrote that way. Good catch! Thanks! |
||
getMetaSkeletonStateSpace() | ||
{ | ||
return mStateSpace; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add const functions for
that return pointers to const objects accordingly like This is necessary for const-correctness. Without const functions of this getters, a const instance of Edit: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should |
||
|
||
/// Meta skeleton | ||
virtual dart::dynamics::MetaSkeletonPtr getMetaSkeleton() | ||
{ | ||
return mMetaSkeleton; | ||
} | ||
|
||
/// Body node of end-effector | ||
virtual dart::dynamics::BodyNodePtr getBodyNode() | ||
{ | ||
return mBodyNode; | ||
} | ||
|
||
protected: | ||
aikido::statespace::dart::MetaSkeletonStateSpacePtr mStateSpace; | ||
dart::dynamics::MetaSkeletonPtr mMetaSkeleton; | ||
dart::dynamics::BodyNodePtr mBodyNode; | ||
}; | ||
|
||
using ConfigurationSpaceVectorFieldPtr | ||
= std::shared_ptr<ConfigurationSpaceVectorField>; | ||
|
||
} // namespace vectorfield | ||
} // namespace planner | ||
} // namespace aikido | ||
|
||
#endif // AIKIDO_PLANNER_VECTORFIELD_CONFIGURATIONSPACEVECTORFIELD_HPP_ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#ifndef AIKIDO_PLANNER_VECTORFIELD_MOVEENDEFFECTOROFFSETVECTORFIELD_HPP_ | ||
#define AIKIDO_PLANNER_VECTORFIELD_MOVEENDEFFECTOROFFSETVECTORFIELD_HPP_ | ||
|
||
#include <aikido/planner/vectorfield/VectorFieldPlanner.hpp> | ||
#include <aikido/planner/vectorfield/ConfigurationSpaceVectorField.hpp> | ||
|
||
namespace aikido { | ||
namespace planner { | ||
|
@@ -12,70 +12,58 @@ namespace vectorfield { | |
/// This class defines two callback functions for vectorfield planner. | ||
/// One for generating joint velocity in MetaSkeleton state space, | ||
/// and one for determining vectorfield planner status. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please provide a short description of what the vector field does. E.g. what equation it implements and what the intended use-case is. |
||
class MoveEndEffectorOffsetVectorField | ||
class MoveEndEffectorOffsetVectorField : public ConfigurationSpaceVectorField | ||
{ | ||
public: | ||
/// Constructor | ||
/// | ||
/// \param[in] _stateSpace MetaSkeleton state space | ||
/// \param[in] _bn Body node of end-effector | ||
/// \param[in] _linearVelocity Linear velocity in all the directions | ||
/// \param[in] _startTime Start time of a planned trajectory | ||
/// \param[in] _endTime End time of a planned trajectory | ||
/// \param[in] _timestep Time step size | ||
/// \param[in] _linearGain Gain of P control on linear deviation | ||
/// \param[in] _linearTolerance Tolerance on linear deviation | ||
/// \param[in] _angularGain Gain of P control on angular deviation | ||
/// \param[in] _angularTolerance Tolerance on angular deviation | ||
/// \param[in] _direction Unit vector in the direction of motion | ||
/// \param[in] _distance Minimum distance in meters | ||
/// \param[in] _maxDistance Maximum distance in meters | ||
/// \param[in] _positionTolerance Constraint tolerance in meters | ||
/// \param[in] _angularTolerance Constraint tolerance in radians | ||
/// \param[in] _linearVelocityGain Linear velocity gain in workspace. | ||
/// \param[in] _initialStepSize Initial step size | ||
/// \param[in] _jointLimitTolerance If less then this distance to joint | ||
/// limit, velocity is bounded in that direction to 0 | ||
/// \param[in] _optimizationTolerance Tolerance on optimization | ||
/// \param[in] _padding Padding to the boundary | ||
MoveEndEffectorOffsetVectorField( | ||
aikido::statespace::dart::MetaSkeletonStateSpacePtr _stateSpace, | ||
dart::dynamics::BodyNodePtr _bn, | ||
const Eigen::Vector3d& _linearVelocity, | ||
double _startTime, | ||
double _endTime, | ||
double _timestep, | ||
double _linearGain = 1., | ||
double _linearTolerance = 0.01, | ||
double _angularGain = 1., | ||
double _angularTolerance = 0.01, | ||
double _optimizationTolerance = 1e-3, | ||
double _padding = 1e-5); | ||
const Eigen::Vector3d& _direction, | ||
double _distance, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is following the naming in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is not what the planner currently does it PrPy. It integrates as far as possible until it either reaches I agree with @jslee02's naming suggestion - I think |
||
double _maxDistance = std::numeric_limits<double>::max(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This returns the maximum finite |
||
double _positionTolerance = 0.01, | ||
double _angularTolerance = 0.15, | ||
double _linearVelocityGain = 1.0, | ||
double _initialStepSize = 1e-1, | ||
double _jointLimitTolerance = 3e-2, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to this logic, it seems There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. I will use |
||
double _optimizationTolerance = 1e-3); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We generally try to avoid putting these type of defaults in Aikido because they tend to only work well for one robot, e.g. HERB. These numbers would have to be re-tuned for a robot with a different size workspace. I suggest making these mandatory arguments and providing good defaults for HERB in |
||
|
||
/// Vectorfield callback function | ||
/// | ||
/// \param[in] _stateSpace MetaSkeleton state space | ||
/// \param[in] _t Current time being planned | ||
/// \param[out] _dq Joint velocities | ||
/// \param[out] _qd Joint velocities | ||
/// \return Whether joint velocities are successfully computed | ||
bool operator()( | ||
const aikido::statespace::dart::MetaSkeletonStateSpacePtr& _stateSpace, | ||
double _t, | ||
Eigen::VectorXd& _dq); | ||
virtual bool getJointVelocities(Eigen::VectorXd& _qd) override; | ||
|
||
/// Vectorfield planning status callback function | ||
/// | ||
/// \param[in] _stateSpace MetaSkeleton state space | ||
/// \param[in] _t Current time being planned | ||
/// \return Status of planning | ||
VectorFieldPlannerStatus operator()( | ||
const aikido::statespace::dart::MetaSkeletonStateSpacePtr& _stateSpace, | ||
double _t); | ||
virtual VectorFieldPlannerStatus checkPlanningStatus() override; | ||
|
||
private: | ||
dart::dynamics::BodyNodePtr mBodynode; | ||
Eigen::Vector3d mVelocity; | ||
Eigen::Vector3d mLinearDirection; | ||
double mStartTime; | ||
double mEndTime; | ||
double mTimestep; | ||
double mLinearGain; | ||
double mLinearTolerance; | ||
double mAngularGain; | ||
protected: | ||
Eigen::Vector3d mDirection; | ||
double mDistance; | ||
double mMaxDistance; | ||
double mPositionTolerance; | ||
double mAngularTolerance; | ||
double mLinearVelocityGain; | ||
double mInitialStepSize; | ||
double mJointLimitTolerance; | ||
double mOptimizationTolerance; | ||
double mPadding; | ||
Eigen::Isometry3d mStartPose; | ||
Eigen::Isometry3d mTargetPose; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should flag this class with |
||
}; | ||
|
||
} // namespace vectorfield | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#ifndef AIKIDO_PLANNER_VECTORFIELD_MOVEENDEFFECTORPOSEVECTORFIELD_HPP_ | ||
#define AIKIDO_PLANNER_VECTORFIELD_MOVEENDEFFECTORPOSEVECTORFIELD_HPP_ | ||
|
||
#include <aikido/planner/vectorfield/ConfigurationSpaceVectorField.hpp> | ||
|
||
namespace aikido { | ||
namespace planner { | ||
namespace vectorfield { | ||
|
||
/// Vector field for moving end-effector by a direction and distance. | ||
/// | ||
/// This class defines two callback functions for vectorfield planner. | ||
/// One for generating joint velocity in MetaSkeleton state space, | ||
/// and one for determining vectorfield planner status. | ||
class MoveEndEffectorPoseVectorField : public ConfigurationSpaceVectorField | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please provide a short description of what the vector field does. E.g. what equation it implements and what the intended use-case is. |
||
{ | ||
public: | ||
/// Constructor | ||
/// | ||
/// \param[in] _stateSpace MetaSkeleton state space | ||
/// \param[in] _bn Body node of end-effector | ||
/// \param[in] _goalPose Desired en-effector pose | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo: en-effector --> end-effector |
||
/// \param[in] _poseErrorTolerance Constraint error tolerance in meters | ||
/// \param[in] _linearVelocityGain Linear velocity gain in workspace | ||
/// \param[in] _angularVelocityGain Angular velocity gain in workspace | ||
/// \param[in] _initialStepSize Initial step size | ||
/// \param[in] _jointLimitTolerance If less then this distance to joint | ||
/// limit, velocity is bounded in that direction to 0 | ||
/// \param[in] _optimizationTolerance Tolerance on optimization | ||
MoveEndEffectorPoseVectorField( | ||
aikido::statespace::dart::MetaSkeletonStateSpacePtr _stateSpace, | ||
dart::dynamics::BodyNodePtr _bn, | ||
const Eigen::Isometry3d& _goalPose, | ||
double _linearVelocityGain = 1.0, | ||
double _angularVelocityGain = 1.0, | ||
double _poseErrorTolerance = 0.5, | ||
double _initialStepSize = 1e-1, | ||
double _jointLimitTolerance = 3e-2, | ||
double _optimizationTolerance = 5e-2); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should remove these defaults. See my comment on |
||
|
||
/// Vectorfield callback function | ||
/// | ||
/// \param[in] _q Position in configuration space | ||
/// \param[in] _t Current time being planned | ||
/// \param[out] _qd Joint velocities | ||
/// \return Whether joint velocities are successfully computed | ||
virtual bool getJointVelocities(Eigen::VectorXd& _qd) override; | ||
|
||
/// Vectorfield planning status callback function | ||
/// | ||
/// \param[in] _q Position in configuration space | ||
/// \param[in] _t Current time being planned | ||
/// \return Status of planning | ||
virtual VectorFieldPlannerStatus checkPlanningStatus() override; | ||
|
||
protected: | ||
Eigen::Isometry3d mGoalPose; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This object contains a |
||
double mPoseErrorTolerance; | ||
double mLinearVelocityGain; | ||
double mAngularVelocityGain; | ||
double mInitialStepSize; | ||
double mJointLimitTolerance; | ||
double mOptimizationTolerance; | ||
|
||
Eigen::VectorXd mVelocityLowerLimits; | ||
Eigen::VectorXd mVelocityUpperLimits; | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This object contains a |
||
|
||
} // namespace vectorfield | ||
} // namespace planner | ||
} // namespace aikido | ||
|
||
#endif // ifndef | ||
// AIKIDO_PLANNER_VECTORFIELD_MOVEENDEFFECTORPOSEVECTORFIELD_HPP_ |
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: filed --> field