CoppeliaSim:视觉传感器的使用与属性参数

2023-05-16

视觉传感器类型

http://www.coppeliarobotics.com/helpFiles/index.html

  • Orthographic projection-type: the field of view of orthographic projection-type vision sensors is rectangular. They are well suited for close-range infrared sensors, or laser range finders.
    正交投影:适用于红外传感器或激光传感器

  • Perspective projection-type: the field of view of perspective projection-type vision sensors is trapezoidal. They are well suited for camera-type sensors.
    透视投影:适用于摄像头

Orthogonal projection-type and perspective projection-type vision sensors

基本操作

menu bar--> Add --> Vision sensor

添加图像的窗口

场景中右键--> Add--> Floating View
选中Vision Sensor
Floating View中右键--> View-->Associate View with selected vision sensor

运行即可

属性参数

http://www.coppeliarobotics.com/helpFiles/en/visionSensorPropertiesDialog.htm
在这里插入图片描述
[Vision sensor dialog]

  • Enable all vision sensors: turns the vision sensor functionality on and off for all vision sensors.
    是否启用摄像头
  • Explicit handling: indicates whether the sensor should be explicitely(明确的) handled. If checked, the sensor will not be handled when sim.handleVisionSensor(sim.handle_all_except_explicit) is called, but only if sim.handleVisionSensor(sim.handle_all) or sim.handleVisionSensor(visionSensorHandle) is called.
    勾选后将传感器将不会被上述函数调用
    This is useful if the user wishes to handle the sensor in a child script rather than in the main script (if not checked the sensor will be handled twice, once when sim.handleVisionSensor(sim.handle_all_except_explicit)is called in the main script, and once whensim.handleVisionSensor(visionSensorHandle) is called in the child script). Refer also to the section on explicit and non-explicit calls.
    在需要给传感器单独写子脚本时有用,避免被重复处理
  • External input: when selected, then the vision sensor’s normal operation will be altered so as to be able to treat and filter external images instead (e.g. video images).
    采用外部输入
  • Perspective mode: allows selecting between the perspective projection type and the orthogonal projection type vision sensor.
    切换传感器模式:正交投影or透视投影
  • Ignore RGB info (faster): if selected, the RGB information of the sensor (i.e. the color) will be ignored so that it can operate faster. Use this option if you only rely on the depth information of the sensor.
    屏蔽RGB信息
  • Ignore depth info (faster): if selected, the depth information of the sensor will be ignored so that it can operate faster. Use this option if you do not intend to use the depth information of the sensor.
    屏蔽深度信息
  • Packet1 is blank (faster): if selected, then V-REP won’t automatically extract specific information from acquired images, so that it can operate faster. Use this option if you do not intend to use the first packet of auxiliary(辅助的) values returned by API functions sim.readVisionSensor orsim.handleVisionSensor.
  • Use local lights: if enabled, then only local lights parented with this vision sensor (i.e. built on top of this vision sensor) will be activated when displaying this vision sensor’s image content. Lights can be made local in the light properties.
    是否显示环境光
  • Show fog if enabled: if disabled, then this vision sensor won’t see any fog if fog is enabled. Also refer to the environment dialog.
    是否显示雾
  • Render(给予) mode: three modes are currently available:
    • OpenGL (default): renders the visible color channels of objects.
    • OpenGL, auxiliary channels: renders the auxiliary color channels of objects. The auxiliary channels red, green and blue colors are meant to be used in following way: red is the temperature channel (0.5 is the ambient(周围的) temperature), green is the user defined channel, and blue is the active light emitter channel.
    • OpenGL, color coded handles: renders the objects by coding their handles into the colors. The first data packet returned by the sim.readVisionSensor or sim.handleVisionSensor API functions represent the detected object handles (round the values down).
    • POV-Ray: uses the POV-Ray plugin to render images, allowing for shadows (also soft shadows) and material effects (much slower). The plugin source code is located here.
    • External renderer: uses an external renderer implemented via a plugin. The current external renderer source code is located here.
    • External renderer, windowed: uses an external renderer implemented via a plugin, and displays the image in an external window (during simulation only). The current external renderer source code is located here.
    • OpenGL3: uses the OpenGL3 renderer plugin, courtesy of Stephen James. The plugin offers shadow casting, which is currently not possible natively, in V-REP. Light projection and shadows can be adjusted for each light, via the object’s extension string, e.g. openGL3 {lightProjection {nearPlane {0.1} farPlane {10} orthoSize {8} bias {0.001} normalBias {0.005} shadowTextureSize {2048}}}
      OpenGL3, windowed: same as above, but windowed.
  • Near / far clipping plane: the minimum / maximum distance from which the sensor will be able to detect.
    设定传感器的最小和最大视距
  • Perspective angle: the maximum opening angle of the detection volume when the sensor is in perspective mode.
    设定透视视野
  • Orthographic size: the maximum size (along x or y) of the detection volume when the sensor is not in perspective mode.
    设定正交范围x和y
    在这里插入图片描述
    [Detection value parameters of the orthographic-type vision sensor]
    在这里插入图片描述
    [Detection value parameters of the perspective-type vision sensor]
  • Resolution X / Y: desired x- / y-resolution of the image captured by the vision sensor. Carefully chose the resolution depending on your application (high resolution will result in slower operation). With older graphic card models, the actual resolution might be different from what is indicated here (old graphic card models only support resolutions at 2^n, where n is 0, 1, 2, etc.).
    分辨率
  • Entity to detect: allows specifying what entity should be rendered.
  • Adjust default image color: allows specifying the color that should be used in areas where nothing was rendered. By default, the environment fog color is used.
  • Object size X / Y / Z: size of the body-part of the vision sensor. This has no functional effect.
    设置传感器大小哦
  • Show volume when not detecting: if selected, the detection volume is shown when the sensor didn’t trigger.
    没启用时显示传感器
  • Show volume when detecting: if selected, the detection volume is shown when the sensor triggered.
    启用时显示传感器
  • Object colors: allows adjusting the various colors of a vision sensor.
    调节传感器颜色
  • Show filter dialog: toggles the vision sensor filter dialog. That dialog allows specifying filters to apply to captured images.
    滤镜选项

Filter or Image processing

在旧版vrep中image processing 部分有专门的GUI,但在新版coppeliasim中删去了GUI而只能通过lua code进行处理
一般会在传感器上添加一个customation script进行图像处理如下
在这里插入图片描述
代码如下

function sysCall_init()
end

function sysCall_vision(inData)
    -- callback function automatically added for backward compatibility
    -- (vision sensor have no filters anymore, but rather a callback function where image processing can be performed)
    local retVal={}
    retVal.trigger=false
    retVal.packedPackets={}
    simVision.sensorDepthMapToWorkImg(inData.handle)
    local trig,packedPacket=simVision.coordinatesFromWorkImg(inData.handle,{256,1},false) if trig then retVal.trigger=true end if packedPacket then retVal.packedPackets[#retVal.packedPackets+1]=packedPacket end
    simVision.workImgToSensorImg(inData.handle)
    return retVal
end

http://www.coppeliarobotics.com/helpFiles/index.html
相关函数:
http://www.coppeliarobotics.com/helpFiles/en/visionPlugin-imageProcessing.htm

API

http://www.coppeliarobotics.com/helpFiles/en/apiFunctionListCategory.htm#visionSensor
可以从官方例程rosInterfaceTopicPublisherAndSubscriber.ttt里得代码

-- This illustrates how to publish and subscribe to an image using the ROS Interface.
-- An alternate version using image transport can be created with following functions:
--
-- simROS.imageTransportAdvertise
-- simROS.imageTransportPublish
-- simROS.imageTransportShutdownPublisher
-- simROS.imageTransportShutdownSubscriber
-- simROS.imageTransportSubscribe

function sysCall_init()
        
    -- Get some handles:
    -- 转臂上的摄像头
    activeVisionSensor=sim.getObjectHandle('Vision_sensor')
    -- 世界上的摄像头
    passiveVisionSensor=sim.getObjectHandle('PassiveVision_sensor')
    
    -- Enable an image publisher and subscriber:
    -- 类似pub=n.advertise<sensor_msgs::Image>("/image",1);
    pub=simROS.advertise('/image', 'sensor_msgs/Image')
    -- 对发布器进行格式转换,使得数组转换为字符串,使通讯更快
    simROS.publisherTreatUInt8ArrayAsString(pub) -- treat uint8 arrays as strings (much faster, tables/arrays are kind of slow in Lua)
    -- 类似sub=n.subscriber("/image",1,imageMessage_callback);
    sub=simROS.subscribe('/image', 'sensor_msgs/Image', 'imageMessage_callback')
    -- 对发布器进行格式转换,使得数组转换为字符串,使通讯更快
    simROS.subscriberTreatUInt8ArrayAsString(sub) -- treat uint8 arrays as strings (much faster, tables/arrays are kind of slow in Lua)
    
end
-- 订阅者sub的回调函数
function imageMessage_callback(msg)
    -- Apply the received image to the passive vision sensor that acts as an image container
    sim.setVisionSensorCharImage(passiveVisionSensor,msg.data)
end

-- 摄像头的回调函数
function sysCall_sensing()
    -- Publish the image of the active vision sensor:
    local data,w,h=sim.getVisionSensorCharImage(activeVisionSensor)
    -- 生成tables/arrays类型的数据类型,tables/arrays只要数据中的成员与希望的数据类型一致即可作成任何类型的数据类型。
    -- 因此可以将tables/arrays类型看作数据载体
    d={}
    d['header']={seq=0,stamp=simROS.getTime(), frame_id="a"}
    d['height']=h
    d['width']=w
    d['encoding']='rgb8'
    d['is_bigendian']=1
    d['step']=w*3
    d['data']=data
    simROS.publish(pub,d)
end

function sysCall_cleanup()
    -- Shut down publisher and subscriber. Not really needed from a simulation script (automatic shutdown)
    simROS.shutdownPublisher(pub)
    simROS.shutdownSubscriber(sub)
end
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

CoppeliaSim:视觉传感器的使用与属性参数 的相关文章

  • git的命令总结

    先把清单列出来git cheat sheet git 命令总结 git的init和git clonegit add和git commit 提交二连git checkout 反向操作git reset 回退HEAD指针git revert 同
  • 宏定义中的可变参数 __VA_ARGS__ 用法 与 #和##的用法

    首先了解一下可变参数 span class token macro property span class token directive keyword include span span class token string lt st
  • C++结构体简单链表原理解释

    对结构体简单链表原理的简单解释 xff0c 程序如下 xff1a struct lianbiao int no string name struct lianbiao next lianbiao head 61 nullptr tail 6
  • linux小连招

    Linux命令目录 查看当前shell的种类find命令查找文件 查看当前shell的种类 查看当前发行版可以使用的shell xff1a chao 64 chao span class token function cat span et
  • 侵略性奶牛(对于二分的总结)

    题目 Farmer John has built a new long barn with N 2 lt 61 N lt 61 100 000 stalls The stalls are located along a straight l
  • To Fill or Not to Fill(贪心算法)

    题目描述 有了高速公路 xff0c 开车从杭州到任何其他城市都很容易 但由于汽车的油箱容量有限 xff0c 我们必须不时地在路上找到加油站 不同的加油站可能会给出不同的价格 你被要求仔细设计最便宜的路线去 输入描述 对于每个测试实例 第一行
  • cmake语法

    目录 基本语法命令行projectadd executabletarget sourcessetfileadd librarymessagetarget link librariestarget include directoriesfin
  • 《C++个人学习笔记》使用cout或cin显示未定义标识符

    在vs自动生成的c 43 43 项目中 xff0c 初次使用cout或cin报未定义标识符错误 xff0c 是由于未声明命名空间的原因 解决方法 xff1a 在头文件中声明全局命名空间 加入 using namespace std 表示使用
  • rosbag error

    rosbag play 报错 error 1 md5sum span class token punctuation span span class token constant ERROR span span class token pu
  • CMake实践(三)静态库和动态库构建

    本节的任务是 xff1a 建立一个静态库和动态库 xff0c 提供HelloFunc函数供其他程序使用 xff0c HelloFunc函数向终端输出Hello World字符串 安装头文件和共享库 1 准备工作 在 backup cmake
  • checksum算法详细的计算方法、实现思路与python校验验证

    1 checksum是什么 xff1f Checksum xff1a 电脑 总和检验码 xff0c 校验和 在数据处理和数据通信领域中 xff0c 用于校验目的的一组数据项的和 这些数据项可以是数字或在计算检验总和过程中看作数字的其它字符串
  • java循环标号

    在Java中 xff0c 要想跳出多重循环 xff0c 可以在外面的循环语句前定义一个标号 xff0c 然后在里层循环体的代码中使用带有标号的break 语句 xff0c 即可跳出外层循环 switch xff08 continue和bre
  • SQL Server安装提示【需要microsoft.NET Framework 3.5 Service Pack 1】

    问题 我在自己电脑安装SQL Server 2014 的时候遇到了这个问题 xff0c SQL Server安装提示 需要microsoft NET Framework 3 5 Service Pack 1 xff1a 解决方法 1 打开控
  • zcu102_12_Standalone以太网数据的UDP传输

    本文在PS的Standalone程序中使用lwip库通过UDP协议实现网络数据传输 包含UDP Server和UDP Client两种形式 本文主要参考lwip的SDK内部说明和工程模板 xff0c xapp1026 xapp1306 SD
  • SQL Server 2014无法连接到服务器之解决方法

    问题如图所示 xff1a 解决方法 1 打开SQL server 配置管理器 gt SQL server 网络配置 gt MSSQLSERVER的协 xff0c 将SQLEXPRESS协议中的Named Pipes改为已启用 xff1a 2
  • C语言实现顺序表删除多余元素并统计移动次数

    题目 xff1a 假设顺序表L中的元素按从小到大的次序排列 xff0c 设计算法以删除表中重复的元素 用C写 xff0c 对顺序表 xff08 1 1 2 2 2 3 4 5 5 5 6 6 7 7 8 8 8 9 xff09 模拟执行本算
  • C语言实现十进制转换为十六进制

    编写了C语言程序 xff0c 实现了十进制数到十六进制数的转换 代码 xff1a include lt stdio h gt int main int a i 61 0 char s 200 printf 34 请输入十进制数字 xff1a
  • C语言实现单链表逆置算法

    题目 xff1a 设计算法 xff0c 将单链表L就地逆置 xff0c 结果如图所示 xff1a 代码 xff1a include lt stdio h gt include lt stdlib h gt typedef int dataT

随机推荐