跳转至

初始化与连接 / Initialization and Connection

说明 / Overview

API 初始化、版本查询、日志配置等接口,是所有算法接入的第一步
Interfaces for API initialization, version query, and logging configuration — the first step for all algorithm integrations.

SimOneServiceAPI.SoAPIGetVersion()

获取当前库的版本号

Retrieve the current API version number.

此函数用于获取API的当前版本号

This function is used to get the current version number of the API.

返回:

类型 描述
str

API的版本号

API version number.

SimOneServiceAPI.SoSetLogOut(logLevel, *args)

日志设置接口

Configure logging interface.

此函数用于配置日志系统的日志级别

This function is used to configure the log level of the logging system.

参数:

名称 类型 描述 默认
logLevel ESimOne_LogLevel_Type

日志级别

The log level.

必需
args

额外参数,用于配置日志系统

Additional arguments for configuring the logging system.

()

返回:

类型 描述
bool

执行结果:成功或失败

Execution outcome: success or failure.

SimOneServiceAPI.SoInitSimOneAPI(mainVehicleId='0', isFrameSync=0, serverIP='127.0.0.1', port=23789, startcase=0, stopcase=0, registerNodeId=0)

初始化SimOne API

Initialize SimOne API for autonomous driving algorithms.

此函数用于初始化SimOne API,用于自动驾驶算法的测试和模拟

This function is used to initialize the SimOne API for testing and simulating autonomous driving algorithms.

参数:

名称 类型 描述 默认
mainVehicleId str

主车ID,默认为'0'

Vehicle ID, default is '0'.

'0'
isFrameSync int

是否与SimOne同步帧,默认为0

Whether to synchronize frames with SimOne, default is 0.

0
serverIP str

BridgeIO服务器IP,默认为'127.0.0.1'

BridgeIO server IP, default is '127.0.0.1'.

'127.0.0.1'
port int

BridgeIO服务器端口,默认为23789

BridgeIO server port, default is 23789.

23789
startcase int

案例开始前调用的回调函数,默认为0

Callback function to be called before the case starts, default is 0.

0
stopcase int

案例结束后调用的回调函数,默认为0

Callback function to be called after the case ends, default is 0.

0
registerNodeId int

未使用,默认为0

Not in use, default is 0.

0

返回:

类型 描述
bool

执行结果:成功或失败

Execution outcome: success or failure.

SimOneServiceAPI.SoInitSimOneAPIWithTimeOut(mainVehicleId='0', isFrameSync=0, serverIP='127.0.0.1', port=23789, timeOutMS=-1, startcase=0, stopcase=0, registerNodeId=0)

初始化SimOne API 带超时

Initialize SimOne API for autonomous driving algorithm with timeout.

此函数用于带超时设置的初始化SimOne API,适用于自动驾驶算法测试和模拟

This function initializes the SimOne API with a timeout setting, suitable for testing and simulating autonomous driving algorithms.

参数:

名称 类型 描述 默认
mainVehicleId str

主车ID,默认为'0'

Vehicle ID, default is '0'.

'0'
isFrameSync int

是否与SimOne同步帧,默认为0

Whether to synchronize frames with SimOne, default is 0.

0
serverIP str

BridgeIO服务器IP,默认为'127.0.0.1'

BridgeIO server IP, default is '127.0.0.1'.

'127.0.0.1'
port int

BridgeIO服务器端口,默认为23789

BridgeIO server port, default is 23789.

23789
timeOutMS int

超时设置,默认为-1

Timeout setting, default is -1.

-1
startcase int

案例开始前调用的回调函数,默认为0

Callback function to be called before the case starts, default is 0.

0
stopcase int

案例结束后调用的回调函数,默认为0

Callback function to be called after the case ends, default is 0.

0
registerNodeId int

未使用,默认为0

Not in use, default is 0.

0

返回:

类型 描述
bool

执行结果:成功或失败

Execution outcome: success or failure.

SimOneServiceAPI.SoInitSimOneAPIEx(vehicle_ids, isFrameSync=0, serverIP='127.0.0.1', port=23789, startcase=0, stopcase=0, registerNodeId=0)

多车版本-初始化SimOne API

Initialize SimOne API for multi-vehicle version in autonomous driving algorithm.

此函数用于初始化SimOne API,适用于多车版本的自动驾驶算法测试和模拟

This function initializes the SimOne API for multi-vehicle version, suitable for testing and simulating autonomous driving algorithms.

参数:

名称 类型 描述 默认
vehicle_ids list

主车ID列表,必须为数字字符串

List of main vehicle IDs, must be digit strings.

必需
isFrameSync int

是否与SimOne同步帧,默认为0

Whether to synchronize frames with SimOne, default is 0.

0
serverIP str

BridgeIO服务器IP,默认为'127.0.0.1'

BridgeIO server IP, default is '127.0.0.1'.

'127.0.0.1'
port int

BridgeIO服务器端口,默认为23789

BridgeIO server port, default is 23789.

23789
startcase int

案例开始前调用的回调函数,默认为0

Callback function to be called before the case starts, default is 0.

0
stopcase int

案例结束后调用的回调函数,默认为0

Callback function to be called after the case ends, default is 0.

0
registerNodeId int

未使用,默认为0

Not in use, default is 0.

0

返回:

类型 描述
bool

执行结果:成功或失败

Execution outcome: success or failure.

SimOneServiceAPI.SoInitSimOneAPIExWithTimeOut(vehicle_ids, isFrameSync=0, serverIP='127.0.0.1', port=23789, timeOutMS=-1, startcase=0, stopcase=0, registerNodeId=0)

带超时的多车版本初始化SimOne API

Initialize SimOne API for multi-vehicle version with timeout in autonomous driving algorithm.

此函数用于带超时设置的多车版本SimOne API初始化,适用于自动驾驶算法的测试和模拟

This function initializes the SimOne API for multi-vehicle version with a timeout setting, suitable for testing and simulating autonomous driving algorithms.

参数:

名称 类型 描述 默认
vehicle_ids list

车辆ID列表,必须为数字字符串

List of vehicle IDs, must be digit strings.

必需
isFrameSync int

是否与SimOne同步帧,默认为0

Whether to synchronize frames with SimOne, default is 0.

0
serverIP str

BridgeIO服务器IP,默认为'127.0.0.1'

BridgeIO server IP, default is '127.0.0.1'.

'127.0.0.1'
port int

BridgeIO服务器端口,默认为23789

BridgeIO server port, default is 23789.

23789
timeOutMS int

超时设置,默认为-1

Timeout setting, default is -1.

-1
startcase int

案例开始前调用的回调函数,默认为0

Callback function to be called before the case starts, default is 0.

0
stopcase int

案例结束后调用的回调函数,默认为0

Callback function to be called after the case ends, default is 0.

0
registerNodeId int

未使用,默认为0

Not in use, default is 0.

0

返回:

类型 描述
bool

执行结果:成功或失败

Execution outcome: success or failure.

SimOneServiceAPI.SoTerminateSimOneAPI()

退出API服务

Stop SimOne API service.

此函数用于停止并退出SimOne API服务,适用于自动驾驶算法测试和模拟后的资源释放

This function is used to stop and exit the SimOne API service, suitable for releasing resources after testing and simulating autonomous driving algorithms.

返回:

类型 描述
bool

执行结果:成功或失败

Execution outcome: success or failure.