Skip to content
Snippets Groups Projects
Commit 49ba29e5 authored by Florent Lamiraux's avatar Florent Lamiraux Committed by GitHub
Browse files

Merge pull request #19 from jmirabel/devel

GraphSteeringMethod is built with a const Problem& (not a ProblemPtr_t)
parents a3cce3b8 245670f5
No related branches found
No related tags found
No related merge requests found
......@@ -38,16 +38,16 @@ namespace hpp {
public:
/// Create instance and return shared pointer
/// \warning core::ProblemPtr_t will be casted to ProblemPtr_t
/// \warning core::Problem will be casted to Problem
static GraphSteeringMethodPtr_t create
(const core::ProblemPtr_t& problem);
(const core::Problem& problem);
template <typename T>
static GraphSteeringMethodPtr_t create
(const core::ProblemPtr_t& problem);
(const core::Problem& problem);
/// Create instance and return shared pointer
static GraphSteeringMethodPtr_t create (const ProblemPtr_t& problem);
static GraphSteeringMethodPtr_t create (const Problem& problem);
/// Create copy and return shared pointer
static GraphSteeringMethodPtr_t createCopy
......@@ -71,7 +71,7 @@ namespace hpp {
protected:
/// Constructor
GraphSteeringMethod (const ProblemPtr_t& problem);
GraphSteeringMethod (const Problem& problem);
/// Copy constructor
GraphSteeringMethod (const GraphSteeringMethod&);
......@@ -86,7 +86,7 @@ namespace hpp {
private:
/// A pointer to the problem
ProblemPtr_t problem_;
const Problem& problem_;
/// Weak pointer to itself
GraphSteeringMethodWkPtr_t weak_;
/// The encapsulated steering method
......@@ -95,7 +95,7 @@ namespace hpp {
template <typename T>
GraphSteeringMethodPtr_t GraphSteeringMethod::create
(const core::ProblemPtr_t& problem)
(const core::Problem& problem)
{
GraphSteeringMethodPtr_t gsm = GraphSteeringMethod::create (problem);
gsm->innerSteeringMethod (T::create (problem));
......
......@@ -27,16 +27,15 @@
namespace hpp {
namespace manipulation {
GraphSteeringMethodPtr_t GraphSteeringMethod::create
(const core::ProblemPtr_t& problem)
(const core::Problem& problem)
{
assert (dynamic_cast <const ProblemPtr_t> (problem) != NULL
&& "Cast to const ProblemPtr_t failed");
const ProblemPtr_t& p = static_cast <const ProblemPtr_t> (problem);
dynamic_cast <const Problem&> (problem);
const Problem& p = static_cast <const Problem&> (problem);
return create (p);
}
GraphSteeringMethodPtr_t GraphSteeringMethod::create
(const ProblemPtr_t& problem)
(const Problem& problem)
{
GraphSteeringMethod* ptr = new GraphSteeringMethod (problem);
GraphSteeringMethodPtr_t shPtr (ptr);
......@@ -53,7 +52,7 @@ namespace hpp {
return shPtr;
}
GraphSteeringMethod::GraphSteeringMethod (const ProblemPtr_t& problem) :
GraphSteeringMethod::GraphSteeringMethod (const Problem& problem) :
SteeringMethod (problem), problem_ (problem), weak_ ()
{
}
......@@ -66,7 +65,7 @@ namespace hpp {
PathPtr_t GraphSteeringMethod::impl_compute (ConfigurationIn_t q1, ConfigurationIn_t q2) const
{
graph::Edges_t possibleEdges;
graph::Graph& graph = *problem_->constraintGraph ();
const graph::Graph& graph = *problem_.constraintGraph ();
try {
possibleEdges = graph.getEdges
(graph.getState (q1), graph.getState (q2));
......
......@@ -27,7 +27,7 @@ namespace hpp {
Problem::Problem (DevicePtr_t robot)
: Parent (robot), graph_()
{
Parent::steeringMethod (GraphSteeringMethod::create (this));
Parent::steeringMethod (GraphSteeringMethod::create (*this));
distance (WeighedDistance::create (robot, graph_));
setPathValidationFactory(core::DiscretizedCollisionChecking::create, 0.05);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment