fix some bugs
This commit is contained in:
parent
edeeb04a62
commit
78fd7ccbc9
@ -234,6 +234,126 @@
|
|||||||
"name": "r_safe_region03",
|
"name": "r_safe_region03",
|
||||||
"retain": false,
|
"retain": false,
|
||||||
"type": "bool"
|
"type": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addr": 40100,
|
||||||
|
"addr_1st": 0,
|
||||||
|
"addr_2nd": 0,
|
||||||
|
"bit_bias": 0,
|
||||||
|
"byte_bias": 0,
|
||||||
|
"function": "",
|
||||||
|
"len": 1,
|
||||||
|
"name": "signal_0",
|
||||||
|
"retain": false,
|
||||||
|
"type": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addr": 40101,
|
||||||
|
"addr_1st": 0,
|
||||||
|
"addr_2nd": 0,
|
||||||
|
"bit_bias": 0,
|
||||||
|
"byte_bias": 0,
|
||||||
|
"function": "",
|
||||||
|
"len": 1,
|
||||||
|
"name": "signal_1",
|
||||||
|
"retain": false,
|
||||||
|
"type": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addr": 40102,
|
||||||
|
"addr_1st": 0,
|
||||||
|
"addr_2nd": 0,
|
||||||
|
"bit_bias": 0,
|
||||||
|
"byte_bias": 0,
|
||||||
|
"function": "",
|
||||||
|
"len": 1,
|
||||||
|
"name": "signal_2",
|
||||||
|
"retain": false,
|
||||||
|
"type": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addr": 40103,
|
||||||
|
"addr_1st": 0,
|
||||||
|
"addr_2nd": 0,
|
||||||
|
"bit_bias": 0,
|
||||||
|
"byte_bias": 0,
|
||||||
|
"function": "",
|
||||||
|
"len": 1,
|
||||||
|
"name": "signal_3",
|
||||||
|
"retain": false,
|
||||||
|
"type": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addr": 40104,
|
||||||
|
"addr_1st": 0,
|
||||||
|
"addr_2nd": 0,
|
||||||
|
"bit_bias": 0,
|
||||||
|
"byte_bias": 0,
|
||||||
|
"function": "",
|
||||||
|
"len": 1,
|
||||||
|
"name": "signal_4",
|
||||||
|
"retain": false,
|
||||||
|
"type": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addr": 40105,
|
||||||
|
"addr_1st": 0,
|
||||||
|
"addr_2nd": 0,
|
||||||
|
"bit_bias": 0,
|
||||||
|
"byte_bias": 0,
|
||||||
|
"function": "",
|
||||||
|
"len": 1,
|
||||||
|
"name": "signal_5",
|
||||||
|
"retain": false,
|
||||||
|
"type": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addr": 40106,
|
||||||
|
"addr_1st": 0,
|
||||||
|
"addr_2nd": 0,
|
||||||
|
"bit_bias": 0,
|
||||||
|
"byte_bias": 0,
|
||||||
|
"function": "",
|
||||||
|
"len": 1,
|
||||||
|
"name": "signal_6",
|
||||||
|
"retain": false,
|
||||||
|
"type": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addr": 40107,
|
||||||
|
"addr_1st": 0,
|
||||||
|
"addr_2nd": 0,
|
||||||
|
"bit_bias": 0,
|
||||||
|
"byte_bias": 0,
|
||||||
|
"function": "",
|
||||||
|
"len": 1,
|
||||||
|
"name": "signal_7",
|
||||||
|
"retain": false,
|
||||||
|
"type": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addr": 40108,
|
||||||
|
"addr_1st": 0,
|
||||||
|
"addr_2nd": 0,
|
||||||
|
"bit_bias": 0,
|
||||||
|
"byte_bias": 0,
|
||||||
|
"function": "",
|
||||||
|
"len": 1,
|
||||||
|
"name": "signal_8",
|
||||||
|
"retain": false,
|
||||||
|
"type": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addr": 40109,
|
||||||
|
"addr_1st": 0,
|
||||||
|
"addr_2nd": 0,
|
||||||
|
"bit_bias": 0,
|
||||||
|
"byte_bias": 0,
|
||||||
|
"function": "",
|
||||||
|
"len": 1,
|
||||||
|
"name": "signal_9",
|
||||||
|
"retain": false,
|
||||||
|
"type": "bool"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rdwr": [
|
"rdwr": [
|
||||||
|
@ -361,6 +361,196 @@
|
|||||||
<c name="value"/>
|
<c name="value"/>
|
||||||
<c name="value_single" type="10" value=""/>
|
<c name="value_single" type="10" value=""/>
|
||||||
</l>
|
</l>
|
||||||
|
<l>
|
||||||
|
<c name="addr" type="2" value="40100"/>
|
||||||
|
<c name="addr_1st" type="2" value="0"/>
|
||||||
|
<c name="addr_2nd" type="2" value="0"/>
|
||||||
|
<c name="bit_bias" type="2" value="0"/>
|
||||||
|
<c name="byte_bias" type="4" value="0"/>
|
||||||
|
<c name="description" type="10" value=""/>
|
||||||
|
<c name="dev_name" type="10" value="autotest"/>
|
||||||
|
<c name="dev_type" type="10" value="MODBUS"/>
|
||||||
|
<c name="end_addr" type="2" value="40100"/>
|
||||||
|
<c name="function" type="10" value=""/>
|
||||||
|
<c name="len" type="2" value="1"/>
|
||||||
|
<c name="name" type="10" value="signal_0"/>
|
||||||
|
<c name="retain" type="1" value="false"/>
|
||||||
|
<c name="rw" type="10" value="rd"/>
|
||||||
|
<c name="type" type="10" value="bool"/>
|
||||||
|
<c name="value"/>
|
||||||
|
<c name="value_single" type="10" value=""/>
|
||||||
|
</l>
|
||||||
|
<l>
|
||||||
|
<c name="addr" type="2" value="40101"/>
|
||||||
|
<c name="addr_1st" type="2" value="0"/>
|
||||||
|
<c name="addr_2nd" type="2" value="0"/>
|
||||||
|
<c name="bit_bias" type="2" value="0"/>
|
||||||
|
<c name="byte_bias" type="4" value="0"/>
|
||||||
|
<c name="description" type="10" value=""/>
|
||||||
|
<c name="dev_name" type="10" value="autotest"/>
|
||||||
|
<c name="dev_type" type="10" value="MODBUS"/>
|
||||||
|
<c name="end_addr" type="2" value="40101"/>
|
||||||
|
<c name="function" type="10" value=""/>
|
||||||
|
<c name="len" type="2" value="1"/>
|
||||||
|
<c name="name" type="10" value="signal_1"/>
|
||||||
|
<c name="retain" type="1" value="false"/>
|
||||||
|
<c name="rw" type="10" value="rd"/>
|
||||||
|
<c name="type" type="10" value="bool"/>
|
||||||
|
<c name="value"/>
|
||||||
|
<c name="value_single" type="10" value=""/>
|
||||||
|
</l>
|
||||||
|
<l>
|
||||||
|
<c name="addr" type="2" value="40102"/>
|
||||||
|
<c name="addr_1st" type="2" value="0"/>
|
||||||
|
<c name="addr_2nd" type="2" value="0"/>
|
||||||
|
<c name="bit_bias" type="2" value="0"/>
|
||||||
|
<c name="byte_bias" type="4" value="0"/>
|
||||||
|
<c name="description" type="10" value=""/>
|
||||||
|
<c name="dev_name" type="10" value="autotest"/>
|
||||||
|
<c name="dev_type" type="10" value="MODBUS"/>
|
||||||
|
<c name="end_addr" type="2" value="40102"/>
|
||||||
|
<c name="function" type="10" value=""/>
|
||||||
|
<c name="len" type="2" value="1"/>
|
||||||
|
<c name="name" type="10" value="signal_2"/>
|
||||||
|
<c name="retain" type="1" value="false"/>
|
||||||
|
<c name="rw" type="10" value="rd"/>
|
||||||
|
<c name="type" type="10" value="bool"/>
|
||||||
|
<c name="value"/>
|
||||||
|
<c name="value_single" type="10" value=""/>
|
||||||
|
</l>
|
||||||
|
<l>
|
||||||
|
<c name="addr" type="2" value="40103"/>
|
||||||
|
<c name="addr_1st" type="2" value="0"/>
|
||||||
|
<c name="addr_2nd" type="2" value="0"/>
|
||||||
|
<c name="bit_bias" type="2" value="0"/>
|
||||||
|
<c name="byte_bias" type="4" value="0"/>
|
||||||
|
<c name="description" type="10" value=""/>
|
||||||
|
<c name="dev_name" type="10" value="autotest"/>
|
||||||
|
<c name="dev_type" type="10" value="MODBUS"/>
|
||||||
|
<c name="end_addr" type="2" value="40103"/>
|
||||||
|
<c name="function" type="10" value=""/>
|
||||||
|
<c name="len" type="2" value="1"/>
|
||||||
|
<c name="name" type="10" value="signal_3"/>
|
||||||
|
<c name="retain" type="1" value="false"/>
|
||||||
|
<c name="rw" type="10" value="rd"/>
|
||||||
|
<c name="type" type="10" value="bool"/>
|
||||||
|
<c name="value"/>
|
||||||
|
<c name="value_single" type="10" value=""/>
|
||||||
|
</l>
|
||||||
|
<l>
|
||||||
|
<c name="addr" type="2" value="40104"/>
|
||||||
|
<c name="addr_1st" type="2" value="0"/>
|
||||||
|
<c name="addr_2nd" type="2" value="0"/>
|
||||||
|
<c name="bit_bias" type="2" value="0"/>
|
||||||
|
<c name="byte_bias" type="4" value="0"/>
|
||||||
|
<c name="description" type="10" value=""/>
|
||||||
|
<c name="dev_name" type="10" value="autotest"/>
|
||||||
|
<c name="dev_type" type="10" value="MODBUS"/>
|
||||||
|
<c name="end_addr" type="2" value="40104"/>
|
||||||
|
<c name="function" type="10" value=""/>
|
||||||
|
<c name="len" type="2" value="1"/>
|
||||||
|
<c name="name" type="10" value="signal_4"/>
|
||||||
|
<c name="retain" type="1" value="false"/>
|
||||||
|
<c name="rw" type="10" value="rd"/>
|
||||||
|
<c name="type" type="10" value="bool"/>
|
||||||
|
<c name="value"/>
|
||||||
|
<c name="value_single" type="10" value=""/>
|
||||||
|
</l>
|
||||||
|
<l>
|
||||||
|
<c name="addr" type="2" value="40105"/>
|
||||||
|
<c name="addr_1st" type="2" value="0"/>
|
||||||
|
<c name="addr_2nd" type="2" value="0"/>
|
||||||
|
<c name="bit_bias" type="2" value="0"/>
|
||||||
|
<c name="byte_bias" type="4" value="0"/>
|
||||||
|
<c name="description" type="10" value=""/>
|
||||||
|
<c name="dev_name" type="10" value="autotest"/>
|
||||||
|
<c name="dev_type" type="10" value="MODBUS"/>
|
||||||
|
<c name="end_addr" type="2" value="40105"/>
|
||||||
|
<c name="function" type="10" value=""/>
|
||||||
|
<c name="len" type="2" value="1"/>
|
||||||
|
<c name="name" type="10" value="signal_5"/>
|
||||||
|
<c name="retain" type="1" value="false"/>
|
||||||
|
<c name="rw" type="10" value="rd"/>
|
||||||
|
<c name="type" type="10" value="bool"/>
|
||||||
|
<c name="value"/>
|
||||||
|
<c name="value_single" type="10" value=""/>
|
||||||
|
</l>
|
||||||
|
<l>
|
||||||
|
<c name="addr" type="2" value="40106"/>
|
||||||
|
<c name="addr_1st" type="2" value="0"/>
|
||||||
|
<c name="addr_2nd" type="2" value="0"/>
|
||||||
|
<c name="bit_bias" type="2" value="0"/>
|
||||||
|
<c name="byte_bias" type="4" value="0"/>
|
||||||
|
<c name="description" type="10" value=""/>
|
||||||
|
<c name="dev_name" type="10" value="autotest"/>
|
||||||
|
<c name="dev_type" type="10" value="MODBUS"/>
|
||||||
|
<c name="end_addr" type="2" value="40106"/>
|
||||||
|
<c name="function" type="10" value=""/>
|
||||||
|
<c name="len" type="2" value="1"/>
|
||||||
|
<c name="name" type="10" value="signal_6"/>
|
||||||
|
<c name="retain" type="1" value="false"/>
|
||||||
|
<c name="rw" type="10" value="rd"/>
|
||||||
|
<c name="type" type="10" value="bool"/>
|
||||||
|
<c name="value"/>
|
||||||
|
<c name="value_single" type="10" value=""/>
|
||||||
|
</l>
|
||||||
|
<l>
|
||||||
|
<c name="addr" type="2" value="40107"/>
|
||||||
|
<c name="addr_1st" type="2" value="0"/>
|
||||||
|
<c name="addr_2nd" type="2" value="0"/>
|
||||||
|
<c name="bit_bias" type="2" value="0"/>
|
||||||
|
<c name="byte_bias" type="4" value="0"/>
|
||||||
|
<c name="description" type="10" value=""/>
|
||||||
|
<c name="dev_name" type="10" value="autotest"/>
|
||||||
|
<c name="dev_type" type="10" value="MODBUS"/>
|
||||||
|
<c name="end_addr" type="2" value="40107"/>
|
||||||
|
<c name="function" type="10" value=""/>
|
||||||
|
<c name="len" type="2" value="1"/>
|
||||||
|
<c name="name" type="10" value="signal_7"/>
|
||||||
|
<c name="retain" type="1" value="false"/>
|
||||||
|
<c name="rw" type="10" value="rd"/>
|
||||||
|
<c name="type" type="10" value="bool"/>
|
||||||
|
<c name="value"/>
|
||||||
|
<c name="value_single" type="10" value=""/>
|
||||||
|
</l>
|
||||||
|
<l>
|
||||||
|
<c name="addr" type="2" value="40108"/>
|
||||||
|
<c name="addr_1st" type="2" value="0"/>
|
||||||
|
<c name="addr_2nd" type="2" value="0"/>
|
||||||
|
<c name="bit_bias" type="2" value="0"/>
|
||||||
|
<c name="byte_bias" type="4" value="0"/>
|
||||||
|
<c name="description" type="10" value=""/>
|
||||||
|
<c name="dev_name" type="10" value="autotest"/>
|
||||||
|
<c name="dev_type" type="10" value="MODBUS"/>
|
||||||
|
<c name="end_addr" type="2" value="40108"/>
|
||||||
|
<c name="function" type="10" value=""/>
|
||||||
|
<c name="len" type="2" value="1"/>
|
||||||
|
<c name="name" type="10" value="signal_8"/>
|
||||||
|
<c name="retain" type="1" value="false"/>
|
||||||
|
<c name="rw" type="10" value="rd"/>
|
||||||
|
<c name="type" type="10" value="bool"/>
|
||||||
|
<c name="value"/>
|
||||||
|
<c name="value_single" type="10" value=""/>
|
||||||
|
</l>
|
||||||
|
<l>
|
||||||
|
<c name="addr" type="2" value="40109"/>
|
||||||
|
<c name="addr_1st" type="2" value="0"/>
|
||||||
|
<c name="addr_2nd" type="2" value="0"/>
|
||||||
|
<c name="bit_bias" type="2" value="0"/>
|
||||||
|
<c name="byte_bias" type="4" value="0"/>
|
||||||
|
<c name="description" type="10" value=""/>
|
||||||
|
<c name="dev_name" type="10" value="autotest"/>
|
||||||
|
<c name="dev_type" type="10" value="MODBUS"/>
|
||||||
|
<c name="end_addr" type="2" value="40109"/>
|
||||||
|
<c name="function" type="10" value=""/>
|
||||||
|
<c name="len" type="2" value="1"/>
|
||||||
|
<c name="name" type="10" value="signal_9"/>
|
||||||
|
<c name="retain" type="1" value="false"/>
|
||||||
|
<c name="rw" type="10" value="rd"/>
|
||||||
|
<c name="type" type="10" value="bool"/>
|
||||||
|
<c name="value"/>
|
||||||
|
<c name="value_single" type="10" value=""/>
|
||||||
|
</l>
|
||||||
<l>
|
<l>
|
||||||
<c name="addr" type="2" value="40500"/>
|
<c name="addr" type="2" value="40500"/>
|
||||||
<c name="addr_1st" type="2" value="0"/>
|
<c name="addr_1st" type="2" value="0"/>
|
||||||
|
@ -28,7 +28,7 @@ def initialization():
|
|||||||
pd.push_file_to_server(config_file, f"{user_settings}/{filename}")
|
pd.push_file_to_server(config_file, f"{user_settings}/{filename}")
|
||||||
pd.push_file_to_server(config_file, f"{interactive_data}/{filename}")
|
pd.push_file_to_server(config_file, f"{interactive_data}/{filename}")
|
||||||
|
|
||||||
io_device_autotest = {'ai_num': 0, 'ao_num': 0, 'di_num': 16, 'do_num': 16, 'extend_attr': {'mode': 'slaver', 'name': 'autotest', 'type': 'MODBUS'}, 'id': 7, 'name': 'autotest', 'type': 6}
|
io_device_autotest = {"ai_num": 0, "ao_num": 0, "di_num": 16, "do_num": 16, "extend_attr": {"mode": "slaver", "name": "autotest", "type": "MODBUS"}, "id": 7, "name": "autotest", "type": 6}
|
||||||
io_device_file_local = f"..\\assets\\configs\\{io_device_file}"
|
io_device_file_local = f"..\\assets\\configs\\{io_device_file}"
|
||||||
io_device_file_local_tmp = f"..\\assets\\configs\\{io_device_file}_tmp"
|
io_device_file_local_tmp = f"..\\assets\\configs\\{io_device_file}_tmp"
|
||||||
io_device_file_remote = f"{user_settings}/{io_device_file}"
|
io_device_file_remote = f"{user_settings}/{io_device_file}"
|
||||||
@ -84,8 +84,9 @@ def initialization():
|
|||||||
ec.modify_system_time(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())))
|
ec.modify_system_time(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())))
|
||||||
|
|
||||||
# 关闭拖动
|
# 关闭拖动
|
||||||
clibs.logger.info("关闭拖动模式...")
|
if robot_type.upper()[:2] not in ["XB", "NB"]:
|
||||||
hr.set_drag_params(False, 1, 2)
|
clibs.logger.info("关闭拖动模式...")
|
||||||
|
hr.set_drag_params(False, 1, 2)
|
||||||
|
|
||||||
# 关闭碰撞检测
|
# 关闭碰撞检测
|
||||||
clibs.logger.info("关闭碰撞检测...")
|
clibs.logger.info("关闭碰撞检测...")
|
||||||
@ -114,4 +115,5 @@ def initialization():
|
|||||||
md.r_clear_alarm()
|
md.r_clear_alarm()
|
||||||
|
|
||||||
|
|
||||||
initialization()
|
if __name__ == "__main__":
|
||||||
|
initialization()
|
||||||
|
@ -139,6 +139,13 @@ class ModbusRequest(object):
|
|||||||
clibs.logger.info(f"40018-{action} 执行{actions}安全区 safe region 03")
|
clibs.logger.info(f"40018-{action} 执行{actions}安全区 safe region 03")
|
||||||
sleep(clibs.interval)
|
sleep(clibs.interval)
|
||||||
|
|
||||||
|
def r_write_signals(self, addr: int, value): # OK | 40100 - 40109: signal_0 ~ signal_9
|
||||||
|
if -1 < addr < 10 and addr.is_integer():
|
||||||
|
self.__c.write_register(40100+addr, value)
|
||||||
|
clibs.logger.info(f"{40100+addr}-{value} 将寄存器 signal_{addr} 赋值为 {value}")
|
||||||
|
else:
|
||||||
|
clibs.logger.error(f"{40100+addr}-{value} 地址错误,无法赋值!")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def w_alarm_state(self): # OK
|
def w_alarm_state(self): # OK
|
||||||
res = self.__c.read_holding_registers(40500, 1).registers[0]
|
res = self.__c.read_holding_registers(40500, 1).registers[0]
|
||||||
@ -418,7 +425,10 @@ class HmiRequest(object):
|
|||||||
return res.get("data", f"{msg_id} has no data item")
|
return res.get("data", f"{msg_id} has no data item")
|
||||||
sleep(clibs.interval*2)
|
sleep(clibs.interval*2)
|
||||||
else: # 尝试在上一次分割的日志中查找,只做一次
|
else: # 尝试在上一次分割的日志中查找,只做一次
|
||||||
res = find_response("".join([clibs.log_path, sorted(listdir(clibs.log_path))[-3]]))
|
try:
|
||||||
|
res = find_response("".join([clibs.log_path, sorted(listdir(clibs.log_path))[-3]]))
|
||||||
|
except IndexError:
|
||||||
|
res = None
|
||||||
if res is not None:
|
if res is not None:
|
||||||
return res.get("data", f"{msg_id} has no data item")
|
return res.get("data", f"{msg_id} has no data item")
|
||||||
elif flag == 1:
|
elif flag == 1:
|
||||||
@ -428,7 +438,10 @@ class HmiRequest(object):
|
|||||||
return res
|
return res
|
||||||
sleep(clibs.interval*2)
|
sleep(clibs.interval*2)
|
||||||
else:
|
else:
|
||||||
res = find_response_xs("".join([clibs.log_path, sorted(listdir(clibs.log_path))[-3]]))
|
try:
|
||||||
|
res = find_response_xs("".join([clibs.log_path, sorted(listdir(clibs.log_path))[-3]]))
|
||||||
|
except IndexError:
|
||||||
|
res = None
|
||||||
if res is not None:
|
if res is not None:
|
||||||
return res
|
return res
|
||||||
self.__sth_wrong(11, f"无法找到请求 {msg_id} 的返回结果")
|
self.__sth_wrong(11, f"无法找到请求 {msg_id} 的返回结果")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user