stop immediately

This commit is contained in:
aarizona 2024-08-21 16:00:55 +03:00
parent 54bb74b2f5
commit 99e124bb00
8 changed files with 526 additions and 68 deletions

View File

@ -15,6 +15,14 @@
"detail": "func", "detail": "func",
"documentation": {} "documentation": {}
}, },
{
"label": "*",
"importPath": "func",
"description": "func",
"isExtraImport": true,
"detail": "func",
"documentation": {}
},
{ {
"label": "ModbusTcpClient", "label": "ModbusTcpClient",
"importPath": "pymodbus.client", "importPath": "pymodbus.client",
@ -39,38 +47,6 @@
"detail": "pymodbus.client", "detail": "pymodbus.client",
"documentation": {} "documentation": {}
}, },
{
"label": "Endian",
"importPath": "pymodbus.constants",
"description": "pymodbus.constants",
"isExtraImport": true,
"detail": "pymodbus.constants",
"documentation": {}
},
{
"label": "Endian",
"importPath": "pymodbus.constants",
"description": "pymodbus.constants",
"isExtraImport": true,
"detail": "pymodbus.constants",
"documentation": {}
},
{
"label": "BinaryPayloadDecoder",
"importPath": "pymodbus.payload",
"description": "pymodbus.payload",
"isExtraImport": true,
"detail": "pymodbus.payload",
"documentation": {}
},
{
"label": "BinaryPayloadDecoder",
"importPath": "pymodbus.payload",
"description": "pymodbus.payload",
"isExtraImport": true,
"detail": "pymodbus.payload",
"documentation": {}
},
{ {
"label": "time", "label": "time",
"kind": 6, "kind": 6,
@ -89,12 +65,54 @@
"detail": "glob", "detail": "glob",
"documentation": {} "documentation": {}
}, },
{
"label": "socket",
"kind": 6,
"isExtraImport": true,
"importPath": "socket",
"description": "socket",
"detail": "socket",
"documentation": {}
},
{
"label": "json",
"kind": 6,
"isExtraImport": true,
"importPath": "json",
"description": "json",
"detail": "json",
"documentation": {}
},
{
"label": "pprint",
"importPath": "pprint",
"description": "pprint",
"isExtraImport": true,
"detail": "pprint",
"documentation": {}
},
{
"label": "Endian",
"importPath": "pymodbus.constants",
"description": "pymodbus.constants",
"isExtraImport": true,
"detail": "pymodbus.constants",
"documentation": {}
},
{
"label": "BinaryPayloadDecoder",
"importPath": "pymodbus.payload",
"description": "pymodbus.payload",
"isExtraImport": true,
"detail": "pymodbus.payload",
"documentation": {}
},
{ {
"label": "multiply_1000", "label": "multiply_1000",
"kind": 2, "kind": 2,
"importPath": "client", "importPath": "client",
"description": "client", "description": "client",
"peekOfCode": "def multiply_1000(n):\n return n * 1000\ntry:\n total = 0\n state = None\n step = 0\n counter = 0\n paths = data\n paths = [\n (\"line\", multiply_1000(300), multiply_1000(300), 0),", "peekOfCode": "def multiply_1000(n):\n return int(n * 1000)\nGOTO_Y = 5\ntry:\n total = 0\n state = None\n step = 0\n counter = 0\n paths = data\n paths = [",
"detail": "client", "detail": "client",
"documentation": {} "documentation": {}
}, },
@ -134,6 +152,87 @@
"detail": "client", "detail": "client",
"documentation": {} "documentation": {}
}, },
{
"label": "GOTO_Y",
"kind": 5,
"importPath": "client",
"description": "client",
"peekOfCode": "GOTO_Y = 5\ntry:\n total = 0\n state = None\n step = 0\n counter = 0\n paths = data\n paths = [\n (\"line\", 0, 0, 277.8, 0, 5, 0),\n # (\"line\", 30, 30, 0, 0, 0, 0),",
"detail": "client",
"documentation": {}
},
{
"label": "s",
"kind": 5,
"importPath": "client_socket",
"description": "client_socket",
"peekOfCode": "s = socket.socket()\nhost = MODBUS_SERVER_HOST\nport = 9760\ns.connect((host, port))\n# print(s)\n# получить версию оборудования\nrequest_data = {\n \"dsID\": \"www.hc-system.com.RemoteMonitor\",\n \"reqType\": \"query\",\n \"queryAddr\": [\"version\", \"curMold\"],",
"detail": "client_socket",
"documentation": {}
},
{
"label": "host",
"kind": 5,
"importPath": "client_socket",
"description": "client_socket",
"peekOfCode": "host = MODBUS_SERVER_HOST\nport = 9760\ns.connect((host, port))\n# print(s)\n# получить версию оборудования\nrequest_data = {\n \"dsID\": \"www.hc-system.com.RemoteMonitor\",\n \"reqType\": \"query\",\n \"queryAddr\": [\"version\", \"curMold\"],\n}",
"detail": "client_socket",
"documentation": {}
},
{
"label": "port",
"kind": 5,
"importPath": "client_socket",
"description": "client_socket",
"peekOfCode": "port = 9760\ns.connect((host, port))\n# print(s)\n# получить версию оборудования\nrequest_data = {\n \"dsID\": \"www.hc-system.com.RemoteMonitor\",\n \"reqType\": \"query\",\n \"queryAddr\": [\"version\", \"curMold\"],\n}\nrequest_data = {",
"detail": "client_socket",
"documentation": {}
},
{
"label": "request_data",
"kind": 5,
"importPath": "client_socket",
"description": "client_socket",
"peekOfCode": "request_data = {\n \"dsID\": \"www.hc-system.com.RemoteMonitor\",\n \"reqType\": \"query\",\n \"queryAddr\": [\"version\", \"curMold\"],\n}\nrequest_data = {\n \"dsID\": \"www.hc-system.com.HCRemoteCommand\",\n \"reqType\": \"AddRCC\",\n \"emptyList\": \"1\",\n \"packID\": \"0\",",
"detail": "client_socket",
"documentation": {}
},
{
"label": "request_data",
"kind": 5,
"importPath": "client_socket",
"description": "client_socket",
"peekOfCode": "request_data = {\n \"dsID\": \"www.hc-system.com.HCRemoteCommand\",\n \"reqType\": \"AddRCC\",\n \"emptyList\": \"1\",\n \"packID\": \"0\",\n \"instructions\": [{\"oneshot\": \"0\", \"action\": \"51\", \"isUse\": \"0\", \"speed\": \"1234\"}],\n}\nrequest_data = {\n \"dsID\": \"www.hc-system.com.HCRemoteCommand\",\n \"reqType\": \"command\",",
"detail": "client_socket",
"documentation": {}
},
{
"label": "request_data",
"kind": 5,
"importPath": "client_socket",
"description": "client_socket",
"peekOfCode": "request_data = {\n \"dsID\": \"www.hc-system.com.HCRemoteCommand\",\n \"reqType\": \"command\",\n \"packID\": \"0\",\n \"cmdReply\": [\"AddRCC\", \"r1\"],\n}\ns.send(str.encode(json.dumps(request_data)))\nresponse_data = s.recv(1024)\nresponse = json.loads(response_data)\npprint(response)",
"detail": "client_socket",
"documentation": {}
},
{
"label": "response_data",
"kind": 5,
"importPath": "client_socket",
"description": "client_socket",
"peekOfCode": "response_data = s.recv(1024)\nresponse = json.loads(response_data)\npprint(response)",
"detail": "client_socket",
"documentation": {}
},
{
"label": "response",
"kind": 5,
"importPath": "client_socket",
"description": "client_socket",
"peekOfCode": "response = json.loads(response_data)\npprint(response)",
"detail": "client_socket",
"documentation": {}
},
{ {
"label": "two_byte_convert", "label": "two_byte_convert",
"kind": 2, "kind": 2,
@ -184,7 +283,7 @@
"kind": 2, "kind": 2,
"importPath": "func", "importPath": "func",
"description": "func", "description": "func",
"peekOfCode": "def set_user_register(n, values, client):\n client.write_registers(indent + s + k * n, values, MODBUS_SLAVE_ID)\ndef to_double(integr):\n return [(integr >> 16) & 0xFFFF, integr & 0xFFFF]\ndef set_user_reg_800(data, client):\n for item in data:\n d, values = item\n set_user_register(d, values, client)\ndef start_in_auto(client):\n # старт в авторежиме single loop", "peekOfCode": "def set_user_register(n, values, client):\n client.write_registers(indent + s + k * n, values, MODBUS_SLAVE_ID)\ndef to_double(integr):\n print(integr)\n return [(integr >> 16) & 0xFFFF, integr & 0xFFFF]\ndef set_user_reg_800(data, client):\n for item in data:\n d, values = item\n set_user_register(d, values, client)\ndef start_in_auto(client):",
"detail": "func", "detail": "func",
"documentation": {} "documentation": {}
}, },
@ -193,7 +292,7 @@
"kind": 2, "kind": 2,
"importPath": "func", "importPath": "func",
"description": "func", "description": "func",
"peekOfCode": "def to_double(integr):\n return [(integr >> 16) & 0xFFFF, integr & 0xFFFF]\ndef set_user_reg_800(data, client):\n for item in data:\n d, values = item\n set_user_register(d, values, client)\ndef start_in_auto(client):\n # старт в авторежиме single loop\n client.write_register(20002, 1, MODBUS_SLAVE_ID)", "peekOfCode": "def to_double(integr):\n print(integr)\n return [(integr >> 16) & 0xFFFF, integr & 0xFFFF]\ndef set_user_reg_800(data, client):\n for item in data:\n d, values = item\n set_user_register(d, values, client)\ndef start_in_auto(client):\n # старт в авторежиме single loop\n client.write_register(20002, 1, MODBUS_SLAVE_ID)",
"detail": "func", "detail": "func",
"documentation": {} "documentation": {}
}, },
@ -202,7 +301,7 @@
"kind": 2, "kind": 2,
"importPath": "func", "importPath": "func",
"description": "func", "description": "func",
"peekOfCode": "def set_user_reg_800(data, client):\n for item in data:\n d, values = item\n set_user_register(d, values, client)\ndef start_in_auto(client):\n # старт в авторежиме single loop\n client.write_register(20002, 1, MODBUS_SLAVE_ID)", "peekOfCode": "def set_user_reg_800(data, client):\n for item in data:\n d, values = item\n set_user_register(d, values, client)\ndef start_in_auto(client):\n # старт в авторежиме single loop\n client.write_register(20002, 1, MODBUS_SLAVE_ID)\ndef stop_immediately(client):\n client.write_register(20001, 1, MODBUS_SLAVE_ID)",
"detail": "func", "detail": "func",
"documentation": {} "documentation": {}
}, },
@ -211,7 +310,16 @@
"kind": 2, "kind": 2,
"importPath": "func", "importPath": "func",
"description": "func", "description": "func",
"peekOfCode": "def start_in_auto(client):\n # старт в авторежиме single loop\n client.write_register(20002, 1, MODBUS_SLAVE_ID)", "peekOfCode": "def start_in_auto(client):\n # старт в авторежиме single loop\n client.write_register(20002, 1, MODBUS_SLAVE_ID)\ndef stop_immediately(client):\n client.write_register(20001, 1, MODBUS_SLAVE_ID)",
"detail": "func",
"documentation": {}
},
{
"label": "stop_immediately",
"kind": 2,
"importPath": "func",
"description": "func",
"peekOfCode": "def stop_immediately(client):\n client.write_register(20001, 1, MODBUS_SLAVE_ID)",
"detail": "func", "detail": "func",
"documentation": {} "documentation": {}
}, },
@ -301,7 +409,7 @@
"kind": 5, "kind": 5,
"importPath": "test", "importPath": "test",
"description": "test", "description": "test",
"peekOfCode": "client = ModbusTcpClient(\n host=MODBUS_SERVER_HOST,\n port=MODBUS_SERVER_PORT,\n)\nclient.connect()\n# максимальное количество coils = 286\n# bulb(0, client)\n# get_coordinates()\nget_or_set_speed(30, client)\nclient.close()", "peekOfCode": "client = ModbusTcpClient(\n host=MODBUS_SERVER_HOST,\n port=MODBUS_SERVER_PORT,\n)\nclient.connect()\n# максимальное количество coils = 286\nbulb(5,True, client)\n# get_coordinates()\nget_or_set_speed(30, client)\nclient.close()",
"detail": "test", "detail": "test",
"documentation": {} "documentation": {}
} }

Binary file not shown.

Binary file not shown.

View File

@ -3,8 +3,6 @@ from func import *
# from func import set_user_reg_800 # from func import set_user_reg_800
from pymodbus.client import ModbusTcpClient from pymodbus.client import ModbusTcpClient
from pymodbus.constants import Endian
from pymodbus.payload import BinaryPayloadDecoder
import time import time
import glob import glob
@ -35,9 +33,10 @@ with open(file, "r") as fp:
# print(data) # print(data)
def multiply_1000(n): def multiply_1000(n):
return n * 1000 return int(n * 1000)
GOTO_Y = 5
try: try:
total = 0 total = 0
state = None state = None
@ -46,15 +45,19 @@ try:
paths = data paths = data
paths = [ paths = [
("line", multiply_1000(300), multiply_1000(300), 0), ("line", 0, 0, 277.8, 0, 5, 0),
("line", multiply_1000(300), multiply_1000(-300), 0), # ("line", 30, 30, 0, 0, 0, 0),
("line", multiply_1000(-300), multiply_1000(-300), 0), # ("line", 30, -30, 0, 0, 0, 0),
("line", multiply_1000(-300), multiply_1000(300), 0), # ("line", 0, 0, 0, 0, 0, 5),
# ("line", 0, multiply_1000(-50), 0), # ("line", -30, -30, 0, 0, 0, 0),
# ("line", -30, 30, 0, 0, 0, 0),
# ("line", 0, 0, 0, 0, -5, -5),
# ("line", 0, 0, 30, 0, 0, 0),
] ]
bulb(2, False, client) bulb(GOTO_Y, False, client)
get_or_set_speed(10, client) get_or_set_speed(10, client)
# ставим пользовательские переменные в ноль # ставим пользовательские переменные в ноль
set_user_reg_800( set_user_reg_800(
[ [
@ -67,7 +70,7 @@ try:
], ],
client, client,
) )
_, _, _, u_target, v_target, w_target = collect_coordinates(client) # _, _, _, u_target, v_target, w_target = collect_coordinates(client)
# старт в авторежиме single loop # старт в авторежиме single loop
start_in_auto(client) start_in_auto(client)
@ -75,8 +78,7 @@ try:
while True: while True:
time.sleep(0.01) time.sleep(0.01)
total += 1 total += 1
green_light = client.read_coils(0, 1, MODBUS_SLAVE_ID).bits[0] green_light = client.read_coils(GOTO_Y, 1, MODBUS_SLAVE_ID).bits[0]
# print(f"total {total}, state {state}, green light {green_light}")
if state == green_light: if state == green_light:
continue continue
@ -89,35 +91,33 @@ try:
x, y, z, u, v, w = collect_coordinates(client) x, y, z, u, v, w = collect_coordinates(client)
if step >= len(paths): if step >= len(paths):
counter += 1 # counter += 1
step = 0 # step = 0
stop_immediately(client)
exit()
current_step = paths[step] current_step = paths[step]
line_type, *coord = current_step line_type, *coord = current_step
print(f"{line_type} {step} of {len(paths)} {current_step}") print(f"{line_type} {step} of {len(paths)} {current_step}")
if line_type == "line": if line_type == "line":
set_x, set_y, set_z = coord set_x, set_y, set_z, set_u, set_v, set_w = coord
u_set = u - u_target
v_set = v - v_target
w_set = w - w_target
set_user_reg_800( set_user_reg_800(
[ [
(0, to_double(set_x)), (0, to_double(multiply_1000(set_x))),
(1, to_double(set_y)), (1, to_double(multiply_1000(set_y))),
(2, to_double(set_z)), (2, to_double(multiply_1000(set_z))),
(3, to_double(0)), (3, to_double(multiply_1000(set_u))),
(4, to_double(0)), (4, to_double(multiply_1000(set_v))),
(5, to_double(0)), (5, to_double(multiply_1000(set_w))),
], ],
client, client,
) )
bulb(4, True, client) # bulb(4, True, client)
if not x == y == z == 0: if not x == y == z == u == v == w == 0:
bulb(0, True, client) bulb(GOTO_Y, True, client)
step += 1 step += 1

38
client_socket.py Normal file
View File

@ -0,0 +1,38 @@
import socket
import json
from pprint import pprint
from func import *
s = socket.socket()
host = MODBUS_SERVER_HOST
port = 9760
s.connect((host, port))
# print(s)
# получить версию оборудования
request_data = {
"dsID": "www.hc-system.com.RemoteMonitor",
"reqType": "query",
"queryAddr": ["version", "curMold"],
}
request_data = {
"dsID": "www.hc-system.com.HCRemoteCommand",
"reqType": "AddRCC",
"emptyList": "1",
"packID": "0",
"instructions": [{"oneshot": "0", "action": "51", "isUse": "0", "speed": "1234"}],
}
request_data = {
"dsID": "www.hc-system.com.HCRemoteCommand",
"reqType": "command",
"packID": "0",
"cmdReply": ["AddRCC", "r1"],
}
s.send(str.encode(json.dumps(request_data)))
response_data = s.recv(1024)
response = json.loads(response_data)
pprint(response)

307
data/5X_PC_faces6.NC Normal file
View File

@ -0,0 +1,307 @@
%0001
(PART: Sborka s zagotovkoi - ZN1984_MILLING)
(DATE: 16-AUG-2024 10:54:24)
(T02|END MILL|4mm|D=4|L=30|R=0)
(MACHINE TIME: 00:04:42)
N1 G91 G28 Z0.
N2 G90
N3 G69
N4 G49
N5 G54
(END MILL|4mm|D=4|L=30|R=0)
N6 T02 M06
N7 G43 H02
N8 (5X - 5X-PC-FACES6)
N9 S3500 M03
N10 G54
N11 M61 (A - BRAKE OFF)
N12 M63 (C - BRAKE OFF)
N13 G00 A0. C0.
N14 G43.4 H02
N15 G68.3 X0. Y0. Z0. I-45. J0. K-62.494
N16 G53.1
N17 G00 G90 X31.925 Y43.797
N18 Z102.497 M08
N19 G69
N20 X80.894 Y6.128 Z12.642
N21 X68.978 Y-0.077 Z-0.793
N22 G01 X68.35 Y-0.404 Z-1.5 F300.
N23 X65.246 Y5.558 F1000.
N24 A-44.58 C-60.48
N25 A-44.196 C-58.437
N26 A-43.844 C-56.339
N27 A-43.531 C-54.215
N28 A-43.258 C-52.068
N29 A-43.025 C-49.901
N30 A-42.834 C-47.717
N31 A-42.684 C-45.518
N32 A-42.577 C-43.309
N33 A-42.512 C-41.093
N34 A-42.49 C-38.872
N35 A-42.511 C-36.652
N36 A-42.574 C-34.436
N37 A-42.68 C-32.226
N38 A-42.829 C-30.028
N39 A-43.019 C-27.843
N40 A-43.251 C-25.675
N41 A-43.523 C-23.528
N42 A-43.835 C-21.403
N43 Y5.559 A-44.186 C-19.304
N44 A-44.574 C-17.232
N45 A-45. C-15.191
N46 X63.548 Y6.013 C-14.786
N47 X60.643 Y6.761 C-14.096
N48 X57.73 Y7.474 C-13.406
N49 X54.808 Y8.152 C-12.716
N50 X51.879 Y8.794 C-12.026
N51 X48.941 Y9.402 C-11.335
N52 X45.997 Y9.973 C-10.645
N53 X43.046 Y10.51 C-9.955
N54 X40.089 Y11.01 C-9.265
N55 X37.125 Y11.476 C-8.575
N56 X34.157 Y11.905 C-7.884
N57 X31.728 Y12.229 C-7.321
N58 X29.43 Y12.513 C-6.788
N59 X26.449 Y12.85 C-6.097
N60 X23.464 Y13.151 C-5.407
N61 X20.476 Y13.415 C-4.717
N62 X17.485 Y13.644 C-4.027
N63 X14.492 Y13.837 C-3.336
N64 X11.496 Y13.993 C-2.646
N65 X8.498 Y14.114 C-1.956
N66 X5.5 Y14.198 C-1.266
N67 X2.5 Y14.246 C-0.575
N68 X-0.131 Y14.259 C0.03
N69 X-3.262 Y14.237 C0.751
N70 X-6.262 Y14.18 C1.441
N71 X-9.261 Y14.086 C2.131
N72 X-12.258 Y13.957 C2.822
N73 X-15.253 Y13.791 C3.512
N74 X-18.247 Y13.589 C4.202
N75 X-21.238 Y13.351 C4.893
N76 X-24.225 Y13.077 C5.583
N77 X-27.21 Y12.768 C6.274
N78 X-30.19 Y12.422 C6.964
N79 X-33.166 Y12.04 C7.654
N80 X-35.885 Y11.659 C8.286
N81 X-38.851 Y11.209 C8.976
N82 X-41.812 Y10.723 C9.667
N83 X-44.767 Y10.201 C10.357
N84 X-47.715 Y9.644 C11.048
N85 X-50.657 Y9.051 C11.738
N86 X-53.591 Y8.423 C12.429
N87 X-56.517 Y7.76 C13.119
N88 X-59.435 Y7.061 C13.81
N89 X-62.345 Y6.327 C14.5
N90 X-65.246 Y5.559 C15.191
N91 A-44.58 C17.204
N92 A-44.196 C19.247
N93 Y5.558 A-43.844 C21.345
N94 A-43.531 C23.469
N95 A-43.258 C25.616
N96 A-43.025 C27.783
N97 A-42.834 C29.968
N98 A-42.684 C32.166
N99 A-42.577 C34.375
N100 A-42.512 C36.592
N101 A-42.49 C38.812
N102 A-42.511 C41.032
N103 A-42.574 C43.249
N104 A-42.68 C45.458
N105 A-42.829 C47.657
N106 A-43.019 C49.842
N107 A-43.251 C52.009
N108 A-43.523 C54.157
N109 A-43.835 C56.281
N110 A-44.186 C58.38
N111 A-44.574 C60.452
N112 A-45. C62.494
N113 X-71.455 Y-6.365
N114 A-44.622 C64.406
N115 A-44.254 C66.483
N116 A-43.923 C68.586
N117 A-43.632 C70.713
N118 A-43.38 C72.861
N119 A-43.169 C75.027
N120 A-42.999 C77.209
N121 A-42.87 C79.403
N122 A-42.784 C81.606
N123 A-42.74 C83.815
N124 A-42.739 C86.025
N125 A-42.78 C88.234
N126 A-42.863 C90.437
N127 A-42.989 C92.632
N128 A-43.156 C94.815
N129 A-43.364 C96.982
N130 A-43.614 C99.132
N131 A-43.902 C101.26
N132 A-44.23 C103.365
N133 A-44.597 C105.443
N134 A-45. C107.494
N135 X-69.282 Y-13.26
N136 A-44.353 C109.317
N137 A-43.71 C111.266
N138 A-43.1 C113.261
N139 A-42.526 C115.3
N140 A-41.988 C117.382
N141 A-41.489 C119.507
N142 A-41.03 C121.673
N143 A-40.612 C123.877
N144 A-40.236 C126.116
N145 A-39.905 C128.389
N146 A-39.618 C130.691
N147 A-39.378 C133.019
N148 A-39.184 C135.369
N149 A-39.038 C137.735
N150 A-38.939 C140.114
N151 A-38.89 C142.501
N152 A-38.889 C144.89
N153 A-38.936 C147.277
N154 A-39.032 C149.657
N155 A-39.177 C152.024
N156 A-39.368 C154.374
N157 A-39.607 C156.703
N158 A-39.892 C159.007
N159 A-40.221 C161.281
N160 A-40.595 C163.522
N161 A-41.011 C165.727
N162 A-41.468 C167.894
N163 A-41.966 C170.021
N164 A-42.502 C172.105
N165 A-43.075 C174.146
N166 A-43.683 C176.143
N167 A-44.325 C178.094
N168 A-45. C180.
N169 X-62.017
N170 A-44.839 C182.886
N171 A-44.767 C185.012
N172 A-44.734 C187.142
N173 A-44.741 C189.273
N174 A-44.788 C191.402
N175 A-44.875 C193.526
N176 A-45. C195.643
N177 X-59.875 Y-12.671 C195.089
N178 X-57.459 Y-12.034 C194.467
N179 X-54.55 Y-11.304 C193.72
N180 X-51.631 Y-10.611 C192.973
N181 X-48.704 Y-9.957 C192.225
N182 X-45.769 Y-9.341 C191.478
N183 X-42.826 Y-8.764 C190.731
N184 X-39.875 Y-8.224 C189.984
N185 X-36.918 Y-7.724 C189.237
N186 X-33.954 Y-7.261 C188.489
N187 X-31.192 Y-6.866 C187.794
N188 X-28.921 Y-6.567 C187.224
N189 X-26.44 Y-6.266 C186.601
N190 X-23.458 Y-5.941 C185.854
N191 X-20.472 Y-5.654 C185.107
N192 X-17.483 Y-5.407 C184.359
N193 X-14.49 Y-5.198 C183.612
N194 X-11.495 Y-5.029 C182.865
N195 X-8.498 Y-4.898 C182.117
N196 X-5.499 Y-4.807 C181.37
N197 X-2.5 Y-4.755 C180.623
N198 X0.288 Y-4.741 C179.928
N199 X2.576 Y-4.756 C179.358
N200 X5.076 Y-4.797 C178.735
N201 X8.075 Y-4.883 C177.988
N202 X11.072 Y-5.008 C177.241
N203 X14.068 Y-5.172 C176.493
N204 X17.061 Y-5.375 C175.746
N205 X20.052 Y-5.617 C174.998
N206 X23.039 Y-5.898 C174.251
N207 X26.022 Y-6.218 C173.504
N208 X29.001 Y-6.577 C172.756
N209 X31.583 Y-6.92 C172.107
N210 X34.161 Y-7.292 C171.459
N211 X37.125 Y-7.757 C170.711
N212 X40.083 Y-8.261 C169.964
N213 X43.034 Y-8.803 C169.216
N214 X45.978 Y-9.384 C168.469
N215 X48.914 Y-10.003 C167.721
N216 X51.842 Y-10.66 C166.974
N217 X54.761 Y-11.356 C166.226
N218 X57.671 Y-12.089 C165.478
N219 X60.571 Y-12.86 C164.731
N220 X62.016 Y-13.26 A-44.839 C167.243
N221 A-44.767 C169.369
N222 A-44.734 C171.499
N223 A-44.741 C173.63
N224 A-44.788 C175.76
N225 A-44.875 C177.884
N226 A-45. C180.
N227 X69.282
N228 A-44.353 C181.823
N229 A-43.71 C183.773
N230 A-43.1 C185.767
N231 A-42.526 C187.806
N232 A-41.988 C189.889
N233 A-41.489 C192.014
N234 A-41.03 C194.179
N235 A-40.612 C196.383
N236 A-40.236 C198.623
N237 A-39.905 C200.895
N238 A-39.618 C203.198
N239 A-39.378 C205.525
N240 A-39.184 C207.875
N241 A-39.038 C210.241
N242 A-38.939 C212.621
N243 A-38.89 C215.007
N244 A-38.889 C217.397
N245 A-38.936 C219.784
N246 A-39.032 C222.163
N247 A-39.177 C224.53
N248 A-39.368 C226.881
N249 A-39.607 C229.21
N250 A-39.892 C231.513
N251 A-40.221 C233.787
N252 A-40.595 C236.028
N253 A-41.011 C238.234
N254 A-41.468 C240.401
N255 A-41.966 C242.527
N256 A-42.502 C244.612
N257 A-43.075 C246.653
N258 A-43.683 C248.649
N259 A-44.325 C250.6
N260 A-45. C252.506
N261 X71.455 Y-6.365
N262 A-44.622 C254.419
N263 A-44.254 C256.496
N264 A-43.923 C258.599
N265 A-43.632 C260.725
N266 A-43.38 C262.873
N267 A-43.169 C265.04
N268 A-42.999 C267.222
N269 A-42.87 C269.416
N270 A-42.784 C271.619
N271 A-42.74 C273.827
N272 A-42.739 C276.038
N273 A-42.78 C278.246
N274 A-42.863 C280.45
N275 A-42.989 C282.644
N276 A-43.156 C284.827
N277 A-43.364 C286.995
N278 A-43.614 C289.144
N279 A-43.902 C291.273
N280 A-44.23 C293.377
N281 A-44.597 C295.456
N282 A-45. C297.506
N283 X68.35 Y-0.404
N284 X68.978 Y-0.077 Z-0.793 F2000.
N285 G00 X80.894 Y6.128 Z12.642
N286 X106.496 Y19.459 Z41.507
N287 (5X - 5X-PC-FACES6)
N288 G49
N289 M05
N290 G91 G28 Z0.
N291 G91 G28 Y0.
N292 G90
N293 G00 A0. C0.
N294 M51 (A - BRAKE ON)
N295 M53 (C - BRAKE ON)
N296 M30
%

View File

@ -94,6 +94,7 @@ def set_user_register(n, values, client):
def to_double(integr): def to_double(integr):
print(integr)
return [(integr >> 16) & 0xFFFF, integr & 0xFFFF] return [(integr >> 16) & 0xFFFF, integr & 0xFFFF]
@ -105,4 +106,8 @@ def set_user_reg_800(data, client):
def start_in_auto(client): def start_in_auto(client):
# старт в авторежиме single loop # старт в авторежиме single loop
client.write_register(20002, 1, MODBUS_SLAVE_ID) client.write_register(20002, 1, MODBUS_SLAVE_ID)
def stop_immediately(client):
client.write_register(20001, 1, MODBUS_SLAVE_ID)

View File

@ -8,7 +8,7 @@ client = ModbusTcpClient(
client.connect() client.connect()
# максимальное количество coils = 286 # максимальное количество coils = 286
# bulb(0, client) bulb(5,True, client)
# get_coordinates() # get_coordinates()
get_or_set_speed(30, client) get_or_set_speed(30, client)