Coverage for abb_rws_client_python_rw6/highlevel/panel.py: 100%
11 statements
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-13 22:17 +0000
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-13 22:17 +0000
1# abb_rws_client/highlevel/panel.py
2"""High-level controller motor state for ABB RWS RobotWare 6.
4Author: Clement RACINET
6Composed operations built exclusively from atomic ``rws/`` functions.
7No HTTP calls are made directly in this module.
9All functions are async and require an open ``RWSClient`` instance.
10"""
12from __future__ import annotations
14from abb_rws_client_python_rw6.core.client import RWSClient
15from abb_rws_client_python_rw6.core.logger import get_logger
16from abb_rws_client_python_rw6.rws.panel import set_controller_state
18logger = get_logger(__name__)
21async def set_motors_on(client: RWSClient) -> None:
22 """Switch the controller to motors-on state.
24 Wraps ``set_controller_state`` with ``ctrl_state="motoron"``.
26 Route (delegated): ``POST /rw/panel/ctrlstate`` (action=setctrlstate)
28 ABB constraints:
29 - Controller must be in AUTO mode.
30 - No mastership required.
32 Args:
33 client: Open ``RWSClient`` instance.
35 Returns:
36 None. Expects HTTP 204.
38 Raises:
39 RWSAuthenticationError: On HTTP 401.
40 RWSNotFoundError: On HTTP 404.
41 RWSHTTPError: On any other HTTP >= 400.
43 Example:
44 ```python
45 async with RWSClient(host="192.168.125.1") as client:
46 await set_motors_on(client)
47 ```
48 """
49 await set_controller_state(
50 client,
51 action="setctrlstate",
52 ctrl_state="motoron",
53 )
54 logger.debug("Motors ON")
57async def set_motors_off(client: RWSClient) -> None:
58 """Switch the controller to motors-off state.
60 Wraps ``set_controller_state`` with ``ctrl_state="motoroff"``.
62 Route (delegated): ``POST /rw/panel/ctrlstate`` (action=setctrlstate)
64 ABB constraints:
65 - No mastership required.
67 Args:
68 client: Open ``RWSClient`` instance.
70 Returns:
71 None. Expects HTTP 204.
73 Raises:
74 RWSAuthenticationError: On HTTP 401.
75 RWSNotFoundError: On HTTP 404.
76 RWSHTTPError: On any other HTTP >= 400.
78 Example:
79 ```python
80 async with RWSClient(host="192.168.125.1") as client:
81 await set_motors_off(client)
82 ```
83 """
84 await set_controller_state(
85 client,
86 action="setctrlstate",
87 ctrl_state="motoroff",
88 )
89 logger.debug("Motors OFF")