初始化与连接 Initialization¶
说明 / Overview
API 初始化、版本查询、日志配置等接口,是所有算法接入的第一步。
Interfaces for API initialization, version query, and logging configuration — the first step for all algorithm integrations.
InitSimOneAPI¶
bool InitSimOneAPI(const char *mainVehicleId="0", bool isFrameSync=false, const char *serverIP="127.0.0.1", int port=23789, void(*startCase)()=0, void(*endCase)()=0, int registerNodeId=0)
初始化SimOne API
Initialize the SimOne API.
此函数用于启动SimOne API,适用于自动驾驶算法的初始化
This function is used to start the SimOne API, suitable for initializing autonomous driving algorithms.
Parameters:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
mainVehicleId |
const char * |
主机车辆ID(范围从0到9) Host vehicle ID (ranging from 0 to 9). |
"0" |
isFrameSync |
bool |
是否同步帧 Whether to synchronize frames. |
false |
serverIP |
const char * |
BridgeIO服务器IP地址 BridgeIO server IP address. |
"127.0.0.1" |
port |
int |
BridgeIO服务器端口号 BridgeIO server port number. |
23789 |
startCase |
void(*)() |
案例开始前调用的回调函数 Callback function called before the case starts. |
— |
endCase |
void(*)() |
案例结束后调用的回调函数 Callback function called after the case ends. |
— |
registerNodeId |
int |
注册节点ID(当前未使用) Register node ID (currently not in use). |
0 |
Returns:
| 类型 | 描述 |
|---|---|
bool |
成功初始化返回true,否则返回false Returns true if initialization is successful, false otherwise. |
InitSimOneAPIEx¶
bool InitSimOneAPIEx(char **mainVehicleIdList, int count, bool isFrameSync=false, const char *serverIP="127.0.0.1", int port=23789, void(*startCase)()=0, void(*endCase)()=0, int registerNodeId=0)
多车版本-初始化SimOne API
Initialize the SimOne API for the multi-vehicle version.
此函数用于多车版本的SimOne API初始化,适合自动驾驶算法
This function is used for the initialization of the multi-vehicle version of the SimOne API, suitable for autonomous driving algorithms.
Parameters:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
mainVehicleIdList |
char ** |
主车辆ID列表 List of main vehicle IDs. |
— |
count |
int |
主车辆ID数量 Number of main vehicle IDs. |
— |
isFrameSync |
bool |
是否进行帧同步 Whether to perform frame synchronization. |
false |
serverIP |
const char * |
BridgeIO服务器IP地址 BridgeIO server IP address. |
"127.0.0.1" |
port |
int |
BridgeIO服务器端口号 BridgeIO server port number. |
23789 |
startCase |
void(*)() |
案例开始前的回调函数 Callback function called before the case starts. |
— |
endCase |
void(*)() |
案例结束后的回调函数 Callback function called after the case ends. |
— |
registerNodeId |
int |
注册节点ID(当前未使用) Register node ID (currently not in use). |
0 |
Returns:
| 类型 | 描述 |
|---|---|
bool |
成功初始化返回true,否则返回false Returns true if initialization is successful, false otherwise. |
InitSimOneAPIWithTimeOut¶
bool InitSimOneAPIWithTimeOut(const char *mainVehicleId="0", bool isFrameSync=false, const char *serverIP="127.0.0.1", int port=23789, int timeOutMS=-1, void(*startCase)()=0, void(*endCase)()=0, int registerNodeId=0)
初始化SimOne API 带超时
Initialize the SimOne API with timeout.
此函数用于带超时的SimOne API初始化,适合自动驾驶算法
This function initializes the SimOne API with a timeout, suitable for autonomous driving algorithms.
Parameters:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
mainVehicleId |
const char * |
主机车辆ID(从0到9) Host vehicle ID (from 0 to 9). |
"0" |
isFrameSync |
bool |
是否进行帧同步 Whether to perform frame synchronization. |
false |
serverIP |
const char * |
BridgeIO服务器IP地址 BridgeIO server IP address. |
"127.0.0.1" |
port |
int |
BridgeIO服务器端口号 BridgeIO server port number. |
23789 |
timeOutMS |
int |
超时时间,以毫秒为单位 Timeout duration in milliseconds. |
-1 |
startCase |
void(*)() |
案例开始前的回调函数 Callback function called before the case starts. |
— |
endCase |
void(*)() |
案例结束后的回调函数 Callback function called after the case ends. |
— |
registerNodeId |
int |
注册节点ID(当前未使用) Register node ID (currently not in use). |
0 |
Returns:
| 类型 | 描述 |
|---|---|
bool |
成功初始化返回true,否则返回false Returns true if initialization is successful, false otherwise. |
InitSimOneAPIExWithTimeOut¶
bool InitSimOneAPIExWithTimeOut(char **mainVehicleIdList, int count, bool isFrameSync=false, const char *serverIP="127.0.0.1", int port=23789, int timeOutMS=-1, void(*startCase)()=0, void(*endCase)()=0, int registerNodeId=0)
多车版本 - 初始化SimOne API 带超时
Initialize the SimOne API with timeout for the multi-vehicle version.
此函数用于多车版本的SimOne API初始化,并包含超时设置,适用于自动驾驶算法
This function is used for the initialization of the multi-vehicle version of the SimOne API with a timeout setting, suitable for autonomous driving algorithms.
Parameters:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
mainVehicleIdList |
char ** |
主车辆ID列表 List of main vehicle IDs. |
— |
count |
int |
主车辆ID的数量 Number of main vehicle IDs. |
— |
isFrameSync |
bool |
是否进行帧同步 Whether to perform frame synchronization. |
false |
serverIP |
const char * |
BridgeIO服务器IP地址 BridgeIO server IP address. |
"127.0.0.1" |
port |
int |
BridgeIO服务器端口号 BridgeIO server port number. |
23789 |
timeOutMS |
int |
超时时间(毫秒) Timeout duration in milliseconds. |
-1 |
startCase |
void(*)() |
案例开始前的回调函数 Callback function called before the case starts. |
— |
endCase |
void(*)() |
案例结束后的回调函数 Callback function called after the case ends. |
— |
registerNodeId |
int |
注册节点ID(当前未使用) Register node ID (currently not in use). |
0 |
Returns:
| 类型 | 描述 |
|---|---|
bool |
成功初始化返回true,否则返回false Returns true if initialization is successful, false otherwise. |
TerminateSimOneAPI¶
bool TerminateSimOneAPI()
退出API节点
Exit the API node.
此函数用于停止并退出SimOne API节点
This function is used to stop and exit the SimOne API node.
Returns:
| 类型 | 描述 |
|---|---|
bool |
成功停止返回true,否则返回false Returns true if successfully stopped, false otherwise. |