Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Follow the Getting started with a robot. Then, in a new python file (or use https://bitbucket.org/socialroboticshub/framework/src/master/sic_framework/tests/demo_nao_camera.py) copy the following code.

import queue
import cv2

from sic_framework.core.message_python2 import CompressedImageMessage
from sic_framework.devices.common_naoqi.naoqi_camera import TopNaoCamera


imgs = queue.Queue()
def on_image(image_message: CompressedImageMessage):
    # we could cv2.imshow here, but that does not work on Mac OSX
    imgs.put(image_message.image)


camera = TopNaoCamera(ip="192.168.0.210")
camera.register_callback(on_image)

while True:
    img = imgs.get()
    cv2.imshow('', img)
    cv2.waitKey(1)

Simply run the file to show the robot’s camera output!

python demo_camera_nao.py

Here is the schematic overview of how this program. The camera sends a “stream” of output messages that are received by your computer program.

  • No labels