robotframework-parrot-touchcontroller 1.0.1__tar.gz → 1.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {robotframework_parrot_touchcontroller-1.0.1 → robotframework_parrot_touchcontroller-1.0.2}/PKG-INFO +1 -1
- {robotframework_parrot_touchcontroller-1.0.1 → robotframework_parrot_touchcontroller-1.0.2}/parrot/TouchController.py +21 -15
- {robotframework_parrot_touchcontroller-1.0.1 → robotframework_parrot_touchcontroller-1.0.2}/parrot/touch/adbtouch.py +5 -18
- {robotframework_parrot_touchcontroller-1.0.1 → robotframework_parrot_touchcontroller-1.0.2}/parrot/touch/axitouch.py +53 -17
- {robotframework_parrot_touchcontroller-1.0.1 → robotframework_parrot_touchcontroller-1.0.2}/pyproject.toml +1 -1
- {robotframework_parrot_touchcontroller-1.0.1 → robotframework_parrot_touchcontroller-1.0.2}/robotframework_parrot_touchcontroller.egg-info/PKG-INFO +1 -1
- {robotframework_parrot_touchcontroller-1.0.1 → robotframework_parrot_touchcontroller-1.0.2}/README.md +0 -0
- {robotframework_parrot_touchcontroller-1.0.1 → robotframework_parrot_touchcontroller-1.0.2}/parrot/touch/base.py +0 -0
- {robotframework_parrot_touchcontroller-1.0.1 → robotframework_parrot_touchcontroller-1.0.2}/parrot/touch/dummy.py +0 -0
- {robotframework_parrot_touchcontroller-1.0.1 → robotframework_parrot_touchcontroller-1.0.2}/parrot/touch/usbhidtouch.py +0 -0
- {robotframework_parrot_touchcontroller-1.0.1 → robotframework_parrot_touchcontroller-1.0.2}/robotframework_parrot_touchcontroller.egg-info/SOURCES.txt +0 -0
- {robotframework_parrot_touchcontroller-1.0.1 → robotframework_parrot_touchcontroller-1.0.2}/robotframework_parrot_touchcontroller.egg-info/dependency_links.txt +0 -0
- {robotframework_parrot_touchcontroller-1.0.1 → robotframework_parrot_touchcontroller-1.0.2}/robotframework_parrot_touchcontroller.egg-info/requires.txt +0 -0
- {robotframework_parrot_touchcontroller-1.0.1 → robotframework_parrot_touchcontroller-1.0.2}/robotframework_parrot_touchcontroller.egg-info/top_level.txt +0 -0
- {robotframework_parrot_touchcontroller-1.0.1 → robotframework_parrot_touchcontroller-1.0.2}/setup.cfg +0 -0
|
@@ -17,9 +17,9 @@ class TouchController:
|
|
|
17
17
|
|
|
18
18
|
== Configuration ==
|
|
19
19
|
|
|
20
|
-
Touch devices are configured using the `Touch Setup` keyword with a dictionary
|
|
21
|
-
typically loaded from a YAML file (e.g. `config.yaml`) by importing the library
|
|
22
|
-
and variables into your test suite. Each entry in the configuration must include
|
|
20
|
+
Touch devices are configured using the `Touch Setup` keyword with a dictionary
|
|
21
|
+
typically loaded from a YAML file (e.g. `config.yaml`) by importing the library
|
|
22
|
+
and variables into your test suite. Each entry in the configuration must include
|
|
23
23
|
a `type` field that specifies the device type. Supported types include:
|
|
24
24
|
|
|
25
25
|
- `UsbHidTouch`: USB HID-based touch simulation over TCP.
|
|
@@ -40,11 +40,17 @@ class TouchController:
|
|
|
40
40
|
- `width`, `height`: Touch surface resolution in pixels
|
|
41
41
|
- `start_pos`: Physical start coordinates (e.g., `[0, 0]`)
|
|
42
42
|
- `end_pos`: Physical end coordinates defining working area (e.g., `[8.66, 5.12]`)
|
|
43
|
+
- `orientation`: Defines how touchscreen pixel coordinates are mapped to
|
|
44
|
+
the AxiDraw's coordinate system (e.g., `landscape` or `portrait`).
|
|
45
|
+
- `landscape`: Screen X maps to Robot Y, Screen Y maps to Robot X.
|
|
46
|
+
- `portrait`: Screen X maps to Robot X, Screen Y maps to Robot Y.
|
|
47
|
+
|
|
48
|
+
|
|
43
49
|
|
|
44
50
|
=== ADBTouch ===
|
|
45
51
|
Simulates touch events on an Android device using ADB commands.
|
|
46
52
|
Supported configs:
|
|
47
|
-
- `
|
|
53
|
+
- `type`: ADBTouch
|
|
48
54
|
|
|
49
55
|
=== Configuration Sample (config.yaml) ===
|
|
50
56
|
|
|
@@ -66,15 +72,15 @@ class TouchController:
|
|
|
66
72
|
| height: 600
|
|
67
73
|
| start_pos: [0, 0]
|
|
68
74
|
| end_pos: [8.66, 5.12]
|
|
75
|
+
| orientation: landscape
|
|
69
76
|
|
|
|
70
77
|
| T3:
|
|
71
78
|
| type: ADBTouch
|
|
72
|
-
| ip: 192.168.43.168
|
|
73
79
|
|
|
74
80
|
= General Usage =
|
|
75
81
|
|
|
76
|
-
Setup and initialize touch devices from a YAML configuration. Simulate touch input such as tap and swipe gestures
|
|
77
|
-
across multiple supported devices. This library supports both real physical systems and simulated touch environments,
|
|
82
|
+
Setup and initialize touch devices from a YAML configuration. Simulate touch input such as tap and swipe gestures
|
|
83
|
+
across multiple supported devices. This library supports both real physical systems and simulated touch environments,
|
|
78
84
|
making it suitable for automated device interaction and UI testing.
|
|
79
85
|
|
|
80
86
|
= Example =
|
|
@@ -102,7 +108,7 @@ class TouchController:
|
|
|
102
108
|
@keyword("Touch Setup")
|
|
103
109
|
def setup(self, config: Dict[str, Dict[str, Any]]) -> None:
|
|
104
110
|
"""Initializes and configures touch controller devices.
|
|
105
|
-
Loads controller instances from the given `Configuration` dictionary
|
|
111
|
+
Loads controller instances from the given `Configuration` dictionary
|
|
106
112
|
and prepares them for input simulation.
|
|
107
113
|
|
|
108
114
|
*Syntax*
|
|
@@ -147,8 +153,8 @@ class TouchController:
|
|
|
147
153
|
def send_touch(self, device: str, x: float, y: float, tap_time: float) -> None:
|
|
148
154
|
"""
|
|
149
155
|
Simulates a tap action on the given device at specified screen coordinates.
|
|
150
|
-
Requires the device name, X and Y coordinates in pixels, and an
|
|
151
|
-
tap duration.
|
|
156
|
+
Requires the device name, X and Y coordinates in pixels, and an
|
|
157
|
+
tap duration.
|
|
152
158
|
|
|
153
159
|
*Syntax*
|
|
154
160
|
|
|
@@ -197,11 +203,11 @@ class TouchController:
|
|
|
197
203
|
"""
|
|
198
204
|
Executes a backend-specific touch command on the given device controller.
|
|
199
205
|
|
|
200
|
-
This keyword is used to send a command (e.g., `Move`, `Home`) to a specific device.
|
|
201
|
-
The available commands and required arguments depends on the backend implementation
|
|
206
|
+
This keyword is used to send a command (e.g., `Move`, `Home`) to a specific device.
|
|
207
|
+
The available commands and required arguments depends on the backend implementation
|
|
202
208
|
of the touch controller. Currently only the AxiDrawTouch backend has commands.
|
|
203
209
|
|
|
204
|
-
AxiDrawTouch backend supports the following commands.
|
|
210
|
+
AxiDrawTouch backend supports the following commands.
|
|
205
211
|
|
|
206
212
|
- `Move` — Moves to the specified position (in inches) without touching.
|
|
207
213
|
Requires two arguments: `x`, `y`.
|
|
@@ -228,12 +234,12 @@ class TouchController:
|
|
|
228
234
|
def set_param_auto_home(self, device: str, param: str, value: str) -> None:
|
|
229
235
|
"""
|
|
230
236
|
Sets values to configure runtime parameters for Touch control devices.
|
|
231
|
-
|
|
237
|
+
|
|
232
238
|
Currently, this keyword supports only for `AxiDrawTouch` type devices,
|
|
233
239
|
|
|
234
240
|
| *Parameter* | *Description* | *Example Value* |
|
|
235
241
|
| `auto_home` | Specifies the touch action to be directed to the home position | "True or False" |
|
|
236
|
-
|
|
242
|
+
|
|
237
243
|
*Syntax*
|
|
238
244
|
|
|
239
245
|
| `Touch Set Param` | <DEVICE_NAME> | auto_home | <VALUE> |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from
|
|
1
|
+
from robot.libraries.BuiltIn import BuiltIn
|
|
2
2
|
from parrot.touch.base import BaseTouch, Error
|
|
3
3
|
|
|
4
4
|
class ADBTouch(BaseTouch):
|
|
@@ -12,20 +12,8 @@ class ADBTouch(BaseTouch):
|
|
|
12
12
|
def __init__(self, config: dict):
|
|
13
13
|
"""
|
|
14
14
|
Initializes the ADB touch controller.
|
|
15
|
-
|
|
16
|
-
The configuration dictionary must contain:
|
|
17
|
-
- `ip`: IP address of the ADB-connected device
|
|
18
|
-
|
|
19
|
-
Raises:
|
|
20
|
-
Error: If required configuration is missing or initialization fails.
|
|
21
15
|
"""
|
|
22
|
-
|
|
23
|
-
self.device_ip = config["ip"]
|
|
24
|
-
self.adb = ADBController.ADBController()
|
|
25
|
-
except KeyError as err:
|
|
26
|
-
raise Error(f"Missing required configuration key: {err}") from err
|
|
27
|
-
except Exception as err:
|
|
28
|
-
raise Error(f"Initialization failed: {err}") from err
|
|
16
|
+
self.adb = None
|
|
29
17
|
|
|
30
18
|
def touch_init(self):
|
|
31
19
|
"""
|
|
@@ -35,10 +23,9 @@ class ADBTouch(BaseTouch):
|
|
|
35
23
|
Error: If the device connection fails.
|
|
36
24
|
"""
|
|
37
25
|
try:
|
|
38
|
-
self.adb.
|
|
39
|
-
print(f"ADBTouch: Connected to device {self.device_ip}")
|
|
26
|
+
self.adb = BuiltIn().get_library_instance("parrot.ADBController")
|
|
40
27
|
except Exception as err:
|
|
41
|
-
raise Error("Initialization failed") from err
|
|
28
|
+
raise Error(f"ADB Touch Initialization failed: {err}") from err
|
|
42
29
|
|
|
43
30
|
def touch_tap(self, x, y, tap_time):
|
|
44
31
|
"""
|
|
@@ -79,6 +66,6 @@ class ADBTouch(BaseTouch):
|
|
|
79
66
|
print(f"ADBTouch: Swipe from ({startx}, {starty}) to ({endx}, {endy})")
|
|
80
67
|
except Exception as err:
|
|
81
68
|
raise Error(f"Swipe failed from ({startx}, {starty}) to ({endx}, {endy})") from err
|
|
82
|
-
|
|
69
|
+
|
|
83
70
|
def touch_command(self, cmd, *args):
|
|
84
71
|
raise Error("Commands are not supported by the ADBTouch backend")
|
|
@@ -50,6 +50,7 @@ class AxiDrawTouch(BaseTouch):
|
|
|
50
50
|
self.end_y_pos = None
|
|
51
51
|
self.start_position = None
|
|
52
52
|
self.end_position = None
|
|
53
|
+
self.orientation = config.get("orientation")
|
|
53
54
|
|
|
54
55
|
# Optional: configure pen heights and speed
|
|
55
56
|
pen_pos_up = 75
|
|
@@ -101,6 +102,7 @@ class AxiDrawTouch(BaseTouch):
|
|
|
101
102
|
*Args:*
|
|
102
103
|
`x` (float): X-coordinate in pixels.
|
|
103
104
|
`y` (float): Y-coordinate in pixels.
|
|
105
|
+
`orientation` (str): The orientation of the screen ('landscape' or 'portrait').
|
|
104
106
|
|
|
105
107
|
*Returns:*
|
|
106
108
|
`Tuple[float, float]`: Corresponding Cartesian coordinates (x, y) in inches.
|
|
@@ -109,36 +111,65 @@ class AxiDrawTouch(BaseTouch):
|
|
|
109
111
|
ValueError: If the screen coordinates are out of bounds or if calibration data is missing.
|
|
110
112
|
|
|
111
113
|
*NOTE:*
|
|
112
|
-
|
|
114
|
+
Use "landscape" when the screen X-axis maps to the robot Y-axis and
|
|
115
|
+
the screen Y-axis maps to the robot X-axis, as shown below.
|
|
113
116
|
|
|
114
117
|
Robot Y
|
|
115
118
|
+-----------------------------+
|
|
116
|
-
|
|
|
117
|
-
|
|
118
|
-
| |
|
|
119
|
+
| |
|
|
120
|
+
| Screen X |
|
|
121
|
+
| +-------------------+ |
|
|
122
|
+
Robot X | | | Screen Y
|
|
123
|
+
| | | |
|
|
119
124
|
| +-------------------+ |
|
|
120
125
|
| |
|
|
126
|
+
| |
|
|
127
|
+
| |
|
|
121
128
|
+-----------------------------+
|
|
122
129
|
|
|
130
|
+
Use "portrait" when the screen X-axis maps to the robot X-axis and
|
|
131
|
+
the screen Y-axis maps to the robot Y-axis, as shown below.
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
Robot Y
|
|
135
|
+
+-----------------------------+
|
|
136
|
+
| Screen Y |
|
|
137
|
+
| +-------+ |
|
|
138
|
+
| | | |
|
|
139
|
+
Robot X | | | |
|
|
140
|
+
| | | Screen X |
|
|
141
|
+
| | | |
|
|
142
|
+
| | | |
|
|
143
|
+
| | | |
|
|
144
|
+
| +-------+ |
|
|
145
|
+
+-----------------------------+
|
|
123
146
|
"""
|
|
124
147
|
|
|
125
148
|
x = float(x)
|
|
126
149
|
y = float(y)
|
|
127
150
|
|
|
151
|
+
if not self.orientation:
|
|
152
|
+
self.orientation = "landscape"
|
|
153
|
+
|
|
128
154
|
sx, sy = self.cartesian_start
|
|
129
155
|
ex, ey = self.cartesian_end
|
|
130
156
|
|
|
131
|
-
|
|
132
|
-
|
|
157
|
+
if self.orientation == 'landscape':
|
|
158
|
+
x_scale = (ex - sx) / self.screen_height_px
|
|
159
|
+
y_scale = (ey - sy) / self.screen_width_px
|
|
133
160
|
|
|
134
|
-
|
|
135
|
-
|
|
161
|
+
robot_x = sx + y * x_scale
|
|
162
|
+
robot_y = sy + x * y_scale
|
|
136
163
|
|
|
137
|
-
|
|
138
|
-
|
|
164
|
+
elif self.orientation == 'portrait':
|
|
165
|
+
x_scale = (ex - sx) / self.screen_width_px
|
|
166
|
+
y_scale = (ey - sy) / self.screen_height_px
|
|
139
167
|
|
|
140
|
-
|
|
141
|
-
|
|
168
|
+
robot_x = sx + x * x_scale
|
|
169
|
+
robot_y = sy + y * y_scale
|
|
170
|
+
|
|
171
|
+
else:
|
|
172
|
+
raise ValueError("orientation must be either 'landscape' or 'portrait'")
|
|
142
173
|
|
|
143
174
|
return round(robot_x, 3), round(robot_y, 3)
|
|
144
175
|
|
|
@@ -279,12 +310,17 @@ class AxiDrawTouch(BaseTouch):
|
|
|
279
310
|
raise Error("Failed to Calibrate the device") from err
|
|
280
311
|
|
|
281
312
|
def _calibrate_corner(self, message: str):
|
|
313
|
+
"""Calibrate a corner and reconnect the AXI server afterward."""
|
|
282
314
|
self.axi.disconnect()
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
315
|
+
try:
|
|
316
|
+
self.wait_for_ok(message)
|
|
317
|
+
self.axi.connect()
|
|
318
|
+
x, y = self.axi.calibrate_with_limit_switch()
|
|
319
|
+
return round(abs(x), 2), round(abs(y), 2)
|
|
287
320
|
|
|
321
|
+
finally:
|
|
322
|
+
self.axi.disconnect()
|
|
323
|
+
self.axi.connect()
|
|
288
324
|
|
|
289
325
|
def save_calibrate_position(self):
|
|
290
326
|
try:
|
|
@@ -340,4 +376,4 @@ class AxiDrawTouch(BaseTouch):
|
|
|
340
376
|
if param == 'auto_home' and param in self.PROPERTIES:
|
|
341
377
|
self.auto_home = value
|
|
342
378
|
else:
|
|
343
|
-
raise Error(f"ArucoCapture Error: Unsupported parameter: {param}")
|
|
379
|
+
raise Error(f"ArucoCapture Error: Unsupported parameter: {param}")
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "robotframework-parrot-touchcontroller"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.2"
|
|
8
8
|
description = "Touch control api to use within the Robot Framework ecosystem"
|
|
9
9
|
authors = [
|
|
10
10
|
{ name = "Zilogic Systems", email = "code@zilogic.com" },
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|