Routineerklärung 32-Modbus -> modbus_apriltag.py Modbus und ArrilTag
Video-Tutorial 30 – RS485-Erweiterungskarte zur Implementierung von OPENMV- und SPS-Kommunikation verwenden: https://singtown.com/learn/50806/
import sensor, image
import time
from pyb import UART
from modbus import ModbusRTU
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QQVGA)
uart = UART(3,115200, parity=None, stop=2, timeout=1, timeout_char=4)
modbus = ModbusRTU(uart, register_num=9999)
sensor.skip_frames(time = 2000)
clock = time.clock()
while(True):
if modbus.any():
modbus.handle(debug=True)
else:
clock.tick()
img = sensor.snapshot()
tags = img.find_apriltags()
modbus.clear()
modbus.REGISTER[0] = len(tags)
if tags:
print(tags)
i = 1
for tag in tags:
img.draw_rectangle(tag.rect(), color = 127)
modbus.REGISTER[i] = tag.family()
i += 1
modbus.REGISTER[i] = tag.id()
i += 1
modbus.REGISTER[i] = tag.cx()
i += 1
modbus.REGISTER[i] = tag.cy()
i += 1