Architecture and components

Implementing Shipment Tracking involves working with several Last Mile Fleet Solution components -- Fleet Engine, the JavaScript Shipment Tracking Library, and the Driver SDK:

  • Fleet Engine is the Last Mile Fleet Solution backend service. It is responsible for managing tasks and vehicle state. It handles the interaction between the Driver SDK, the JavaScript Shipment Tracking Library, and your backend service -- which can communicate with the Fleet Engine by making either REST or gRPC calls.

  • You can integrate the JavaScript Shipment Tracking Library into your consumer app. It lets you provide your customers with a visualization of the vehicle's location, along with its ETA.

  • The Driver SDK is a 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 integrates with the Navigation SDK, which provides turn-by-turn navigation instructions for the driver. For more information, see Navigation with Google Maps.

The following diagram shows the relationship between these components:

Architecture

Delivery vehicles and tasks

Creating a Shipment Tracking application to model the pickup and delivery of shipments involves:

  • The delivery vehicle used to transport the shipment.
  • The shipment pickup and delivery tasks

Delivery Vehicles

Delivery vehicles transport shipments from a depot to a delivery location, and from a pickup location to the depot. In certain cases, they may also transport a shipment directly from the pickup location to the delivery location.

Tasks

Each vehicle has tasks assigned to it. These can include pickup or delivery tasks, required breaks for drivers, or scheduled stops at drop boxes or other locations. Each task must have a unique task ID, but may share the same tracking ID. The tasks and the order in which they are scheduled are used to calculate ETAs for each task.

Shipment tasks are related to the pickup or the dropoff of the shipment. You must specify a tracking number or ID when you create a shipment task. You must also specify a dwell time to account for additional time to complete the task, look for parking, or walk to the handoff location.

  • Create a pickup task for picking up a shipment, specifying the pickup location and tracking number or ID.
  • Create a delivery task for delivering a shipment, specifying the delivery location and tracking number or ID.

You can also create an unavailability task for a time period when the vehicle will not be available for pickups or deliveries, and scheduled stop tasks to model stops to be made by a delivery vehicle. However, you can't assign a tracking_id to an unavailability task or scheduled stop. As a result, you can't directly perform shipment tracking on an unavailability task or scheduled stop.

Sample flow

The following sequence diagram shows the typical shipment tracking flow.

Flow Diagram

To begin implementing Shipment Tracking, see Track shipments with the JavaScript Shipment Tracking Library .