robocad-py 1.1.0.0__tar.gz → 1.3.1.0__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.
Files changed (27) hide show
  1. {robocad_py-1.1.0.0/robocad_py.egg-info → robocad_py-1.3.1.0}/PKG-INFO +1 -1
  2. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/robocad/algaritm.py +14 -0
  3. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/robocad/internal/algaritm_internal.py +8 -5
  4. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/robocad/internal/common/connection.py +16 -4
  5. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/robocad/internal/studica_internal.py +1 -1
  6. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/robocad/shufflecad.py +7 -3
  7. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/robocad/studica.py +0 -18
  8. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0/robocad_py.egg-info}/PKG-INFO +1 -1
  9. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/setup.py +1 -1
  10. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/CHANGELOG.md +0 -0
  11. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/LICENSE +0 -0
  12. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/MANIFEST.in +0 -0
  13. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/robocad/__init__.py +0 -0
  14. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/robocad/internal/__init__.py +0 -0
  15. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/robocad/internal/common/connection_base.py +0 -0
  16. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/robocad/internal/common/connection_real.py +0 -0
  17. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/robocad/internal/common/connection_sim.py +0 -0
  18. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/robocad/internal/common/lidar.py +0 -0
  19. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/robocad/internal/common/robot.py +0 -0
  20. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/robocad/internal/common/robot_configuration.py +0 -0
  21. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/robocad/internal/common/shared.py +0 -0
  22. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/robocad/internal/common/updaters.py +0 -0
  23. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/robocad_py.egg-info/SOURCES.txt +0 -0
  24. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/robocad_py.egg-info/dependency_links.txt +0 -0
  25. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/robocad_py.egg-info/requires.txt +0 -0
  26. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/robocad_py.egg-info/top_level.txt +0 -0
  27. {robocad_py-1.1.0.0 → robocad_py-1.3.1.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: robocad-py
3
- Version: 1.1.0.0
3
+ Version: 1.3.1.0
4
4
  Summary: python lib for real and virtual robots
5
5
  Home-page: https://github.com/Soft-V/robocad-py
6
6
  Author: Airat Abdrakov
@@ -78,6 +78,14 @@ class RobotAlgaritm(Robot):
78
78
  def yaw(self):
79
79
  return self.__algaritm_internal.yaw
80
80
 
81
+ @property
82
+ def pitch(self):
83
+ return self.__algaritm_internal.pitch
84
+
85
+ @property
86
+ def roll(self):
87
+ return self.__algaritm_internal.roll
88
+
81
89
  @property
82
90
  def us_1(self):
83
91
  return self.__algaritm_internal.ultrasound_1
@@ -142,6 +150,12 @@ class RobotAlgaritm(Robot):
142
150
  def additional_servo_2(self, value):
143
151
  self.__algaritm_internal.additional_servo_2 = value
144
152
 
153
+ def set_pid_settings(self, use_pid, p, i, d):
154
+ self.__algaritm_internal.use_pid = use_pid
155
+ self.__algaritm_internal.p_pid = p
156
+ self.__algaritm_internal.i_pid = i
157
+ self.__algaritm_internal.d_pid = d
158
+
145
159
  # num 1 or 2
146
160
  def step_motor_move(self, num, steps: int, steps_per_second: int, direction: bool):
147
161
  self.__algaritm_internal.step_motor_move(num, steps, steps_per_second, direction)
@@ -47,7 +47,7 @@ class AlgaritmInternal:
47
47
  self.step_motor_2_steps_per_s: int = 0
48
48
  self.step_motor_1_direction: bool = False
49
49
  self.step_motor_2_direction: bool = False
50
- self.use_pid: bool = True
50
+ self.use_pid: bool = False
51
51
  self.p_pid: float = 0.14
52
52
  self.i_pid: float = 0.1
53
53
  self.d_pid: float = 0.0
@@ -210,10 +210,10 @@ class TitanCOM:
210
210
  tx_data[4] = int(numpy.clip(self.__robot_internal.speed_motor_3, -100, 100)).to_bytes(1, 'big', signed = True)[0]
211
211
 
212
212
  # for ProgramIsRunning and directions
213
- tx_data[5] = int('1' + ("1") +
214
- ("1" if self.__robot_internal.step_motor_1_direction else "0") +
215
- ("1" if self.__robot_internal.step_motor_2_direction else "0") +
216
- ("1" if self.__robot_internal.use_pid else "0") + '001', 2)
213
+ tx_data[5] = int('11' +
214
+ ("1" if self.__robot_internal.step_motor_1_direction else "0") +
215
+ ("1" if self.__robot_internal.step_motor_2_direction else "0") +
216
+ ("1" if self.__robot_internal.use_pid else "0") + '001', 2)
217
217
 
218
218
  tx_data[6] = int(self.__robot_internal.additional_servo_1)
219
219
  tx_data[7] = int(self.__robot_internal.additional_servo_2)
@@ -355,6 +355,9 @@ class VMXSPI:
355
355
  self.__robot_internal.roll_unlim += self.calc_angle_unlim(new_roll, self.__robot_internal.roll)
356
356
  self.__robot_internal.roll = new_roll
357
357
 
358
+ power: float = ((data[8] & 0xff) << 8 | (data[7] & 0xff)) / 100
359
+ self.__robot.power = power
360
+
358
361
  def set_up_tx_data(self) -> bytearray:
359
362
  tx_list: bytearray = bytearray([0x00] * 16)
360
363
 
@@ -30,7 +30,13 @@ class ListenPort:
30
30
  except ConnectionRefusedError:
31
31
  self.__robot.write_log("LP: Failed to connect on port " + str(self.__port))
32
32
  print("LP: Failed to connect on port " + str(self.__port))
33
- self.__robot.write_log("connected: " + str(self.__port))
33
+ try:
34
+ self.__sct.shutdown(socket.SHUT_RDWR)
35
+ self.__sct.close()
36
+ except (OSError, Exception): pass # idc
37
+ return
38
+
39
+ self.__robot.write_log("LP: Connected: " + str(self.__port))
34
40
  while not self.__stop_thread:
35
41
  try:
36
42
  dt = "Wait for data".encode('utf-16-le')
@@ -49,7 +55,7 @@ class ListenPort:
49
55
  except (ConnectionAbortedError, BrokenPipeError, OSError):
50
56
  # возникает при отключении сокета
51
57
  break
52
- self.__robot.write_log("disconnected: " + str(self.__port))
58
+ self.__robot.write_log("LP: Disconnected: " + str(self.__port))
53
59
  try:
54
60
  self.__sct.shutdown(socket.SHUT_RDWR)
55
61
  self.__sct.close()
@@ -105,7 +111,13 @@ class TalkPort:
105
111
  except ConnectionRefusedError:
106
112
  self.__robot.write_log("TP: Failed to connect on port " + str(self.__port))
107
113
  print("TP: Failed to connect on port " + str(self.__port))
108
- self.__robot.write_log("connected: " + str(self.__port))
114
+ try:
115
+ self.__sct.shutdown(socket.SHUT_RDWR)
116
+ self.__sct.close()
117
+ except (OSError, Exception): pass # idc
118
+ return
119
+
120
+ self.__robot.write_log("TP: Connected: " + str(self.__port))
109
121
  while not self.__stop_thread:
110
122
  try:
111
123
  dt_ln = struct.pack('<I', len(self.out_bytes))
@@ -118,7 +130,7 @@ class TalkPort:
118
130
  except (ConnectionAbortedError, BrokenPipeError, OSError):
119
131
  # возникает при отключении сокета
120
132
  break
121
- self.__robot.write_log("disconnected: " + str(self.__port))
133
+ self.__robot.write_log("LP: Disconnected: " + str(self.__port))
122
134
  try:
123
135
  self.__sct.shutdown(socket.SHUT_RDWR)
124
136
  self.__sct.close()
@@ -252,7 +252,7 @@ class TitanCOM:
252
252
  self.__robot.robot_info.com_count_dev = comm_counter
253
253
  comm_counter = 0
254
254
 
255
- time.sleep(0.001)
255
+ time.sleep(0.002)
256
256
  self.__robot.robot_info.com_time_dev = round(time.time() * 10000) - start_time
257
257
  start_time = round(time.time() * 10000)
258
258
  except Exception as e:
@@ -14,6 +14,10 @@ from .internal.common.robot import Robot
14
14
 
15
15
 
16
16
  class Shufflecad:
17
+ LOG_INFO: str = "info"
18
+ LOG_WARNING: str = "warning"
19
+ LOG_ERROR: str = "error"
20
+
17
21
  def __init__(self, robot: Robot):
18
22
  self.__robot = robot
19
23
  self.variables_array: List[ShuffleVariable] = list()
@@ -43,8 +47,8 @@ class Shufflecad:
43
47
  raise SystemExit("Exited")
44
48
 
45
49
  # outcad methods
46
- def print_to_log(self, var: str, color: str = "#сссссс") -> None:
47
- self.print_array.append(var + color)
50
+ def print_to_log(self, message: str, message_type: str = LOG_INFO, color: str = "#сссссс") -> None:
51
+ self.print_array.append(message_type + "@" + message + color)
48
52
 
49
53
  def get_print_array(self) -> List[str]:
50
54
  return self.print_array
@@ -81,7 +85,7 @@ class ShuffleVariable(object):
81
85
 
82
86
  def set_radar(self, value: list) -> None:
83
87
  complete_list = list()
84
- for i in range(0, 360):
88
+ for i in range(len(value)):
85
89
  complete_list.append(i)
86
90
  complete_list.append(value[i])
87
91
  self.value = "+".join(map(str, complete_list))
@@ -11,7 +11,6 @@ class RobotVmxTitan(Robot):
11
11
 
12
12
  super().__init__(is_real_robot, conf)
13
13
  self.__studica_internal = StudicaInternal(self, conf)
14
- self.__reseted_yaw_val = 0.0
15
14
 
16
15
  signal.signal(signal.SIGTERM, self.handler)
17
16
  signal.signal(signal.SIGINT, self.handler)
@@ -76,24 +75,7 @@ class RobotVmxTitan(Robot):
76
75
 
77
76
  @property
78
77
  def yaw(self):
79
- return self.__studica_internal.yaw_unlim
80
-
81
- @property
82
- def yaw(self):
83
- return self.__normalize_angle(self.__get_pure_yaw() - self.__reseted_yaw_val)
84
-
85
- def reset_yaw(self, value: float = 0.0):
86
- self.__reseted_yaw_val = self.__normalize_angle(self.__get_pure_yaw() - value)
87
-
88
- def __get_pure_yaw(self):
89
78
  return self.__studica_internal.yaw
90
-
91
- def __normalize_angle(self, angle: float) -> float:
92
- if angle < -180:
93
- return angle + 360
94
- elif angle > 180:
95
- return angle - 360
96
- return angle
97
79
 
98
80
  @property
99
81
  def us_1(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: robocad-py
3
- Version: 1.1.0.0
3
+ Version: 1.3.1.0
4
4
  Summary: python lib for real and virtual robots
5
5
  Home-page: https://github.com/Soft-V/robocad-py
6
6
  Author: Airat Abdrakov
@@ -10,7 +10,7 @@ classifiers = [
10
10
 
11
11
  setup(
12
12
  name='robocad-py',
13
- version='1.1.0.0',
13
+ version='1.3.1.0',
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