Implemented receiving video in RI from robot #4

Merged
s.o.h.luijkx merged 4 commits from feat/ri-receive-video into dev 2025-10-16 14:41:03 +00:00
s.o.h.luijkx commented 2025-10-15 16:10:25 +00:00 (Migrated from git.science.uu.nl)

Implemented the functions start_video_rcv and video_rcv_loop in main.py. The functions are called from main_loop. The first function sets up the connection to the robot and then starts a new thread to run video_rcv_loop on. In the second function the image from the robot's camera is called repeatedly and sent over a VideoSender socket.

Review the merge request by filling in the correct robot_ip and port in main.py, main_loop(). Then run the RI. Run the code below separately. You should receive image data in the second window every 2 seconds. The data should look like repeatedly '\x00\x9a\x00' as the simulator camera sees all green.

import zmq
import time

def main():
    context = zmq.Context()
    socket = context.socket(zmq.SUB)
    socket.bind("tcp://*:5556")
    socket.setsockopt(zmq.CONFLATE,1)
    socket.setsockopt_string(zmq.SUBSCRIBE,"")

    while True:
        msg = socket.recv()
        print(msg)
        time.sleep(2)

if __name__ == "__main__":
    main()

close: N25B-171

Implemented the functions start_video_rcv and video_rcv_loop in main.py. The functions are called from main_loop. The first function sets up the connection to the robot and then starts a new thread to run video_rcv_loop on. In the second function the image from the robot's camera is called repeatedly and sent over a VideoSender socket. Review the merge request by filling in the correct robot_ip and port in main.py, main_loop(). Then run the RI. Run the code below separately. You should receive image data in the second window every 2 seconds. The data should look like repeatedly '\x00\x9a\x00' as the simulator camera sees all green. ``` import zmq import time def main(): context = zmq.Context() socket = context.socket(zmq.SUB) socket.bind("tcp://*:5556") socket.setsockopt(zmq.CONFLATE,1) socket.setsockopt_string(zmq.SUBSCRIBE,"") while True: msg = socket.recv() print(msg) time.sleep(2) if __name__ == "__main__": main() ``` close: N25B-171
0950726 commented 2025-10-15 16:19:56 +00:00 (Migrated from git.science.uu.nl)

Avoid hardcoded IP and port

Move video functions from main to the VideoSender class

Avoid hardcoded IP and port Move video functions from main to the VideoSender class
s.o.h.luijkx commented 2025-10-16 12:57:55 +00:00 (Migrated from git.science.uu.nl)

added 1 commit

  • 0c5b47ae - refactor: removed hardcoded IP and port and moved video functions from main to...

Compare with previous version

added 1 commit <ul><li>0c5b47ae - refactor: removed hardcoded IP and port and moved video functions from main to...</li></ul> [Compare with previous version](/ics/sp/2025/n25b/pepperplus-ri/-/merge_requests/4/diffs?diff_id=132282&start_sha=a408fafc7cd843cb2838f762bd95e0a204eb3db1)
0950726 commented 2025-10-16 13:08:44 +00:00 (Migrated from git.science.uu.nl)

These parameters no longer exist.

```suggestion:-8+0 ``` These parameters no longer exist.
0950726 commented 2025-10-16 13:18:18 +00:00 (Migrated from git.science.uu.nl)

        :param vid_service: The video service object that the active Qi session is connected to. 
        :type vid_service: Object (Qi service object)

        :param vid_stream_name: The name of a camera subscription on the video service object vid_service
        :type vid_stream_name: String
```suggestion:-8+0 :param vid_service: The video service object that the active Qi session is connected to. :type vid_service: Object (Qi service object) :param vid_stream_name: The name of a camera subscription on the video service object vid_service :type vid_stream_name: String ```
0950726 commented 2025-10-16 13:26:03 +00:00 (Migrated from git.science.uu.nl)
        :type options: list[tuple[int, int]]

The suggestion has types that an IDE can understand. The description of the parameter is good enough for the semantics.

```suggestion:-0+0 :type options: list[tuple[int, int]] ``` The suggestion has types that an IDE can understand. The description of the parameter is good enough for the semantics.
s.o.h.luijkx commented 2025-10-16 14:06:32 +00:00 (Migrated from git.science.uu.nl)

resolved all threads

resolved all threads
s.o.h.luijkx commented 2025-10-16 14:06:32 +00:00 (Migrated from git.science.uu.nl)

resolved all threads

resolved all threads
s.o.h.luijkx commented 2025-10-16 14:10:34 +00:00 (Migrated from git.science.uu.nl)

changed this line in version 3 of the diff

changed this line in [version 3 of the diff](/ics/sp/2025/n25b/pepperplus-ri/-/merge_requests/4/diffs?diff_id=132292&start_sha=0c5b47ae166f168b1107d588018e697110693228#8604da595eeb0afbe844103d71f4acea32e780de_26_18)
s.o.h.luijkx commented 2025-10-16 14:10:36 +00:00 (Migrated from git.science.uu.nl)

changed this line in version 3 of the diff

changed this line in [version 3 of the diff](/ics/sp/2025/n25b/pepperplus-ri/-/merge_requests/4/diffs?diff_id=132292&start_sha=0c5b47ae166f168b1107d588018e697110693228#8604da595eeb0afbe844103d71f4acea32e780de_53_40)
s.o.h.luijkx commented 2025-10-16 14:10:39 +00:00 (Migrated from git.science.uu.nl)

changed this line in version 3 of the diff

changed this line in [version 3 of the diff](/ics/sp/2025/n25b/pepperplus-ri/-/merge_requests/4/diffs?diff_id=132292&start_sha=0c5b47ae166f168b1107d588018e697110693228#9a20a5d699e53c4196311f502bdee03a9f36a2b9_33_33)
s.o.h.luijkx commented 2025-10-16 14:10:41 +00:00 (Migrated from git.science.uu.nl)

added 1 commit

Compare with previous version

added 1 commit <ul><li>0b55d5c2 - style: fixed docstrings</li></ul> [Compare with previous version](/ics/sp/2025/n25b/pepperplus-ri/-/merge_requests/4/diffs?diff_id=132292&start_sha=0c5b47ae166f168b1107d588018e697110693228)
0950726 commented 2025-10-16 14:41:03 +00:00 (Migrated from git.science.uu.nl)

mentioned in commit 785756683e

mentioned in commit 785756683e90101b5b8f63c742cb85564c3f6e91
0950726 (Migrated from git.science.uu.nl) merged commit 785756683e into dev 2025-10-16 14:41:03 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: pepperplus/pepperplus-ri#4