-
Notifications
You must be signed in to change notification settings - Fork 320
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
NAVAND-714 - Added Waypoints to NavigationRoute; - RouteOptionsUpdater refactored; #6005
NAVAND-714 - Added Waypoints to NavigationRoute; - RouteOptionsUpdater refactored; #6005
Conversation
1c8ac6d
to
4caf1be
Compare
ee11d88
to
1f91ae4
Compare
Codecov Report
@@ Coverage Diff @@
## main #6005 +/- ##
============================================
- Coverage 70.35% 70.22% -0.13%
- Complexity 4913 4914 +1
============================================
Files 718 722 +4
Lines 27980 28023 +43
Branches 3299 3303 +4
============================================
- Hits 19685 19680 -5
- Misses 7017 7068 +51
+ Partials 1278 1275 -3
|
libnavigation-base/src/main/java/com/mapbox/navigation/base/internal/route/Waypoint.kt
Outdated
Show resolved
Hide resolved
c2936a0
to
fcb5e56
Compare
fcb5e56
to
1cef0e9
Compare
libnavigation-base/src/main/java/com/mapbox/navigation/base/route/NavigationRoute.kt
Outdated
Show resolved
Hide resolved
Which ticket is it? |
Added ticket in the title |
A more general concern: RouteProgress is public API. And it has
|
BillingController uses |
libnavigation-base/src/main/java/com/mapbox/navigation/base/internal/extensions/WaypointEx.kt
Outdated
Show resolved
Hide resolved
libnavigation-base/src/main/java/com/mapbox/navigation/base/internal/extensions/WaypointEx.kt
Show resolved
Hide resolved
libnavigation-base/src/main/java/com/mapbox/navigation/base/internal/extensions/WaypointEx.kt
Outdated
Show resolved
Hide resolved
libnavigation-base/src/main/java/com/mapbox/navigation/base/internal/utils/DirectionsRouteEx.kt
Outdated
Show resolved
Hide resolved
libnavigation-base/src/main/java/com/mapbox/navigation/base/route/NavigationRoute.kt
Outdated
Show resolved
Hide resolved
mutableListOf<Double?>().also { | ||
it.addAll( | ||
radiusesList.subList( | ||
nextCoordinateIndex - 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it guaranteed somewhere that nextCoordinateIndex is > 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nextCoordinateIndex
is receiving from indexOfNextRequestedCoordinate
, which is always return value between [1; size_of_waypoint_list) (null is also possible, but it filtered out)
libnavigation-core/src/main/java/com/mapbox/navigation/core/routeoptions/RouteOptionsUpdater.kt
Outdated
Show resolved
Hide resolved
libnavigation-base/src/main/java/com/mapbox/navigation/base/internal/extensions/WaypointEx.kt
Outdated
Show resolved
Hide resolved
libnavigation-base/src/main/java/com/mapbox/navigation/base/internal/route/Waypoint.kt
Outdated
Show resolved
Hide resolved
import com.mapbox.geojson.Point | ||
|
||
data class Waypoint( | ||
val location: Point, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val location: Point, | |
val directionsWaypoint: DirectionsWaypoint?, |
This would be handy instead of copying the location/name data. It could be null
for silent waypoints or we could have sealed classes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you mean fakeing DirectionsWaypoint
based on Waypoint
instance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need be faking them, we can be finding them in the route response object depending on the index.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't always have DirectionsWaypoint
: for instance, we don't have it when creating NavigationRoute based on DirecionsRoute(s) and a Waypoint
object is created based on the NN's Waypoint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, let's revisit later if needed.
libnavigation-base/src/main/java/com/mapbox/navigation/base/internal/utils/RouterEx.kt
Outdated
Show resolved
Hide resolved
libnavigation-base/src/main/java/com/mapbox/navigation/base/route/NavigationRoute.kt
Outdated
Show resolved
Hide resolved
@@ -379,7 +380,7 @@ internal class MapboxTripSession( | |||
} | |||
|
|||
private fun calculateRemainingWaypoints(tripStatus: TripStatus): Int { | |||
val routeCoordinates = tripStatus.route?.routeOptions?.coordinatesList() | |||
val routeCoordinates = tripStatus.route?._waypoints() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would now also report silent waypoints which is a breaking change. It should only report regular and EV waypoints, so actually the ones that create legs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why it's breaking changes? We haven't had EV waypoints, as they appeared, now is a part of the API if anybody uses it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm talking about silent waypoints. They are not really waypoints and should not be part of the remaining waypoints count.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch
@LukasPaczos wait a sec, the line tripStatus.route?.routeOptions?.coordinatesList()
also take into account silent waypoints 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, silent and Ev waypoints are under NavigationStatus#getNextWaypointIndex
(which is root of the remainingWaypoints
value)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe take a look at #6005 (comment), I think it's related to this discussion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's rather confusing that we call this a remainingWaypoint
when a silent waypoint is not truly a waypoint in the Directions API terminology.
I'm worried that if someone used to use remainingWaypoints
to compare it with RouteOptions#coordinates
(as that's the only practical usage because remainingWaypoints
contains silent waypoints) then the proposed change will break that logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from the SDK side, it seems like not a breaking change, it might be a misunderstanding between the SDK docs and customers. Let's considered it in the API doc and add the warning to the changelog. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, this is fine, refs #6005 (comment). But I agree that we should add a note in the docs that remainingWaypoints
now might include more than requested waypoints if EV is used.
1cef0e9
to
faa2cc7
Compare
if we are speaking about
The Waypoint class is internal itself so we're good to experiment and change it.
great catch actually. I would say it should be switched to the |
We can switch the billing controller to use |
libnavigation-base/src/main/java/com/mapbox/navigation/base/internal/extensions/WaypointEx.kt
Outdated
Show resolved
Hide resolved
} | ||
} | ||
) | ||
.approachesList( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approaches should be specified per waypoint, not per coordinate (capturing from https://docs.mapbox.com/api/navigation/directions/#optional-parameters), so it should use getUpdatedWaypointsList
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can address separately, let's cut a ticket.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAVAND-834
Sorry, this always surprises me time and time again that |
.waypointIndicesList( | ||
getUpdatedWaypointIndicesList( | ||
routeOptions.waypointIndicesList(), | ||
coordinatesList.size - remainingWaypoints - 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this really correspond to nextCoordinateIndex?
No, I was talking about
Again, I was talking about
Requested waypoints and all waypoints? I don't know how they are used now. As far as I understood from the ticket description, the problem is that now in the response we may have more waypoints than in the request. Who knows hot this data will be used by users, why not expose both numbers?
Nah, not really. Let's leave as is. |
I would say that for now, we can keep it as is, and if the we also need utils methods for us and customers to work with waypoints, as it's always a challenge to handle them right (for instance getNextRequestedCoordinate might be hard to make on the application side) @LukasPaczos I think it's a typo in the doc, shouldn't be silent, right? Lines 395 to 403 in 934e668
|
Yes 👍 |
bf165b5
to
f3efe77
Compare
f3efe77
to
ee210c1
Compare
latest updates:
|
libnavigation-base/src/main/java/com/mapbox/navigation/base/internal/extensions/WaypointEx.kt
Outdated
Show resolved
Hide resolved
libnavigation-base/src/main/java/com/mapbox/navigation/base/internal/extensions/WaypointEx.kt
Outdated
Show resolved
Hide resolved
libnavigation-base/src/main/java/com/mapbox/navigation/base/internal/extensions/WaypointEx.kt
Outdated
Show resolved
Hide resolved
} | ||
} | ||
) | ||
.approachesList( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can address separately, let's cut a ticket.
libnavigation-core/src/main/java/com/mapbox/navigation/core/trip/session/MapboxTripSession.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but it'd be great to add an instrumentation test that verifies a re-route with EV routes.
CHANGELOG.md
Outdated
@@ -9,6 +9,8 @@ Mapbox welcomes participation and contributions from everyone. | |||
- Fixed an issue with `NavigationView` that caused road label position to not update in some cases. [#6508](https://github.com/mapbox/mapbox-navigation-android/pull/6508) | |||
- Fixed an issue where the SDK was trying to send telemetry events when telemetry is switched off globally. [#6512](https://github.com/mapbox/mapbox-navigation-android/pull/6512) | |||
|
|||
:warning: `RouteProgress#remainingWaypoints` defines the amount of all remaining waypoints, including explicit (requested with `RouteOptions#coordinatesList`) and implicit (added on the fly, like Electric Vehicle waypoints - [see](https://docs.mapbox.com/api/navigation/directions/#electric-vehicle-routing)) ones. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:warning: `RouteProgress#remainingWaypoints` defines the amount of all remaining waypoints, including explicit (requested with `RouteOptions#coordinatesList`) and implicit (added on the fly, like Electric Vehicle waypoints - [see](https://docs.mapbox.com/api/navigation/directions/#electric-vehicle-routing)) ones. | |
- Fixed an issue where re-routes could have failed for EV routes. [#6005](https://github.com/mapbox/mapbox-navigation-android/pull/6005) | |
- :warning: `RouteProgress#remainingWaypoints` defines the amount of all remaining waypoints, including explicit (requested with `RouteOptions#coordinatesList`) and implicit (added on the fly, like Electric Vehicle waypoints - [see](https://docs.mapbox.com/api/navigation/directions/#electric-vehicle-routing)) ones. |
we can address separately when creating the changelog cc @Guardiola31337
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're adding the test above then it'd be good to address this as well.
Oh, I was going to add the test in https://mapbox.atlassian.net/browse/NAVAND-775. It's about alternatives but there is no basic test. It would be real nice if it appeared. :) |
0636da9
to
4fcb206
Compare
4fcb206
to
8270348
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be in a good place with the implementation (and unit tests) and this lands only in the alpha but let's prioritize the instrumentation tests right after this.
|
Description