roboreactor 0.1.0__py3-none-any.whl
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.
roboreactor/__init__.py
ADDED
roboreactor/client.py
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import math
|
|
2
|
+
import time
|
|
3
|
+
import requests
|
|
4
|
+
from typing import Dict, Any, Optional
|
|
5
|
+
|
|
6
|
+
class RoboReactor:
|
|
7
|
+
"""
|
|
8
|
+
A unified production-ready Python client for the RoboReactor API.
|
|
9
|
+
Handles motion control, navigation telemetry, and streaming multi-category sensor structures.
|
|
10
|
+
"""
|
|
11
|
+
def __init__(self, email: str, project_name: str, base_url: str = "https://roboreactor.com"):
|
|
12
|
+
self.email = email
|
|
13
|
+
self.project_name = project_name
|
|
14
|
+
self.base_url = base_url.rstrip("/")
|
|
15
|
+
|
|
16
|
+
@staticmethod
|
|
17
|
+
def euler_to_quaternion(roll_deg: float, pitch_deg: float, yaw_deg: float) -> Dict[str, float]:
|
|
18
|
+
"""Converts Euler angles (in degrees) to a Quaternion dictionary format."""
|
|
19
|
+
roll = math.radians(roll_deg)
|
|
20
|
+
pitch = math.radians(pitch_deg)
|
|
21
|
+
yaw = math.radians(yaw_deg)
|
|
22
|
+
|
|
23
|
+
cy = math.cos(yaw * 0.5)
|
|
24
|
+
sy = math.sin(yaw * 0.5)
|
|
25
|
+
cp = math.cos(pitch * 0.5)
|
|
26
|
+
sp = math.sin(pitch * 0.5)
|
|
27
|
+
cr = math.cos(roll * 0.5)
|
|
28
|
+
sr = math.sin(roll * 0.5)
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
"x": sr * cp * cy - cr * sp * sy,
|
|
32
|
+
"y": cr * sp * cy + sr * cp * sy,
|
|
33
|
+
"z": cr * cp * sy - sr * sp * cy,
|
|
34
|
+
"w": cr * cp * cy + sr * sp * sy
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
def _send_post(self, endpoint: str, json_payload: Dict[str, Any], timeout: int = 5) -> Optional[Dict[str, Any]]:
|
|
38
|
+
url = f"{self.base_url}{endpoint}"
|
|
39
|
+
try:
|
|
40
|
+
response = requests.post(url, json=json_payload, timeout=timeout)
|
|
41
|
+
response.raise_for_status()
|
|
42
|
+
return response.json()
|
|
43
|
+
except requests.exceptions.RequestException as e:
|
|
44
|
+
print(f"Error communicating with {url}: {e}")
|
|
45
|
+
if hasattr(e, 'response') and e.response is not None:
|
|
46
|
+
print(f"Response body: {e.response.text}")
|
|
47
|
+
return None
|
|
48
|
+
|
|
49
|
+
def update_feedback_sensors(self, joints_data: Dict[str, Dict[str, float]]) -> Optional[Dict[str, Any]]:
|
|
50
|
+
"""
|
|
51
|
+
Sends analog angular reading feedback for joint arrays.
|
|
52
|
+
Endpoint: /feedback_sensor
|
|
53
|
+
"""
|
|
54
|
+
payload = {self.email: {self.project_name: joints_data}}
|
|
55
|
+
return self._send_post("/feedback_sensor", payload)
|
|
56
|
+
|
|
57
|
+
def send_navigation_control(
|
|
58
|
+
self,
|
|
59
|
+
x: float,
|
|
60
|
+
y: float,
|
|
61
|
+
z: float,
|
|
62
|
+
roll_deg: float,
|
|
63
|
+
pitch_deg: float,
|
|
64
|
+
yaw_deg: float,
|
|
65
|
+
joint_targets_rad: Dict[str, float],
|
|
66
|
+
steering_angle_deg: Optional[float] = None,
|
|
67
|
+
robot_name: str = "Robot_arm_01"
|
|
68
|
+
) -> Optional[Dict[str, Any]]:
|
|
69
|
+
"""
|
|
70
|
+
Sends absolute target coordinates, orientations, and target joint arrays.
|
|
71
|
+
Endpoint: /api/sim3/input
|
|
72
|
+
"""
|
|
73
|
+
if steering_angle_deg is None:
|
|
74
|
+
steering_angle_deg = math.degrees(x / z) if z != 0 else 0.0
|
|
75
|
+
|
|
76
|
+
payload = {
|
|
77
|
+
self.email: {
|
|
78
|
+
self.project_name: {
|
|
79
|
+
"target_position": {"x": x, "y": y, "z": z},
|
|
80
|
+
"target_quaternion": self.euler_to_quaternion(roll_deg, pitch_deg, yaw_deg),
|
|
81
|
+
"joint_targets": joint_targets_rad,
|
|
82
|
+
"steering_angle_deg": steering_angle_deg,
|
|
83
|
+
"timestamp": int(time.time() * 1000),
|
|
84
|
+
"robot_name": robot_name
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return self._send_post("/api/sim3/input", payload)
|
|
89
|
+
|
|
90
|
+
def post_sensor_data(self, category_payload: Dict[str, Any]) -> Optional[Dict[str, Any]]:
|
|
91
|
+
"""
|
|
92
|
+
Generic telemetry gateway routing specific structured sensor category payloads.
|
|
93
|
+
Endpoint: /sensor_postdata
|
|
94
|
+
"""
|
|
95
|
+
payload = {
|
|
96
|
+
"email": self.email,
|
|
97
|
+
"project_name": self.project_name,
|
|
98
|
+
"sensor_payload": category_payload
|
|
99
|
+
}
|
|
100
|
+
return self._send_post("/sensor_postdata", payload)
|
|
101
|
+
|
|
102
|
+
def fetch_iot_control(self) -> Optional[Dict[str, Any]]:
|
|
103
|
+
"""
|
|
104
|
+
Retrieves remote structural commands sent back down to the target package edge loop.
|
|
105
|
+
Endpoint: /package_iot_control
|
|
106
|
+
"""
|
|
107
|
+
payload = {self.email: {}}
|
|
108
|
+
return self._send_post("/package_iot_control", payload)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: roboreactor
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A unified Python client for Roboreactor edge devices and robot simulators.
|
|
5
|
+
Author-email: Your Name <kornbot380@hotmail.com>
|
|
6
|
+
Project-URL: Homepage, https://roboreactor.com
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
11
|
+
Requires-Python: >=3.7
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: requests>=2.25.0
|
|
15
|
+
Dynamic: license-file
|
|
16
|
+
|
|
17
|
+
# roboreactor
|
|
18
|
+
|
|
19
|
+
Official Python client library for connecting edge devices, emulators, and robot controls directly to the RoboReactor ecosystem.
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install roboreactor
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
roboreactor/__init__.py,sha256=t7EmOGRZLP8f2FJby9Nx3CAqNLqm7i6LMQiUZoPgo8k,81
|
|
2
|
+
roboreactor/client.py,sha256=HC36pCxEj1oYR52TCYMv2zxDhZJxDwBdi4A0Qc9-rlQ,4130
|
|
3
|
+
roboreactor-0.1.0.dist-info/licenses/LICENSE,sha256=-TShHLQ6hsGY-glfVKJoM1VucAF7ZjOfH-HArphHgww,1068
|
|
4
|
+
roboreactor-0.1.0.dist-info/METADATA,sha256=anM0CzNdfK5_Irkr1yMN3Xs1U6pddlhgJ24uHHq2A9o,788
|
|
5
|
+
roboreactor-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
6
|
+
roboreactor-0.1.0.dist-info/top_level.txt,sha256=3Fm2qj-dzZbb9fF77jwy7MxPIiuFgVK_iO4L8_Vv11I,12
|
|
7
|
+
roboreactor-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 RoboReactor
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
roboreactor
|