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

Initial draft of changes for online map / planner updates #12

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from

Conversation

meychr
Copy link
Contributor

@meychr meychr commented May 2, 2021

Do not merge!

The original changes I hacked together to get things working, we can use this to start the discussion about how to implement this feature properly.

@meychr meychr marked this pull request as draft May 2, 2021 15:06
grid_map_msg_sub_topic: /se2_grid_map_generator_node/grid_map
grid_map_msg_pub_topic: state_validator/grid_map
grid_map_obstacle_layer_name: traversability
grid_map_state_validity_checking_method: traversability # see GridMapLazyStateValidator.hpp for list of available methods
Copy link
Collaborator

@jelavice jelavice May 3, 2021

Choose a reason for hiding this comment

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

What is this parameter exactly? (grid_map_state_validity_checking_method)

@@ -15,6 +15,8 @@

namespace se2_planning {

enum StateValidityCheckingMethod : int { COLLISION = 0, TRAVERSABILITY = 1, ROBUST_TRAVERSABILITY = 2 };
Copy link
Collaborator

Choose a reason for hiding this comment

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

ah okay, I see it now. But we need to explain a bit what is behind these methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I have just left all methods there that we can discuss/check what is actually useful. Improving the documentation is important for that, sounds good!

void setStateValidityCheckingMethod(StateValidityCheckingMethod value);
StateValidityCheckingMethod getStateValidityCheckingMethod() const;

void setStateValidityThreshold(double value);
Copy link
Collaborator

Choose a reason for hiding this comment

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

we need to explain what is that threshold. e.g. cell value < threshold is considered valid.

const std::string& obstacleLayer);
std::unique_ptr<GridMapLazyStateValidator> createGridMapLazyStateValidator(
const grid_map::GridMap& gridMap, const RobotFootprint& footprint, const std::string& obstacleLayer,
const StateValidityCheckingMethod& stateValidityCheckingMethod, const double stateValidityThreshold,
Copy link
Collaborator

Choose a reason for hiding this comment

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

do all methods require all of these parameters? e.g. if I just use the obstacle 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.

No, you are right, this should probably be organized differently. The stateValidityThreshold is used by all three functions, the unsafeTraversabilityThreshold and maxNumberOfUnsafeCells is only used by the robust traversability function.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, I think we should remove the functions that are not used from the function calls.

initialize();
ompl::base::StateSpacePtr space = simpleSetup_->getStateSpace();
auto bounds = space->as<ompl::base::SE2StateSpace>()->getBounds();
// std::cout << "OmplReedsSheppPlanner: Planner state space bounds: x = [" << bounds.low[0] << ", " << bounds.high[0] << "], y=["
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do we need lines 56-59?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The initialize() call is necessary to set the new state space boundaries in the planner, lines 57-59 were just for debugging to check that the state space is updated correctly.

Copy link
Collaborator

Choose a reason for hiding this comment

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

But I think we can just set the new boundaries. There is even a public method for that. We don't need to create the new state space from scratch (which is what these methods will do in the end). Did you ever try that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adapted in db4a618. Is it correct to define the setStateSpaceBoundaries as virtual in the OmplPlanner header file and implement it in the source file? Would you solve it differently?

double gridMapStateValidityThreshold_ = 0.5;
double gridMapUnsafeStateValidityThreshold_ = 0.5;
int gridMapMaxNumberOfUnsafeCells_ = 0;
double gridMapResolution_ = 0.2;
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do we need these parameters (resolution, map position etc.)? GridMapLazyStateValidator will receive a map anyway over ROS if I understand correctly. Should that be enough to initialize them?

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 have to think about it again. The original idea was that it is possible to define the resolution independent of the provided map (downsample it if needed, does not have to be in the node, could happen outside). The rest is probably just there because it was convenient in the beginning.

Copy link
Contributor Author

@meychr meychr Jun 7, 2021

Choose a reason for hiding this comment

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

Ok, finally tried that out. The issue is that the GridMapLazyStateValidator precomputes footprint points in its initialize function (GridMapLazyStateValidator::initialize()). This requires that a map is set and uses it geometry to calculate the footprint points. I think that was also the reason why I changed the validation function.
Could you explain what the point is behind the computeFootprintPoints function? Maybe we can set it up differently to avoid initializing some random map.

@tomlankhorst tomlankhorst added the enhancement New feature or request label May 31, 2021
@@ -129,6 +168,121 @@ bool isInCollision(const SE2state& state, const std::vector<Vertex>& footprint,
return false;
}

// TODO Not working with updated state space bounds
Copy link
Collaborator

Choose a reason for hiding this comment

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

what fails here? This approach that is commented out is significantly faster as opposed to using grid_map iterators. We should try to keep it!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With the current implementation of isInCollision and isTraversable, I get the strange behavior that along the x-axis the state validator accepts all possible positions, along the y-axis only the ones that lie in the map.

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

Successfully merging this pull request may close these issues.

None yet

3 participants