Implementing Trip and Order Progress involves working with several On-demand Rides and Deliveries Solution components -- Fleet Engine, the Consumer SDK, and the Driver SDK:
Fleet Engine is the On-demand Rides and Deliveries Solution backend service. It is responsible for managing trips and vehicle state. It handles transactions between the Driver SDK, the Consumer SDK, and your backend service -- which can communicate with the Fleet Engine by making either REST or gRPC calls.
The Driver SDK is a client library that you integrate into your driver app. It is responsible for updating the Fleet Engine with the driver’s location, route, distance remaining, and ETA. It also wraps the Navigation SDK, which provides turn-by-turn navigation instructions for the driver. For more information, see Navigation with Google Maps.
The following architecture diagram shows the relationship between these components:
Trips, vehicles, and waypoints
Creating a Trip and Order Progress application involves working with trips, vehicles, and waypoints.
A trip represents a journey -- the ride that transports the consumer (or the meal they ordered) from a pickup location to a drop-off location, including intermediate waypoints along the way.
object encapsulates a pickup location, a destination, the vehicle's
current location, the route to travel, intermediate waypoints, and
the trip type (either exclusive or shared).
A vehicle represents a vehicle in your fleet. Programmatically, a
object encapsulates the vehicle's location, a list of current trips,
and a list of current waypoints.
A waypoint represents a location along a route. It can be a pickup location, a
drop-off location, or a milestone just for passing through. Programmatically, a
object contains the waypoint's position as a set of geographic coordinates, the
type of waypoint, and the identifier of the trip that includes the waypoint.
Both trips and vehicles contain waypoints:
A trip's set of waypoints contains all waypoints relevant to the trip. It may include waypoints for other trips if a the trip is shared with other trips.
A vehicle's set of waypoints contains all remaining waypoints for the vehicle, including waypoints for multiple trips.
The following diagram shows the typical trip and order progress flow. For more information, see Create and Display a Single Destination Trip.
The following steps describe how to set up the sample flow:
Create a vehicle, enable location sharing, and then set the vehicle state to online. You create vehicles through Fleet Engine. You can set the vehicle state to online either via the Fleet Engine, or via the Driver SDK.
Match a customer to your vehicle. You can use the
SearchVehicles()method to find a list of potential vehicles from your fleet.
Create a trip in Fleet Engine, assign the vehicle to that trip, associate that trip with the consumers app, and give the driver the pickup and drop-off locations.
The Driver SDK automatically updates the ETA, distance, and route during the trip. You are responsible for updating the trip status.
To begin implementing Trip and Order Progress, see Create and Display a Single Destination Trip.