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

Builds up RoadGeometry out of parsed information. #40

Merged
merged 4 commits into from Dec 12, 2022

Conversation

francocipollone
Copy link
Contributor

@francocipollone francocipollone commented Oct 24, 2022

🎉 New feature

Related to #34

Summary

  • Brings Lane and Segment structs from maliput_osm given that they are not backend dependant
  • Creates a RoadGeometry loader that uses the parsed information(Filled up segment structs) and the builder api.
    • This implementation is brought from maliput_osm's road geometry builder as it is not backend dependant.
  • Propose an abstract Parser class that should be implemented by the backends, for parsing the correspondent underlying format and filling up the Lane and Segment structs.

This is a base proposal on #34, once this is given the thumbs up the code should be polished, tests should be changed/added and documentation should be added.

maliput/maliput_osm#30 matches these changes here added.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if it affects the public API)

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
@francocipollone
Copy link
Contributor Author

francocipollone commented Oct 24, 2022

As this is a proposal the code might change, however, the essence will remain, for so, I'd like a general review from you @agalbachicar on this.

The bottom line here is to move up to maliput_sparse all that is not backend dependent and that could easier the life to the backend's creators. maliput/maliput_osm#30 already shows how the implementation can be reduced to mainly just a parser for the underlying format and fill up some segment structs.

CC: @stonier

Copy link
Contributor

@agalbachicar agalbachicar left a comment

Choose a reason for hiding this comment

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

Some comments for discussion.

Comment on lines 56 to 57
/// Gets the segments parsed from the input description.
const std::unordered_map<Segment::Id, Segment>& GetSegments() const {return DoGetSegments();}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is a bit premature to move things here. This is an example of that. We would likely need also the Junction information and we are not even configuring other RoadNetwork entities (e.g. Intersections, Phases, etc.). The Parser should evolve to to provide all of them most likely.

I would refrain adding this class for the moment.

include/maliput_sparse/parser/lane.h Show resolved Hide resolved
#include "maliput_sparse/geometry/line_string.h"

namespace maliput_sparse {
namespace parser {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why change it to parser from loader?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was under maliput_osm/osm.

@francocipollone francocipollone marked this pull request as ready for review December 6, 2022 14:01
@francocipollone
Copy link
Contributor Author

Now that junctions are populated and the rest of the entities are also added to the road network I moved forwarded and continued this work.

This PR pairs with maliput/maliput_osm#30

@agalbachicar PTAL

@francocipollone
Copy link
Contributor Author

Once approved, I will fill up an issue for adding tests for the road network loader here proposed.

Copy link
Contributor

@agalbachicar agalbachicar left a comment

Choose a reason for hiding this comment

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

A few comments to go.

Comment on lines +44 to +49
/// Create a BuilderConfiguration from a string dictionary.
static BuilderConfiguration FromMap(const std::map<std::string, std::string>& config);

/// @details The keys of the map are listed at @ref builder_configuration_keys.
/// @returns A string-string map containing the builder configuration.
std::map<std::string, std::string> ToStringMap() const;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that we should make these free functions to keep the style of other repositories.
Consider deleting constructors if you want to enforce a specific way of contring from a map this struct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I am not seeing the full picture here, why make them free functions?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's a nit.
The comment was to keep PODs as structs or convert them to classes to have functions like these.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I see, thanks for the clarification. Let me move forward with this PR and create an issue for improving the style on 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.

#44

namespace maliput_sparse {
namespace loader {

class RoadGeometryLoader {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: missing class docstring.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

include/maliput_sparse/parser/lane.h Show resolved Hide resolved
Comment on lines 49 to 52
// The lanelet id.
std::string lane_id;
// The endpoint of the lanelet.
Which end;
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we add default values?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

bool operator==(const Segment& other) const { return id == other.id && lanes == other.lanes; }

/// Id of the segment.
Id id;
Copy link
Contributor

Choose a reason for hiding this comment

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

Add {} please.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
Copy link
Contributor

@agalbachicar agalbachicar left a comment

Choose a reason for hiding this comment

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

LGTM

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

Successfully merging this pull request may close these issues.

None yet

2 participants