diff --git a/client.py b/client.py
index 6228587..7462c5b 100644
--- a/client.py
+++ b/client.py
@@ -8,23 +8,25 @@ import tkinter as tk
from func import *
window = tk.Tk()
-window.geometry('520x300')
+window.geometry("520x300")
label = tk.Label(window, text="Hello, world!")
label.pack()
-all_files = glob.glob("data/data.txt")
+all_files = glob.glob("data/*.nc")
file = all_files[0]
-data = []
-with open(file, "r") as fp:
- lines = fp.readlines()
- for l in lines:
- r = l.strip().split(",")
- r[1] = float(r[1])
- r[2] = float(r[2])
- r[3] = float(r[3])
+data = [
+ ("line", 0, 0, 277.8, 0, 5, 0),
+]
+# with open(file, "r") as fp:
+# lines = fp.readlines()
+# for l in lines:
+# r = l.strip().split(",")
+# r[1] = float(r[1])
+# r[2] = float(r[2])
+# r[3] = float(r[3])
- data.append(r)
+# data.append(r)
client = ModbusTcpClient(
host=MODBUS_SERVER_HOST,
@@ -44,7 +46,7 @@ try:
bulb(GOTO_Y, False, client)
get_or_set_speed(10, client)
-
+
# ставим пользовательские переменные в ноль
set_user_reg_800(
[
@@ -112,6 +114,6 @@ except Exception as e:
print("error", e)
finally:
client.close()
-
-if __name__=="__main__":
- window.mainloop()
\ No newline at end of file
+
+if __name__ == "__main__":
+ window.mainloop()
diff --git a/client_socket.py b/client_socket.py
index 1926c61..f578fb0 100644
--- a/client_socket.py
+++ b/client_socket.py
@@ -19,12 +19,12 @@ class SocketRobotArm:
line_smooth = 9
line_tool = 1
- global_speed = 100
- physical_speed = 50
+ global_speed = 10
+ physical_speed = 10
# laser_id = 15
laser_id = 14
# filename = 'half-sphere-no-angle'
- filename = "half-sphere"
+ filename = "test"
urdf_filename = "sample"
pass_size = 4
@@ -54,6 +54,7 @@ class SocketRobotArm:
threading.Thread(target=self.run_pybullet, daemon=True).start()
+ print((self.port, self.host))
self.socket.connect((self.host, self.port))
self.cycle_base()
@@ -125,7 +126,8 @@ class SocketRobotArm:
self.tkinter_info_label.pack()
self.tkinter_root.update()
- step = 2
+ step = 4
+ empty = 1
for i in range(0, len(self.add_rcc_list), step):
if not self.tkinter_info_label:
return
@@ -136,11 +138,14 @@ class SocketRobotArm:
# self.update_text(m, text=f"Отправка данных {i}...{i+step-1}")
self.tkinter_info_label.config(text=f"Отправка данных {i}...{i+step-1}")
self.tkinter_root.update()
-
+ # print(empty)
self.send_data(
- make_addrcc_data(self.add_rcc_list[i : i + step], int(not i))
+ make_addrcc_data(
+ self.add_rcc_list[i : i + step], empty
+ )
)
- time.sleep(0.5)
+ empty = 0
+ time.sleep(0.05)
def imitate(self):
points = self.steps_from_file()
@@ -236,7 +241,7 @@ class SocketRobotArm:
def make_world_step(self, type, point):
step = {
- "oneshot": "0",
+ "oneshot": "1",
"delay": "0.0",
"speed": str(self.line_speed),
"smooth": str(self.line_smooth),
diff --git a/data/test.nc.result b/data/test.nc.result
new file mode 100644
index 0000000..1dee1e5
--- /dev/null
+++ b/data/test.nc.result
@@ -0,0 +1,19 @@
+X165 Y0
+X330 Y0
+X500 Y165
+X500 Y330
+X330 Y500
+X165 Y500
+X0 Y330
+X0 Y165
+Z-50 V40 X0 Y0
+Z-50 V40 X165 Y0
+Z-50 V40 X330 Y0
+Z-50 V-40 X500 Y165
+Z-50 V-40 X500 Y330
+Z-50 V-40 X330 Y500
+Z-50 V-40 X165 Y500
+Z-50 V40 X0 Y330
+Z-50 V40 X0 Y165
+Z-50 V40 X0 Y0
+X0 Y0
\ No newline at end of file
diff --git a/func.py b/func.py
index ca89f07..9765429 100644
--- a/func.py
+++ b/func.py
@@ -1,7 +1,9 @@
# Настройки клиента Modbus
-MODBUS_SERVER_HOST = "192.168.70.55" # IP-адрес Modbus-сервера
+# MODBUS_SERVER_HOST = "192.168.70.55" # IP-адрес Modbus-сервера
+MODBUS_SERVER_HOST = "192.168.70.65" # IP-адрес Modbus-сервера
MODBUS_SERVER_PORT = 502
-MODBUS_SLAVE_ID = 11
+# MODBUS_SLAVE_ID = 11
+MODBUS_SLAVE_ID = 22
indent = 21100
s = 800
diff --git a/urdf/sample.urdf b/urdf/sample.urdf
index b17f2af..041f39d 100644
--- a/urdf/sample.urdf
+++ b/urdf/sample.urdf
@@ -5,11 +5,11 @@
-
+
-
+
@@ -20,7 +20,7 @@
-
+
@@ -35,7 +35,7 @@
-
+
@@ -50,7 +50,7 @@
-
+
@@ -65,7 +65,7 @@
-
+
@@ -80,7 +80,7 @@
-
+
@@ -96,7 +96,7 @@
-
+
@@ -104,7 +104,7 @@
-
+
@@ -112,7 +112,7 @@
-
+
@@ -120,7 +120,7 @@
-
+
@@ -128,7 +128,7 @@
-
+