Skip to content

context

Context dataclass #

Server context class recording variables using in multiple namespaces.

Attributes:

Name Type Description
robot_id int | None

Robot ID

planner_sid str | None

Planner sid

copilot_sid str | None

Copilot sid

detector_sid str | None

Detector sid

robotcam_sid str | None

Robotcam sid

beacon_sid str | None

Beacon server sid

monitor_sid str | None

Monitor sid

tool_menus dict[str, ShellMenu]

all registered tool menus

current_tool_menu str | None

name of the currently selected tool menu

shell_menu ShellMenu | None

last received shell menu

virtual

Whether robot is virtual or not

Source code in cogip/tools/server/context.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
@dataclass
class Context(metaclass=Singleton):
    """
    Server context class recording variables using in multiple namespaces.

    Attributes:
        robot_id:           Robot ID
        planner_sid:        Planner sid
        copilot_sid:        Copilot sid
        detector_sid:       Detector sid
        robotcam_sid:       Robotcam sid
        beacon_sid:         Beacon server sid
        monitor_sid:        Monitor sid
        tool_menus:         all registered tool menus
        current_tool_menu:  name of the currently selected tool menu
        shell_menu:         last received shell menu
        virtual:            Whether robot is virtual or not
    """

    robot_id: int | None = None
    planner_sid: str | None = None
    copilot_sid: str | None = None
    detector_sid: str | None = None
    robotcam_sid: str | None = None
    beacon_sid: str | None = None
    monitor_sid: str | None = None
    tool_menus: dict[str, models.ShellMenu] = field(default_factory=dict)
    current_tool_menu: str | None = None
    shell_menu: models.ShellMenu | None = None
    virtual = platform.machine() != "aarch64"