Skip to content

🎨 TongSim 中一些自定义的 Type

tongsim.type.anim

tongsim.type.anim

定义与动画执行结果相关的数据结构和常量,包括 AnimResultInfo 数据类和 HandType 枚举类型。

AnimResultInfo dataclass

动画执行结果信息。

Attributes:

Name Type Description
command_id int

动画命令的唯一标识符。

unreal_frame int

Unreal 引擎中的帧编号。

status Literal['begin', 'end', 'error']

动画状态,可为 "begin"、"end" 或 "error"。

error_code int

错误代码,默认为 0 表示无错误。

error_animation_code int

出错动画代码,默认为 0 表示无错误。

Source code in src\tongsim\type\anim.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
@dataclass(slots=True)
class AnimResultInfo:
    """
    动画执行结果信息。

    Attributes:
        command_id (int): 动画命令的唯一标识符。
        unreal_frame (int): Unreal 引擎中的帧编号。
        status (Literal["begin", "end", "error"]): 动画状态,可为 "begin"、"end" 或 "error"。
        error_code (int): 错误代码,默认为 0 表示无错误。
        error_animation_code (int): 出错动画代码,默认为 0 表示无错误。
    """

    command_id: int
    unreal_frame: int
    status: Literal["begin", "end", "error"]
    error_code: int = 0
    error_animation_code: int = 0

AnimCmdHandType

Bases: IntEnum

手部动作类型,用于标识动画中使用的手部。 (注意值和 proto 中 EWhichHandAction 强对应!)

Attributes:

Name Type Description
RIGHT int

右手。

LEFT int

左手。

BOTH int

双手。

Source code in src\tongsim\type\anim.py
34
35
36
37
38
39
40
41
42
43
44
45
46
47
class AnimCmdHandType(IntEnum):
    """
    手部动作类型,用于标识动画中使用的手部。
    (注意值和 proto 中 EWhichHandAction 强对应!)

    Attributes:
        RIGHT (int): 右手。
        LEFT (int): 左手。
        BOTH (int): 双手。
    """

    RIGHT = 0
    LEFT = 1
    BOTH = 2

AnimationExecutionType

Bases: IntEnum

动画执行类型,用于标识动画执行方式。 (注意值和 proto 中 EAnimationExecutionType 强对应!)

Attributes:

Name Type Description
ENQUEUE int

入队执行。

EXECUTE_IMMEDIATELY int

立即执行(目前仅对部分动画有效)

OVERRIDE_PARAMS int

覆盖动作参数

Source code in src\tongsim\type\anim.py
50
51
52
53
54
55
56
57
58
59
60
61
62
63
class AnimationExecutionType(IntEnum):
    """
    动画执行类型,用于标识动画执行方式。
    (注意值和 proto 中 EAnimationExecutionType 强对应!)

    Attributes:
        ENQUEUE (int): 入队执行。
        EXECUTE_IMMEDIATELY (int): 立即执行(目前仅对部分动画有效)
        OVERRIDE_PARAMS (int): 覆盖动作参数
    """

    ENQUEUE = 0
    EXECUTE_IMMEDIATELY = 1
    OVERRIDE_PARAMS = 3

tongsim.type.camera

tongsim.type.camera

CameraIntrinsic

Bases: NamedTuple

相机内参结构。

Source code in src\tongsim\type\camera.py
 8
 9
10
11
12
13
14
15
class CameraIntrinsic(NamedTuple):
    """
    相机内参结构。
    """

    fov: float
    width: int
    height: int

VisibleObjectInfo

Bases: NamedTuple

单个可见物体信息

Source code in src\tongsim\type\camera.py
18
19
20
21
22
23
24
25
class VisibleObjectInfo(NamedTuple):
    """
    单个可见物体信息
    """

    object_id: str
    segmentation_id: int
    distance_square: float

tongsim.type.view

ViewModeType

Bases: IntEnum

摄像机视角模式,用于控制摄像机视角和移动方式。

Attributes:

Name Type Description
FIRST_PERSON_VIEW int

第一人称视角,跟随对象视角。

SURVEILLANCE_VIEW int

监视器视角,用于静态监控场景中的特定区域。

THIRD_PERSON_VIEW int

第三人称视角,跟随对象但保持一定距离。

ANCHOR_VIEW int

锚定在固定位置的视角,没有任何自动化控制逻辑,可通过外部接口设定位姿。

MANUAL_CONTROL_VIEW int

自由相机视角,可以通过 WASD、空格、Ctrl 等键位控制移动。

TONG_RECON_NAISSANCE_VIEW int

TongRecon 项目定制化视角模式,用于特殊侦察任务。

FACE_TO_FACE_VIEW int

和智能体面对面相机的视角。

Source code in src\tongsim\type\view.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class ViewModeType(IntEnum):
    """
    摄像机视角模式,用于控制摄像机视角和移动方式。

    Attributes:
        FIRST_PERSON_VIEW (int): 第一人称视角,跟随对象视角。
        SURVEILLANCE_VIEW (int): 监视器视角,用于静态监控场景中的特定区域。
        THIRD_PERSON_VIEW (int): 第三人称视角,跟随对象但保持一定距离。
        ANCHOR_VIEW (int): 锚定在固定位置的视角,没有任何自动化控制逻辑,可通过外部接口设定位姿。
        MANUAL_CONTROL_VIEW (int): 自由相机视角,可以通过 WASD、空格、Ctrl 等键位控制移动。
        TONG_RECON_NAISSANCE_VIEW (int): TongRecon 项目定制化视角模式,用于特殊侦察任务。
        FACE_TO_FACE_VIEW (int): 和智能体面对面相机的视角。
    """

    FIRST_PERSON_VIEW = 0
    SURVEILLANCE_VIEW = 1
    THIRD_PERSON_VIEW = 2
    ANCHOR_VIEW = 3
    MANUAL_CONTROL_VIEW = 4
    TONG_RECON_NAISSANCE_VIEW = 5
    FACE_TO_FACE_VIEW = 6