Skip to content
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

WIP: Feature/ompl rrt #86

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Conversation

marrts
Copy link
Contributor

@marrts marrts commented Sep 9, 2021

OMPL interface for Descartes, still a work in progress, needs some cleanup but working at this point.

Comment on lines 41 to 42
/** \brief A state space representing the Descartes boost graph. The distance function is determined by the difference
* in rungs and indices unless the rungs are adjacent, then an actual cost is made calculated using an edge evaluator */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** \brief A state space representing the Descartes boost graph. The distance function is determined by the difference
* in rungs and indices unless the rungs are adjacent, then an actual cost is made calculated using an edge evaluator */
/** \brief An OMPL state space representing the Descartes planning graph.
* \details A state in this space is pair of integers representing the rung and sample indices of each Descartes state in the planning graph.
* The distance function is determined by the difference in rung and sample indices. If the rungs are adjacent, then the actual cost is calculated using the appropriate edge evaluator */

Please add some more details about what this state space represents and how it works

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some more details, let me know what you think

Comment on lines 31 to 33
SearchResult<FloatType> ompl_search(std::shared_ptr<ompl::base::Planner> ompl_planner);

void initOMPL();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these need to be separate from the constructor and/or search method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could combine initOMPL() with a redefinition of the constructor.

The ompl_search method is setup this way because I wanted the classes that inherit from it to easily call it without having to re-write everything in it. Also, it requires an input of a planner type, so it can't just inherit from search. This can't be just templated on ompl::base::Planner either because each planner has a unique set of parameters, so using the planner type as an input makes more sense to me.

Comment on lines 42 to 68
/**
* @brief BGL solver implementation that constructs vertices and edges in the build function and uses Dijkstra's
* algorithm with a default visitor to search the graph
*/
template <typename FloatType>
class BGLOMPLRRTSolver : public BGLOMPLSolver<FloatType>
{
public:
using BGLOMPLSolver<FloatType>::BGLOMPLSolver;

SearchResult<FloatType> search() override;
};

using BGLOMPLRRTSolverF = BGLOMPLRRTSolver<float>;
using BGLOMPLRRTSolverD = BGLOMPLRRTSolver<double>;

template <typename FloatType>
class BGLOMPLRRTConnectSolver : public BGLOMPLSolver<FloatType>
{
public:
using BGLOMPLSolver<FloatType>::BGLOMPLSolver;

SearchResult<FloatType> search() override;
};

using BGLOMPLRRTConnectSolverF = BGLOMPLRRTConnectSolver<float>;
using BGLOMPLRRTConnectSolverD = BGLOMPLRRTConnectSolver<double>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should think about a way to make the specification of the search algorithm generic so we don't need to define new classes for every search algorithm we want to use. Depending on how exactly OMPL works, we could pass a search algorithm pointer into the constructor, or we could template this class on the type of search algorithm that should be used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One concern of mine is I'm not sure how many ompl algorithms will actually work with this setup, but I know RRT and RRTConnect do work.

Your point still stands that it would be nice if one could just pass the ompl planner type. Unfortunately each planner has it's own unique set of parameters, so we would realistically need to account for every planner similar to how it's done in Tesseract. I think a better solution is to provide a method to getSpaceInformation() and getMaxDistance() from the base OMPLSolver class, which would allow a user to create the own instantiation of an ompl planner which then could be used to call ompl_search. It would look exactly like what is done in the search() method in OMPLRRTSolver and OMPLRRTConnectSolver but since it requires an input I think it should be kept separate from 'search()'

max_dist_,
rung_to_rung_dist_);

dss_->setLongestValidSegmentFraction(0.5);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be parameterized?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I don't think this actually does anything in the context of how I have the DescartesStateSpace methods defined, but it is required for OMPL. Basically it takes the maximum extent from the state space and multiplies by this factor. Any segment longer than this is checked at intervals equal to this length. We only ever check from point A to point B in Descartes, so I just set this to be a high value. (It also cannot be 1.0 or 0.0)

@marrts
Copy link
Contributor Author

marrts commented Sep 13, 2021

I'm going to go ahead and convert this so that it doesn't have any boost dependencies, then I'll rebase off the re-organization that was recently merged. From there we can tackle some of your specific feedback points more directly.

@marrts
Copy link
Contributor Author

marrts commented Sep 14, 2021

Updated to remove all boost dependencies and rebased to emulate the new directory structure.

I think I fixed all of your minor code tidiness concerns and I addressed all of the minor change recommendations.

I made some more detailed comments and tried to address most of your concerns about how I was describing things. Hopefully it is more clear what the various functions do now.

The biggest questions out there are the issue of max_dist_ and rung_to_rung_dist_, and how we plan to move forward with handling the interface, whether we keep just the RRT and RRTConnect built-in ones like I have now or try to move towards some sort of templating or passing in a pointer to an ompl planner type.

@Levi-Armstrong
Copy link
Collaborator

@marip8, @marrts, and @colin-lewis-19 what is left for this to be merged?

@marrts
Copy link
Contributor Author

marrts commented Nov 3, 2021

The ompl planners crash when running the unit tests and I haven't been able to figure out why.

@Levi-Armstrong
Copy link
Collaborator

What is the current status of this MR?

@marrts
Copy link
Contributor Author

marrts commented Jul 3, 2023

I haven't looked at this in a while, and I'm not aware of any plans for anyone to actually use this. I think it can be closed, unless someone wants to do a little bit of clean up work to merge it in.

@Levi-Armstrong
Copy link
Collaborator

I haven't looked at this in a while, and I'm not aware of any plans for anyone to actually use this. I think it can be closed, unless someone wants to do a little bit of clean up work to merge it in.

Didn't this perform better than the BGL version?

@marrts
Copy link
Contributor Author

marrts commented Jul 3, 2023

Didn't this perform better than the BGL version?

It had some really positive results, but it can be finicky. In the application, with a really large search space, we originally had in mind for it we did not end up using it as I could never get that good of results. I think it needs some refinements. Usually it would either converge very fast to a feasible solution, or timeout trying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants