Customize Drive Session
Customize drive session
This tutorial will walk you through the process of creating a drive session with customized options to get advanced features.
Get started
A drive session can be created with optional components enabled to provide advanced navigation features:
* audio guidance prompts
* rich information for user location
* traffic information
* highway information
* traffic signs
* cameras
* turn and access restriction
* administrative information
* speed limits
* ADAS messages
* turn-by-turn guidance
* better route detection
Before creating a drive session, a foundation system and map content instance must be created.
Create a drive session with ADAS support only
Enable ADAS component at the creation of a drive session to make ADAS messages available during driving.
| // enable ADAS component at the creation of a drive session
tn::drive::DriveSessionOptions options;
options.enable_ADAS = true;
// for ADAS component to work correct, ADAS map data must be accessible via mapContent instance
// directionService instance is not needed for ADAS support only drive session
const auto driveSession = tn::drive::api::DriveSessionFactory::createDriveSession(
options, system, settings, mapContent, nullptr /* directionService */);
|
Enable map matching log output for debugging
Enable map matching log output at the creation of a drive session to get detailed information for debugging.
| // turn on map matching log output and set log path
const auto settings = tn::foundation::Settings::Builder()
.setString(tn::drive::api::SettingConstants::SETTING_POSITION_LOG_ENABLED, "true")
.setString(tn::drive::api::SettingConstants::SETTING_POSITION_LOG_PATH, "/path/to/log")
.build();
const auto driveSession = tn::drive::api::DriveSessionFactory::createDriveSession(
options, system, settings, mapContent, directionService);
|
Enable ADAS log output for debugging
Enable ADAS log output at the creation of a drive session to get detailed information for debugging.
| // turn on ADAS log output and set log path
const auto settings = tn::foundation::Settings::Builder()
.setString(tn::drive::api::SettingConstants::SETTING_ADAS_LOG_LEVEL, "3") // level 3 indicates all logs are outputted
.setString(tn::drive::api::SettingConstants::SETTING_ADAS_LOG_PATH, "/path/to/log")
.build();
// enable ADAS component at the creation of a drive session to make ADAS log output settings effective
tn::drive::DriveSessionOptions options;
options.enable_ADAS = true;
const auto driveSession = tn::drive::api::DriveSessionFactory::createDriveSession(
options, system, settings, mapContent, directionService);
|
Turn off data collection for analytics
Analytics data is collected by default to improve the TA SDK.
Once you implemented tn::foundation::Analytics
interface and set the instance via
tn::foundation::System::Builder::setAnalytics()
, drive session will collect and send analytics data
to the service specified by analytics instance.
You can turn it off at the creation of a drive session.
| const auto settings = tn::foundation::Settings::Builder()
.setString(tn::drive::api::SettingConstants::SETTING_DRIVE_ANALYTICS_COLLECTION, "false")
.build();
const auto driveSession = tn::drive::api::DriveSessionFactory::createDriveSession(
options, system, settings, mapContent, directionService);
|
Customize road graph detection distance
In drive session, there's a road graph built at run time to detect road condition changes around vehicle.
The detection distances are shared for detection of highway information, traffic incidents, traffic signs,
cameras, turn and access restrictions, administrative information changes and speed limits.
They can be customized to adjust the performance.
| const std::string roadGraphSettings = R"json(
{
// Following configuration shows the default values for detection distances
"RoadGraph":
{
// Maximum forward road detection distance in virtual road graph when vehicle is on highway, unit: meter.
// If road detection function is invoked, road graph builder will detect road with maximum length of this value.
"MaxAheadRouteDistance": 100000,
// Minimum forward road detection distance in virtual road graph when vehicle is on highway, unit: meter.
// If stored ahead route distance is less than this value, forward road detection will be invoked.
"MinAheadRouteDistance": 81000,
// Maximum forward road detection distance in virtual road graph when vehicle is on local road, unit: meter.
// If road detection function is invoked, road graph builder will detect road with maximum length of this value.
"MaxAheadRouteDistanceOnLocal": 7000,
// Minimum forward road detection distance in virtual road graph when vehicle is on local road, unit: meter.
// If stored ahead route distance is less than this value, forward road detection will be invoked.
"MinAheadRouteDistanceOnLocal": 5000,
// Backward road detection distance in virtual route graph, unit: meter.
// If previous route behind vehicle is less than this value, backward road detection will be invoked.
"PreviousRouteDistance": 5000
}
}
)json";
const auto settings = tn::foundation::Settings::Builder()
.setString(tn::drive::api::SettingConstants::SETTING_ALERT_JSON_CONTENT, roadGraphSettings)
.build();
// enable alert component at the creation of a drive session to make customized road graph settings effective
tn::drive::DriveSessionOptions options;
options.enable_alert = true;
const auto driveSession = tn::drive::api::DriveSessionFactory::createDriveSession(
options, system, settings, mapContent, directionService);
|