-
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
Fix issues discovered during demo. #442
Changes from all commits
e24c163
411aba5
05fac7c
497e474
54f23a5
349d294
4ffcdaa
c7d2c34
0ac8554
f17d866
689e718
c8c5873
fff03e9
08fc93b
c283296
7dca09c
feed4d8
894beeb
1b51253
cc661e1
ea2ad17
3458ef7
a939cc6
c63b74e
714c26f
40b1207
85eee66
42cd655
40482d3
72e73f8
ec70b2f
1e212b2
ee13b26
460de14
69ec10e
9f6dc86
a8c8ed7
382fa79
976b443
2177478
9872574
6f50352
9cbc9d3
3944df6
18acbc3
3527ed9
0193fd6
b566978
b442e8f
f20fd9c
75bc729
d2dfa3e
28d22f2
48e98df
c183100
76fe14b
055cbb1
437b63e
e138d30
a88a8c1
ecb5239
0d4be11
aa9554e
204cd21
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 |
---|---|---|
|
@@ -22,14 +22,19 @@ class Planner | |
/// Constructs from a state space. | ||
/// | ||
/// \param[in] stateSpace State space that this planner associated with. | ||
explicit Planner(statespace::ConstStateSpacePtr stateSpace); | ||
/// \param[in] rng RNG that planner uses. If nullptr, a default is created. | ||
explicit Planner( | ||
statespace::ConstStateSpacePtr stateSpace, common::RNG* rng = nullptr); | ||
|
||
/// Default destructor. | ||
virtual ~Planner() = default; | ||
|
||
/// Returns const state space. | ||
statespace::ConstStateSpacePtr getStateSpace() const; | ||
|
||
/// Returns RNG. | ||
common::RNG* getRng(); | ||
|
||
/// Returns true if this planner can solve \c problem. | ||
virtual bool canSolve(const Problem& problem) const = 0; | ||
|
||
|
@@ -44,6 +49,9 @@ class Planner | |
protected: | ||
/// State space associated with this planner. | ||
statespace::ConstStateSpacePtr mStateSpace; | ||
|
||
/// RNG the planner uses. | ||
std::unique_ptr<common::RNG> mRng; | ||
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. If we're taking in a raw 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 could store is as either, since this is hidden from the user. I picked a unique pointer for convenience, since I create a default RNG if one isn't given, and unique pointers handle memory management once the |
||
}; | ||
|
||
/// Base class for planning result of various planning problems. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#ifndef AIKIDO_PLANNER_DART_CONFIGURATIONTOCONFIGURATION_HPP_ | ||
#define AIKIDO_PLANNER_DART_CONFIGURATIONTOCONFIGURATION_HPP_ | ||
|
||
#include <dart/dart.hpp> | ||
#include "aikido/constraint/Testable.hpp" | ||
#include "aikido/planner/Problem.hpp" | ||
#include "aikido/statespace/dart/MetaSkeletonStateSpace.hpp" | ||
|
||
namespace aikido { | ||
namespace planner { | ||
namespace dart { | ||
|
||
/// Planning problem to plan to a single goal configuration. | ||
class ConfigurationToConfiguration : public Problem | ||
{ | ||
public: | ||
/// Constructor. Note that this constructor takes the start state from the | ||
/// current state of the passed MetaSkeleton. | ||
/// | ||
/// \param[in] stateSpace State space. | ||
/// param[in] metaSkeleton MetaSkeleton that getStartState will return the | ||
/// current state of when called. | ||
/// \param[in] goalState Goal state to plan to. | ||
/// \param[in] constraint Trajectory-wide constraint that must be satisfied. | ||
ConfigurationToConfiguration( | ||
statespace::dart::ConstMetaSkeletonStateSpacePtr stateSpace, | ||
::dart::dynamics::ConstMetaSkeletonPtr metaSkeleton, | ||
const statespace::dart::MetaSkeletonStateSpace::State* goalState, | ||
constraint::ConstTestablePtr constraint = nullptr); | ||
|
||
/// Constructor. Note that this constructor sets the start state on | ||
/// construction. | ||
/// | ||
/// \param[in] stateSpace State space. | ||
/// \param[in] startState Start state to plan from. | ||
/// \param[in] goalState Goal state to plan to. | ||
/// \param[in] constraint Trajectory-wide constraint that must be satisfied. | ||
ConfigurationToConfiguration( | ||
statespace::dart::ConstMetaSkeletonStateSpacePtr stateSpace, | ||
const statespace::dart::MetaSkeletonStateSpace::State* startState, | ||
const statespace::dart::MetaSkeletonStateSpace::State* goalState, | ||
constraint::ConstTestablePtr constraint = nullptr); | ||
|
||
// Documentation inherited. | ||
const std::string& getType() const override; | ||
|
||
/// Returns the type of the planning problem. | ||
static const std::string& getStaticType(); | ||
|
||
/// Returns the start state. | ||
const statespace::dart::MetaSkeletonStateSpace::State* getStartState() const; | ||
|
||
/// Returns the goal state. | ||
const statespace::dart::MetaSkeletonStateSpace::State* getGoalState() const; | ||
|
||
protected: | ||
/// MetaSkeletonStateSpace. Prevents use of expensive dynamic cast on | ||
/// mStateSpace. | ||
statespace::dart::ConstMetaSkeletonStateSpacePtr mMetaSkeletonStateSpace; | ||
|
||
/// MetaSkeleton, if given. | ||
::dart::dynamics::ConstMetaSkeletonPtr mMetaSkeleton; | ||
|
||
/// Start state. | ||
statespace::dart::MetaSkeletonStateSpace::ScopedState mStartState; | ||
|
||
/// Goal state. | ||
statespace::dart::MetaSkeletonStateSpace::ScopedState mGoalState; | ||
}; | ||
|
||
} // namespace dart | ||
} // namespace planner | ||
} // namespace aikido | ||
|
||
#endif // AIKIDO_PLANNER_DART_CONFIGURATIONTOCONFIGURATION_HPP_ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#ifndef AIKIDO_PLANNER_DART_CONFIGURATIONTOCONFIGURATIONPLANNER_HPP_ | ||
#define AIKIDO_PLANNER_DART_CONFIGURATIONTOCONFIGURATIONPLANNER_HPP_ | ||
|
||
#include "aikido/planner/dart/ConfigurationToConfiguration.hpp" | ||
#include "aikido/planner/dart/SingleProblemPlanner.hpp" | ||
#include "aikido/statespace/dart/MetaSkeletonStateSpace.hpp" | ||
#include "aikido/trajectory/Trajectory.hpp" | ||
|
||
namespace aikido { | ||
namespace planner { | ||
namespace dart { | ||
|
||
/// Base planner class for ConfigurationToEndEffectorOffset planning problem. | ||
class ConfigurationToConfigurationPlanner | ||
: public dart::SingleProblemPlanner<ConfigurationToConfigurationPlanner, | ||
ConfigurationToConfiguration> | ||
{ | ||
public: | ||
// Expose the implementation of Planner::plan(const Problem&, Result*) in | ||
// SingleProblemPlanner. Note that plan() of the base class takes Problem | ||
// while the virtual function defined in this class takes SolvableProblem, | ||
// which is simply ConfigurationToConfiguration. | ||
using SingleProblemPlanner::plan; | ||
|
||
/// Constructor | ||
/// | ||
/// \param[in] stateSpace State space that this planner associated with. | ||
/// \param[in] metaSkeleton MetaSkeleton to use for planning. | ||
ConfigurationToConfigurationPlanner( | ||
statespace::dart::ConstMetaSkeletonStateSpacePtr stateSpace, | ||
::dart::dynamics::MetaSkeletonPtr metaSkeleton); | ||
|
||
/// Solves \c problem returning the result to \c result. | ||
/// | ||
/// \param[in] problem Planning problem to be solved by the planner. | ||
/// \param[out] result Result of planning procedure. | ||
virtual trajectory::TrajectoryPtr plan( | ||
const SolvableProblem& problem, Result* result = nullptr) | ||
= 0; | ||
// Note: SolvableProblem is defined in SingleProblemPlanner. | ||
}; | ||
|
||
} // namespace dart | ||
} // namespace planner | ||
} // namespace aikido | ||
|
||
#endif // AIKIDO_PLANNER_DART_CONFIGURATIONTOCONFIGURATIONPLANNER_HPP_ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#ifndef AIKIDO_PLANNER_DART_CONFIGURATIONTOCONFIGURATIONTOCONFIGURATIONTOCONFIGURATION_HPP_ | ||
#define AIKIDO_PLANNER_DART_CONFIGURATIONTOCONFIGURATIONTOCONFIGURATIONTOCONFIGURATION_HPP_ | ||
|
||
#include "aikido/planner/ConfigurationToConfigurationPlanner.hpp" | ||
#include "aikido/planner/dart/ConfigurationToConfigurationPlanner.hpp" | ||
#include "aikido/planner/dart/PlannerAdapter.hpp" | ||
|
||
namespace aikido { | ||
namespace planner { | ||
namespace dart { | ||
|
||
/// Converts a non-DART ConfigurationToConfiguration planner into the DART | ||
/// version. | ||
class ConfigurationToConfiguration_to_ConfigurationToConfiguration | ||
: public PlannerAdapter<planner::ConfigurationToConfigurationPlanner, | ||
planner::dart::ConfigurationToConfigurationPlanner> | ||
{ | ||
public: | ||
/// Constructor | ||
/// | ||
/// \param[in] planner Non-DART planner to convert. | ||
/// \param[in] metaSkeleton MetaSkeleton for adapted planner to operate on. | ||
ConfigurationToConfiguration_to_ConfigurationToConfiguration( | ||
std::shared_ptr<planner::ConfigurationToConfigurationPlanner> planner, | ||
::dart::dynamics::MetaSkeletonPtr metaSkeleton); | ||
|
||
// Documentation inherited. | ||
virtual trajectory::TrajectoryPtr plan( | ||
const planner::dart::ConfigurationToConfiguration& problem, | ||
Planner::Result* result) override; | ||
}; | ||
|
||
} // namespace dart | ||
} // namespace planner | ||
} // namespace aikido | ||
|
||
#endif // AIKIDO_PLANNER_DART_CONFIGURATIONTOCONFIGURATIONTOCONFIGURATIONTOCONFIGURATION_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.
Please add docstring for
rng
.