Simple robot control and navigation based on aruco markers — part 2

Test script

The navigation will be done on PC. I used Python. (no curly brackets — weird)

Lets test our vision server

Simple Python code to get marker data:

 try:
        s = ""
        vision_server_client.send("g".encode())  # send 'g' to get response
        clock.tick(5)
        s = vision_server_client.recv(10000)  # there must be a better way to do this
        markersDict = json.loads(s.decode())
    except:
        continue

    aruco_markers = markersDict["aruco"]

    for m in aruco_markers:
        x = int(m['center']['x'])
        y = int(m['center']['y'])
        s = int(m['size'])
        h = (m['heading'])
        marker_id = int(m['ID'])
        corners = m['markerCorners']

        try:
            xm, ym, zm, roll_marker, pitch_marker, yaw_marker = getMarkerAttitude(corners, 10)  # for extra info, openCV needed
        except:
            pass

And we can draw markers:

Everything seems to be working fine.

Complete Python code is here:

https://github.com/eziosoft/ArucoRobotNavigation/blob/master/vision_server_test.py

Leave a Reply

Your email address will not be published. Required fields are marked *