Skip to content

帧同步 / Frame Synchronization

说明 / Overview

帧同步模式下控制仿真推进节奏的接口(仅在 isFrameSync=1 时有效)。
Interfaces for controlling simulation advancement in frame-sync mode (only effective when isFrameSync=1).

SimOneServiceAPI.SoAPIWait()

获取当前帧号

Retrieve the current frame number.

当SoInitSimOneAPI的参数isFrameSync设置为true时,此函数用于获取SimOne环境中的当前帧号

This function is used to obtain the current frame number in the SimOne environment when the 'isFrameSync' parameter of SoInitSimOneAPI is set to true.

Returns:

Type Description
int

当前帧号

The current frame number.

SimOneServiceAPI.SoAPINextFrame(frame)

进行下一帧

Proceed to the next frame in a frame-synchronized scene.

在帧同步的场景中使用,此函数用于将SimOne环境的执行推进到下一帧

This function is used in frame-synchronized scenes to advance the execution of the SimOne environment to the next frame. 当SoInitSimOneAPI的参数isFrameSync设置为true时使用。Use when the 'isFrameSync' parameter of SoInitSimOneAPI is set to true.

Parameters:

Name Type Description Default
frame int

当前帧号,由SoAPIWait返回

The current frame number, returned by SoAPIWait.

required

SimOneServiceAPI.SoAPISetFrameCB(startcb, stopcb)

在仿真场景中为每个帧设置回调函数,在每个帧的开始和结束时调用指定的回调函数

Register callback functions to be called at the beginning and end of each frame in a simulation scene.

Parameters:

Name Type Description Default
startcb func

每帧开始时调用的回调函数

Callback function called at the beginning of each frame.

required
stopcb func

每帧结束时调用的回调函数

Callback function called at the end of each frame.

required

Returns:

Type Description
bool

设置回调函数的执行结果,成功或失败

The execution outcome of setting the callback functions, success or failure.