I try to use python to read webots camera image, and publish it by ros topic. But when I write like: Img = camera.getImageArray() in the main loop, the simulation world will be very slow, speed like 0.1x. my program like this:
from controller import Robot, Camera
robot = Robot()
timestep = int(robot.getBasicTimeStep())
camera = Camera('camera')
camera.enable(100)
while robot.setp(timestep) != -1:
img = camera.getImageArray()
pass
If I delete this code "img = camera.getImageArray()" from main loop, then the simulation speed is increase to nomal speed. My webots version is Webots R2020b-rev1, os is Windows10 64-bit.I also try to run this code in Ubuntu16.04lts, it's same. Could anybody help me to this problem?