SimOnePNCAPI module¶
- SimOnePNCAPI.SoRegisterVehicleState(mainVehicleId: str, data: list, size: int) bool[源代码]¶
注册主车状态信息(超出SimOne_Data_Gps范围)
Register additional vehicle state information beyond what is included in SimOne_Data_Gps.
示例
states = [ESimOne_Data_Vehicle_State.SPEED] SoRegisterVehicleState("MainVehicle", states, len(states))
- SimOnePNCAPI.SoGetVehicleState(mainVehicleId: str, data: SimOne_Data_Vehicle_Extra) bool[源代码]¶
获取通过SoRegisterVehicleState注册的主车状态信息
Retrieve vehicle states registered with SoRegisterVehicleState.
- 参数:¶
- mainVehicleId: str¶
车辆ID / Vehicle ID
- data : SimOne_Data_Vehicle_Extra¶
主车动态状态信息 / Vehicle state information
- 返回:¶
执行结果:成功或失败 / Success or failure
- 返回类型:¶
示例
extra_state = SimOne_Data_Vehicle_Extra() SoGetVehicleState("MainVehicle", extra_state)
- SimOnePNCAPI.SoSetPose(mainVehicleId: str, poseControl: SimOne_Data_Pose_Control) bool[源代码]¶
设置主车位置
Set the next position of the main vehicle.
- 参数:¶
- mainVehicleId: str¶
车辆ID / Vehicle ID
- poseControl : SimOne_Data_Pose_Control¶
下一个车辆位置 / Next vehicle position
- 返回:¶
执行结果:成功或失败 / Success or failure
- 返回类型:¶
示例
pose = SimOne_Data_Pose_Control() pose.position.x = 10.0 pose.position.y = 20.0 SoSetPose("MainVehicle", pose)
- SimOnePNCAPI.SoSetDrive(mainVehicleId: str, driveControl: SimOne_Data_Control) bool[源代码]¶
主车控制
Control the main vehicle using throttle, steering, and brake.
- 参数:¶
- mainVehicleId: str¶
车辆ID / Vehicle ID
- driveControl : SimOne_Data_Control¶
车辆驾驶参数 / Driving parameters
- 返回:¶
执行结果:成功或失败 / Success or failure
- 返回类型:¶
示例
control = SimOne_Data_Control() control.throttle = 0.5 control.steering = 0.1 SoSetDrive("MainVehicle", control)
- SimOnePNCAPI.SoSetDriveTrajectory(mainVehicleId: str, controlTrajectory: SimOne_Data_Control_Trajectory) bool[源代码]¶
主车控制 - 按轨迹驾驶
Drive the vehicle along a planned trajectory.
- SimOnePNCAPI.SoSetDriverName(mainVehicleId: str, driverName: str) bool[源代码]¶
设置主车控制器的名字
Set the name of the vehicle controller (max length 8 chars).
- SimOnePNCAPI.SoSetDriveMode(mainVehicleId: str, driverMode: ESimOne_Drive_Mode) bool[源代码]¶
设置主车控制模式
Set the driving mode of the vehicle dynamics.
模式包括 / Modes include:
ESimOne_Drive_Mode_API: 通过API控制模块驾驶 / Driving by API
ESimOne_Drive_Mode_Driver: 通过SimOneDriver控制驾驶 / Driving by SimOneDriver
ESimOne_Drive_Mode_API_Lateral: 横向API,纵向Driver / Lateral by API, longitudinal by Driver
ESimOne_Drive_Mode_API_Longitudinal: 横向Driver,纵向API / Lateral by Driver, longitudinal by API
- SimOnePNCAPI.SoSetVehicleEvent(mainVehicleId: str, vehicleEventInfo: SimOne_Data_Vehicle_EventInfo) bool[源代码]¶
设置主车预警消息
Set warning messages for the main vehicle.
- SimOnePNCAPI.SoSetSignalLights(mainVehicleId: str, pSignalLight: SimOne_Data_Signal_Lights) bool[源代码]¶
设置车辆信号灯状态
Set the state of the vehicle's signal lights.
- SimOnePNCAPI.SoGetDriverControl(mainVehicleId: str, driverControlData: SimOne_Data_Control) bool[源代码]¶
获取SimOneDriver控制信号
Get control signals from SimOneDriver.
- SimOnePNCAPI.SoGetControlMode(mainVehicleId: str, controlModeData: SimOne_Data_Control_Mode) bool[源代码]¶
获取车辆控制模式
Retrieve the current vehicle control mode.
- SimOnePNCAPI.SoGetWayPoints(mainVehicleId: str, wayPointsData: SimOne_Data_WayPoints) bool[源代码]¶
获取案例主车路径点
Retrieve the waypoints of the main vehicle from scenario editing.
- SimOnePNCAPI.SoAPISetScenarioEventCB(cb: callable) bool[源代码]¶
场景事件回调
Register a callback function for scenario events.
- 参数:¶
- cb : callable¶
场景事件的回调函数 / Callback for scenario events
- Callback signature:¶
def callback(source: str, target: str, type: str, content: str) -> None
Callback parameters:
source (str): 发送消息的车辆ID / Vehicle ID sending the message
target (str): 接收方ID / Target ID
type (str): 消息类型("Command"或"Event")/ Message type
content (str): 消息内容 / Message content