robocad-py 1.0.2.4__tar.gz → 1.0.2.5__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.
- {robocad-py-1.0.2.4/robocad_py.egg-info → robocad-py-1.0.2.5}/PKG-INFO +1 -1
- robocad-py-1.0.2.5/robocad/vex.py +76 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5/robocad_py.egg-info}/PKG-INFO +1 -1
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/robocad_py.egg-info/SOURCES.txt +1 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/setup.py +1 -1
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/CHANGELOG.md +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/LICENSE +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/MANIFEST.in +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/robocad/__init__.py +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/robocad/common.py +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/robocad/internal/__init__.py +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/robocad/internal/logger.py +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/robocad/internal/studica/COM.py +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/robocad/internal/studica/SPI.py +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/robocad/internal/studica/__init__.py +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/robocad/internal/studica/connection.py +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/robocad/internal/studica/connection_base.py +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/robocad/internal/studica/connection_real.py +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/robocad/internal/studica/connection_sim.py +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/robocad/internal/studica/shared.py +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/robocad/shufflecad/__init__.py +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/robocad/shufflecad/connections.py +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/robocad/shufflecad/shufflecad.py +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/robocad/shufflecad/shufflecad_holder.py +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/robocad/studica.py +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/robocad_py.egg-info/dependency_links.txt +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/robocad_py.egg-info/requires.txt +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/robocad_py.egg-info/top_level.txt +0 -0
- {robocad-py-1.0.2.4 → robocad-py-1.0.2.5}/setup.cfg +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import signal
|
|
2
|
+
|
|
3
|
+
from .common import Common
|
|
4
|
+
from .internal.logger import Logger
|
|
5
|
+
|
|
6
|
+
from .internal.studica.connection_base import ConnectionBase
|
|
7
|
+
from .internal.studica.shared import VMXStatic, TitanStatic
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class RobotVex:
|
|
11
|
+
def __init__(self):
|
|
12
|
+
self.__reseted_yaw_val = 0.0
|
|
13
|
+
|
|
14
|
+
self.__connection: ConnectionBase = None
|
|
15
|
+
|
|
16
|
+
Common.on_real_robot = True
|
|
17
|
+
Common.logger = Logger()
|
|
18
|
+
|
|
19
|
+
signal.signal(signal.SIGTERM, self.handler)
|
|
20
|
+
signal.signal(signal.SIGINT, self.handler)
|
|
21
|
+
|
|
22
|
+
from .internal.studica.connection_sim import ConnectionSim
|
|
23
|
+
self.__connection = ConnectionSim()
|
|
24
|
+
Common.power = 12 # todo: control from ConnectionSim from robocad
|
|
25
|
+
|
|
26
|
+
self.__connection.start()
|
|
27
|
+
|
|
28
|
+
def stop(self):
|
|
29
|
+
self.__connection.stop()
|
|
30
|
+
Common.logger.write_main_log("Program stopped")
|
|
31
|
+
|
|
32
|
+
def handler(self, signum, _):
|
|
33
|
+
Common.logger.write_main_log("Program stopped from handler")
|
|
34
|
+
Common.logger.write_main_log('Signal handler called with signal' + str(signum))
|
|
35
|
+
self.stop()
|
|
36
|
+
raise SystemExit("Exited")
|
|
37
|
+
|
|
38
|
+
def get_motor_speed_right(self):
|
|
39
|
+
return TitanStatic.speed_motor_0
|
|
40
|
+
|
|
41
|
+
def set_motor_speed_right(self, value):
|
|
42
|
+
TitanStatic.speed_motor_0 = value
|
|
43
|
+
|
|
44
|
+
def get_motor_speed_left(self):
|
|
45
|
+
return TitanStatic.speed_motor_1
|
|
46
|
+
|
|
47
|
+
def set_motor_speed_left(self, value):
|
|
48
|
+
TitanStatic.speed_motor_1 = value
|
|
49
|
+
|
|
50
|
+
def get_motor_enc_right(self):
|
|
51
|
+
return TitanStatic.enc_motor_0
|
|
52
|
+
|
|
53
|
+
def get_motor_enc_left(self):
|
|
54
|
+
return TitanStatic.enc_motor_1
|
|
55
|
+
|
|
56
|
+
def get_gyro_degrees(self):
|
|
57
|
+
return self.__normalize_angle(self.__get_pure_yaw() - self.__reseted_yaw_val)
|
|
58
|
+
|
|
59
|
+
def reset_gyro_degrees(self, value: float = 0.0):
|
|
60
|
+
self.__reseted_yaw_val = self.__normalize_angle(self.__get_pure_yaw() - value)
|
|
61
|
+
|
|
62
|
+
def __get_pure_yaw(self):
|
|
63
|
+
return VMXStatic.yaw
|
|
64
|
+
|
|
65
|
+
def __normalize_angle(self, angle: float) -> float:
|
|
66
|
+
if angle < -180:
|
|
67
|
+
return angle + 360
|
|
68
|
+
elif angle > 180:
|
|
69
|
+
return angle - 360
|
|
70
|
+
return angle
|
|
71
|
+
|
|
72
|
+
def set_servo_claw(self, value):
|
|
73
|
+
VMXStatic.set_servo_angle(value, 1)
|
|
74
|
+
|
|
75
|
+
def set_servo_arm(self, value):
|
|
76
|
+
VMXStatic.set_servo_angle(value, port - 2)
|
|
@@ -10,7 +10,7 @@ classifiers = [
|
|
|
10
10
|
|
|
11
11
|
setup(
|
|
12
12
|
name='robocad-py',
|
|
13
|
-
version='1.0.2.
|
|
13
|
+
version='1.0.2.5',
|
|
14
14
|
description='python lib for real and virtual robots',
|
|
15
15
|
long_description="Python library for real and virtual robots" + '\n\n' + open('CHANGELOG.md').read(),
|
|
16
16
|
url='https://github.com/Soft-V/robocad-py',
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|