Implementation of standardized CB<->RI communication API #3

Merged
0950726 merged 5 commits from feat/comm-standardization into dev 2025-10-09 16:01:30 +00:00
0950726 commented 2025-10-09 15:36:31 +00:00 (Migrated from git.science.uu.nl)

Based on the N25B-A-14 article, this is an implementation of the RI ↔ CB communication API. It implements the ping endpoint and provides a stub for the negotiation endpoint, as there is nothing to negotiate yet.

To test, run the attached script, then main.py (order doesn't really matter).

To run main.py:

cd src
python -m robot_interface.main
import zmq
import time

def main():
    context = zmq.Context()
    socket = context.socket(zmq.REQ)  # REQ = request
    socket.bind("tcp://*:5555")

    try:
        for i in range(5):
            msg = {"endpoint": "ping", "data": i}
            print("Sending request: {}".format(msg))
            socket.send_json(msg)

            reply = socket.recv_json()
            print("Received reply: {}".format(reply))

            time.sleep(1)
    except KeyboardInterrupt:
        print("\nInterrupted by user, exiting.")
    finally:
        socket.close()
        context.term()


if __name__ == "__main__":
    main()

This script should print up to sequence number 4, then stop.

ref: N25B-168

Based on the N25B-A-14 article, this is an implementation of the RI ↔ CB communication API. It implements the ping endpoint and provides a stub for the negotiation endpoint, as there is nothing to negotiate yet. To test, run the attached script, then main.py (order doesn't really matter). To run main.py: ``` cd src python -m robot_interface.main ``` ```python import zmq import time def main(): context = zmq.Context() socket = context.socket(zmq.REQ) # REQ = request socket.bind("tcp://*:5555") try: for i in range(5): msg = {"endpoint": "ping", "data": i} print("Sending request: {}".format(msg)) socket.send_json(msg) reply = socket.recv_json() print("Received reply: {}".format(reply)) time.sleep(1) except KeyboardInterrupt: print("\nInterrupted by user, exiting.") finally: socket.close() context.term() if __name__ == "__main__": main() ``` This script should print up to sequence number 4, then stop. ref: N25B-168
0950726 commented 2025-10-09 15:36:32 +00:00 (Migrated from git.science.uu.nl)

assigned to @0950726

assigned to @0950726
s.o.h.luijkx commented 2025-10-09 16:01:21 +00:00 (Migrated from git.science.uu.nl)

approved this merge request

approved this merge request
s.o.h.luijkx commented 2025-10-09 16:01:31 +00:00 (Migrated from git.science.uu.nl)

mentioned in commit 828871a2ad

mentioned in commit 828871a2ada29c15973432567f7d7d94262c2ade
s.o.h.luijkx (Migrated from git.science.uu.nl) merged commit 828871a2ad into dev 2025-10-09 16:01:31 +00:00
s.o.h.luijkx (Migrated from git.science.uu.nl) approved these changes 2026-02-02 13:26:46 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: pepperplus/pepperplus-ri#3