使用supervisor时如何获取设备?

问题描述

在我的 webots 环境中有一个传送带和一个 ur10e 机器人,我将 ur10e 的控制器设置为 typedef struct node { int data; int random; struct node *next; } card; for eg,we can give newnode->random = rand() % (100),which will give random numbers up to 100 to the field.Now Ordering the linked list to ascending or descending according to the random number,will help us to shuffle the nodes . for (tempnode = start; tempnode->next != NULL; tempnode = tempnode->next) for (nextnode = tempnode->next; nextnode->next != NULL; nextnode = nextnode->next) { if (tempnode->random > nextnode->random) { swap(tempnode,nextnode); } } ,我想获得 kinect 图像,它是传送带上的一个孩子。 ur10e

conveyor_belt

我的python代码如下:

extern

但我收到以下错误

from controller import Camera
from controller import PositionSensor
from controller import Supervisor

robot = Supervisor()

# Get the time step of the current world.
timestep = int(robot.getBasictimestep())

conveyor_belt = robot.getFromDef("CONVEYOR_BELT")
assert(conveyor_belt != None)
conveyor_kinectcolor = conveyor_belt.getDevice("kinect color")
conveyor_kinectcolor.enable(int(1000/24))
conveyor_kinectcolor.getimage()

解决方法

您无法在另一个机器人中获取设备。

或者,您可以为另一个机器人创建自定义控制器,并使用发射器/接收器与主管交换命令。