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

feat(routing): use graphhopper to provide GTFS based public transport routing #441

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

kschrab
Copy link
Contributor

@kschrab kschrab commented Nov 29, 2024

Description

A new routing interface for finding public transport routes.

Open issues:

  • test with larger GTFS
  • approve graphhopper-reader-gtfs
  • approve io.mobilitydata.transit:gtfs-realtime-bindings
  • approve org.mapdb:mapdb
  • approve javacsv - it's LGPL and I cannot find its source code :( approve opencsv

Issue(s) related to this PR

  • Partly resolves internal issue 955

Affected parts of the online documentation

Changes in the documentation required?

Definition of Done

Prerequisites

  • You have read CONTRIBUTING.md carefully.
  • You have signed the Contributor License Agreement.
  • Your GitHub user id is linked with your Eclipse Account.

Required

  • The title of this merge request follows the scheme type(scope): description (in the style of Conventional Commits)
  • You have assigned a suitable label to this pull request (e.g., enhancement, or bugfix)
  • origin/main has been merged into your Fork.
  • Coding guidelines have been followed (see CONTRIBUTING.md).
  • All checks on GitHub pass.
  • All tests on Jenkins pass.

Requested (can be enforced by maintainers)

  • New functionality is covered by unit tests or integration tests. Code coverage must not decrease.
  • If a bug has been fixed, a new unit test has been written (beforehand) to prove misbehavior
  • There are no new SpotBugs warnings.

Special notes to reviewer

Copy link
Contributor

@schwepmo schwepmo left a comment

Choose a reason for hiding this comment

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

Nice new feature! However, I think there is some refactoring necessary before merging this PR.

@@ -83,11 +87,22 @@ public class CentralNavigationComponent {
*/
private Routing routing;


/**
* Public Transport routing
Copy link
Contributor

Choose a reason for hiding this comment

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

Checkstyle would probably like a dot here :D

* Configuration options for route calculation via public transport.
* Requires paths to OSM and GTFS files.
*/
public CPublicTransportRouting publicTransportConfiguration = new CPublicTransportRouting();
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 little bit confusing that we define default configs for the perception and publicTransportRouting but not for the navigationConfiguration

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They both now have default configs.

@@ -20,7 +20,7 @@
/**
* Base Class for the navigation configuration.
*/
public class CRouting implements Serializable {
public class CVehicleRouting implements Serializable {

/**
* The source for the route calculation, e.g. the path to the database containing the road network.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* The source for the route calculation, e.g. the path to the database containing the road network.
* The source for the route calculation, e.g., the path to the database containing the road network.

private WalkLeg walkLeg = null;

//For legs where a vehicle already exists
private String carID = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
private String carID = null;
private String carId = null;

//For legs where a vehicle needs to be spawned
private VehicleDeparture vehicleLeg = null;

//For PTlegs
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment isn't really explaining much and can be formatted nicer

Suggested change
//For PTlegs
// For {@link PtLeg PtLegs}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Improved javadoc a lot here

return scheduleDateTime.plusNanos(simTime).atZone(timeZone).toInstant();
}

private Long fromScheduleTime(Date date) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
private Long fromScheduleTime(Date date) {
private Long fromScheduleTime(@Nonnull Date date) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Erm, you mean @Nullable? The method is able to handle the null case.

).createWithoutRealtimeFeed();
}


Copy link
Contributor

Choose a reason for hiding this comment

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

Remove some blank lines here

return scheduleDateTime.until(LocalDateTime.ofInstant(instant, timeZone), ChronoUnit.NANOS);
}

public void close() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to never 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.

Now it does

@kschrab
Copy link
Contributor Author

kschrab commented Dec 11, 2024

@schwepmo I also added a small UNITS class for conversion of kmh to meters per second

@kschrab kschrab requested a review from schwepmo December 11, 2024 13:11
@kschrab kschrab added the enhancement New feature or request label Dec 11, 2024
@kschrab kschrab force-pushed the 955-public-transport-routing branch from a8aaca0 to 3e0229a Compare December 11, 2024 13:51
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.

2 participants