Skip to main content

Customize the vehicle profile

The CoPilot Native Nav SDK uses a collection of settings called a Vehicle Routing Profile to generate an optimal route based on the size and type of vehicle, as well as your preferences for how that vehicle should be routed.

Routing profiles include default profiles, which are created by Trimble Maps based on the most common types of commercial vehicles, and custom profiles. To fetch all routing profiles Import RoutingProfilesPlugin at the top of this file:

Import RoutingProfilesPlugin

@Published var companyProfiles: [Profile]

 TMFleetRoutingProfilesClient.shared.fetchFleetRoutingProfiles() { result,error in
                guard let result = result else {
                    self.logger.debug("Error fetching fleet profiles: \(String(describing:error))")
                    return
                }
                self.companyProfiles = result.convertToRoutingProfiles()

If you want to select a specific profile for your trip, you can use trip.routingProfile = profile in your ContentView.

let routingProfilesModel = RoutingProfilesModel()
let routeProfiles = RoutingProfiles(model: routingProfilesModel, profileSelected: { profile in
print(profile)
})

Custom Profiles

The sample code below shows how to retrieve default profiles from the Account Manager web tool and assign the first one to the trip:

var routingProfiles: [Profile]
TMFleetRoutingProfilesClient.shared.fetchFleetRoutingProfiles() { result,error in
                guard let result = result else {
                    self.logger.debug("Error fetching fleet profiles: \(String(describing:error))")
                    return
                }
                self.routingProfiles = result.convertToRoutingProfiles()
            }

Routing Options Constants

Throughout the Profile/Options builder, a lot of the parameters are expecting one of the constants set in the RoutingOptions class. These are broken down into a series of subclasses.

VehicleType

routeOptions.vehicleType.TRUCK
routeOptions.vehicleType.AUTO
routeOptions.vehicleType.LIGHT_TRUCK
routeOptions.vehicleType.MIDSIZE_TRUCK
routeOptions.vehicleType.BUS

Hazardous Materials

routeOptions.hazMat.NONE
routeOptions.hazMat.GENERAL
routeOptions.hazMat.CAUSTIC
routeOptions.hazMat.EXPLOSIVES
routeOptions.hazMat.FLAMMABLE
routeOptions.hazMat.INHALANTS
routeOptions.hazMat.HARMFUL_TO_WATER
routeOptions.hazMat.TUNNEL

Tunnel Category

routeOptions.tunnelCategory.NONE
routeOptions.tunnelCategory.BCDE
routeOptions.tunnelCategory.CDE
routeOptions.tunnelCategory.DE
routeOptions.tunnelCategory.LE

Toll Roads

routeOptions.tollRoads.USE
routeOptions.tollRoads.AVOID_IF_POSSIBLE
routeOptions.tollRoads.ALWAYS_AVOID

Ferry

routeOptions.ferries.USE
routeOptions.ferries.DISCOURAGE

Route Type

routeOptions.routeType.PRACTICAL
routeOptions.routeType.SHORTEST
routeOptions.routeType.FASTEST

Last updated March 28, 2025.