-
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 16 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,70 @@ | ||
#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 field 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); | ||
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. A generic vector field can be defined on any state space, not only It would also be useful to introduce a subclass that handles the conversion from task space to configuration space. That class could take a |
||
|
||
/// Vectorfield callback function | ||
/// | ||
/// \param[out] _qd Joint velocities | ||
/// \return Whether joint velocities are successfully computed | ||
virtual bool getJointVelocities(Eigen::VectorXd& _qd) const = 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. This should take a |
||
|
||
/// Vectorfield planning status callback function | ||
/// | ||
/// \return Status of planning | ||
virtual VectorFieldPlannerStatus checkPlanningStatus() const = 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. Where does this function get it's input from? This function should take a |
||
|
||
/// Meta skeleton state space | ||
aikido::statespace::dart::MetaSkeletonStateSpacePtr | ||
getMetaSkeletonStateSpace() const; | ||
|
||
/// Returns meta skeleton | ||
dart::dynamics::MetaSkeletonPtr getMetaSkeleton(); | ||
|
||
/// Returns const meta skeleton | ||
dart::dynamics::ConstMetaSkeletonPtr getMetaSkeleton() const; | ||
|
||
/// Returns body node of end-effector | ||
dart::dynamics::BodyNodePtr getBodyNode(); | ||
|
||
/// Returns const body node of end-effector | ||
dart::dynamics::ConstBodyNodePtr getBodyNode() const; | ||
|
||
protected: | ||
/// State space of vector field | ||
aikido::statespace::dart::MetaSkeletonStateSpacePtr mStateSpace; | ||
/// Meta Skeleton of state space | ||
dart::dynamics::MetaSkeletonPtr mMetaSkeleton; | ||
/// BodyNode of end-effector | ||
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,68 @@ 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] _jointLimitPadding 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 _jointLimitPadding = 3e-2, | ||
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); | ||
bool getJointVelocities(Eigen::VectorXd& _qd) const 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); | ||
VectorFieldPlannerStatus checkPlanningStatus() const 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: | ||
/// Movement direction. | ||
Eigen::Vector3d mDirection; | ||
/// Movement distance. | ||
double mDistance; | ||
/// Maximum distance allowed to move. | ||
double mMaxDistance; | ||
/// Tolerance of linear deviation error. | ||
double mPositionTolerance; | ||
/// Tolerance of angular error. | ||
double mAngularTolerance; | ||
/// Linear velocity gain. | ||
double mLinearVelocityGain; | ||
/// Initial step size in adaptive integration. | ||
double mInitialStepSize; | ||
/// Padding for joint limits. | ||
double mJointLimitPadding; | ||
/// Tolerance of optimization solver. | ||
double mOptimizationTolerance; | ||
double mPadding; | ||
/// Start pose of the end-effector. | ||
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,80 @@ | ||
#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 end-effector pose | ||
/// \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] _jointLimitPadding 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 _jointLimitPadding = 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 | ||
bool getJointVelocities(Eigen::VectorXd& _qd) const override; | ||
|
||
/// Vectorfield planning status callback function | ||
/// | ||
/// \param[in] _q Position in configuration space | ||
/// \param[in] _t Current time being planned | ||
/// \return Status of planning | ||
VectorFieldPlannerStatus checkPlanningStatus() const override; | ||
|
||
protected: | ||
/// Goal pose. | ||
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 |
||
/// Tolerance of pose error. | ||
double mPoseErrorTolerance; | ||
/// Linear velocity gain. | ||
double mLinearVelocityGain; | ||
/// Angular velocit gain. | ||
double mAngularVelocityGain; | ||
/// Initial step size of adaptive integration. | ||
double mInitialStepSize; | ||
/// Padding of joint limits | ||
double mJointLimitPadding; | ||
/// Tolerance of optimization solver. | ||
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: "implememnt" -> "implement"