5.VREP常见问题2

摘要:
改善这一情形方法可以限定力矩范围。给出最小力矩和最大力矩的限定,可以让关节达到执行效果而且不会出现上述情形。图25关节力矩曲线图-1给出最小限定力矩,需要根据物体本身所需的最小力矩给出。给出最大力矩,可以根据轨迹规划的情况给出。

7.关节力矩设置

1.在设置关节力矩时,力矩应当设置一个下限值,否则力矩太小,系统会失去控制。

5.VREP常见问题2第1张
图24 力矩设置演示对象

2.力矩函数调用的顺序

如果直接调用sim.simxSetJointForce,而且规划出的力矩有过零点或者最终会变为零,那么关节系统也会因力矩为零失去控制。

改善这一情形方法可以限定力矩范围。给出最小力矩和最大力矩的限定,可以让关节达到执行效果而且不会出现上述情形。

5.VREP常见问题2第2张
图25 关节力矩曲线图-1

给出最小限定力矩,需要根据物体本身所需的最小力矩给出。

给出最大力矩,可以根据轨迹规划的情况给出。

5.VREP常见问题2第3张
图26 关节力矩曲线图-2

如果是实际情形,必须考虑动力源的最大力矩。

力矩曲线

5.VREP常见问题2第4张
图27 关节力矩曲线图-3
5.VREP常见问题2第5张
图28 关节力矩曲线图-4
5.VREP常见问题2第6张
图29 最终运动效果图

8.VREP 视觉传感器

调用simReadVisionSensor来获取连通域信息,Packet2中将包含如下数据:

Packet2 = {blob count, dataSizePerBlob, blob1 size, blob1 orientation, blob1 position x, blob1 position y, blob1 width, blob1 height, blob2 size,blob2 orientation, blob2 position x, blob2 position y, blob2 width, blob2 height,...}

simReadVisionSensor / sim.readVisionSensor

Description

Reads the state of a vision sensor. This function doesn't perform detection, it merely reads the result from a previous call tosim.handleVisionSensor(sim.handleVisionSensor is called in the default main script). See alsosim.checkVisionSensor,sim.checkVisionSensorExandsim.resetVisionSensor.

C synopsis

simInt simReadVisionSensor(simInt visionSensorHandle,simFloat** auxValues,simInt** auxValuesCount)

C parameters

visionSensorHandle: handle of a vision sensor object

auxValues: by default CoppeliaSim returns one packet of 15 auxiliary values:the minimum of {intensity, red, green, blue, depth value}, the maximum of {intensity, red, green, blue, depth value}, and the average of {intensity, red, green, blue, depth value}. Additional packets can be appended in thevision callback function. AuxValues can be NULL. The user is in charge of releasing the auxValues buffer withsimReleaseBuffer(*auxValues).

auxValuesCount: contains information about the number of auxiliary value packets and packet sizes returned in auxValues. The first value is the number of packets, the second is the size of packet1, the third is the size of packet2, etc. Can be NULL if auxValues is also NULL. The user is in charge of releasing the auxValuesCount buffer withsimReleaseBuffer(*auxValuesCount).

SeesimHandleVisionSensorfor a usage example

C return value

detection state (0 or 1), or -1 in case of an error, or ifsimHandleVisionSensorwas never called, or ifsimResetVisionSensorwas previously called.

Lua synopsis

number result,table auxiliaryValuePacket1,table auxiliaryValuePacket2, etc.=sim.readVisionSensor(number visionSensorHandle)

Lua parameters

visionSensorHandle: handle of a vision sensor object

Lua return values

result: detection state (0 or 1), or -1 in case of an error, or ifsim.handleVisionSensorwas never called, or ifsim.resetVisionSensorwas previously called.

auxiliaryValuePacket1: default auxiliary value packet (same as for the C-function)

auxiliaryValuePacket2: additional auxiliary value packet (e.g. from an image processing component)

auxiliaryValuePacket3: etc. (the function returns as many tables as there are auxiliary value packets)

Remote API equiv.

B0-based remote API:simxReadVisionSensor

Legacy remote API:simxReadVisionSensor

simGetVisionSensorCharImage / sim.getVisionSensorCharImage

Description

Retrieves the rgb-image (or rgba, or a portion of it) of a vision sensor. The returned data doesn't make sense ifsim.handleVisionSensorwasn't called previously (sim.handleVisionSensor is called by default in the main script if the vision sensor is not tagged asexplicit handling). See alsosim.getVisionSensorImage,sim.setVisionSensorCharImageandsim.saveImage.

C synopsis

simUChar* simGetVisionSensorCharImage(simInt sensorHandle,simInt* resolutionX,simInt* resolutionY)

C parameters

sensorHandle: handle of the vision sensor. Can be combined withsim_handleflag_greyscale(simply add sim_handleflag_greyscale to sensorHandle), if you wish to retrieve the grey scale equivalent.

resolutionX/resolutionY: the returned vision sensor resolution

C return value

image buffer (buffer size is resolutionX*resolution*3 or resolutionX*resolutionY in case of a grey scale image retrieval) or NULL in case of an error. The user is in charge of releasing the returned buffer withsimReleaseBuffer. Returned values are in the range of 0-255 (0=min. intensity, 255=max. intensity)

Lua synopsis

string imageBuffer,number resolutionX,number resolutionY=sim.getVisionSensorCharImage(number sensorHandle,number posX=0,number posY=0,number sizeX=0,number sizeY=0,number rgbaCutOff=0)

Lua parameters

sensorHandle: handle of the vision sensor. Can be combined withsim.handleflag_greyscale(simply add sim.handleflag_greyscale to sensorHandle), if you wish to retrieve the grey scale equivalent.

posX / posY: position of the image portion to retrieve. Zero by default.

sizeX / sizeY: size of the image portion to retrieve. Zero by default, which means that the full image should be retrieved

rgbaCutOff: when different from zero, then an RGBA image is returned, where the alpha component will be 255 for all depth values belowrgbaCutOff, and 0 for all depth values abovergbaCutOff. 0 corresponds to the near clipping plane, 1 to the far clipping plane. Zero by default.

Lua return values

imageBuffer: nil in case of an error. Otherwise a string containing rgb (or rgba) values (table size is sizeX*sizeY*3 (or sizeX*sizeY*4 in case of rgba), rgb(a) values in the range 0-255). In case of a grey scale image retrieval, the image buffer will contain grey values or grey+alpha values in the range 0-255.

Remote API equiv.

B0-based remote API:simxGetVisionSensorImage

Legacy remote API:simxGetVisionSensorImage

9.VREP导入URDF问题

导入路径不要有中文。否则会报错。

导入步骤:

一、SW模型导出为URDF文件

URDF是机器人数据插件,SW默认没有。需要下载URDF,

http://wiki.ros.org/sw_urdf_exporter

然后安装,再进入SW插件设置,打开URDF插件。

SW加载好URDF插件之后,在设计---文件下找到。

点击导出,构建导出关节文件,即可。

注意设置合理的joint坐标系和joint轴。

二、VREP导入URDF文件

VREP下,点击插件,找到URDF,即可导入。

URDF importer plugin

The URDF file format (*.urdf) is supported for import operations via a plugin coutesy of Ignacio Tartavull: simExtUrdf. If the URDF plugin was correctly loaded, you can access the plugin dialog via [Menu bar --> Plugins --> URDF import...]:

[URDF plugin dialog]

  • Assign collision links to layer 9: hides collision links in layer 9 (layer 9 is off by default).
  • Assign joints to layer 10: hides joints in layer 10 (layer 10 is off by default).
  • Convex decompose non-convex collision links: decomposes non-convex respondable shapes into convex shapes. This item should always be checked, since convex shapes perform faster and are more stable during dynamic collision response calculations.
  • Show convex decomposition dialog: allows to adjust the way how the convex decomposition operates.
  • Create visual links if none: creates an artificial visual element if the link doesn't define one.
  • Center model above ground: centers the imported model above the ground.
  • Prepare model definition if feasable: tags the root object as "model base" and adapts the other objects accordingly (e.g. clicking an object in the model will select the whole model instead of an individual object).
  • Alternate local respondable masks: when checked, alternates the local collision masks so that adjacent respondable shapes won't react to collision. If unckecked, then all respondable shapes will only react to collision with objects outside of the model.
  • Enable position control for revolute and prismatic joints: if checked, then revolute and prismatic joints will be in position control mode. Joint force/torque and upper regulation velocity are taken from the URDF file.
  • Import: triggers an import operation.
5.VREP常见问题2第7张
图30 URDF导入窗口

Assign collision links to layer 9

Assign joints to layer 10

Convex decompose non-convex collision links

Show convex decomposition dialog

Create visual links if none

Center model above ground

Prepare model definition if feasable

Alternate local respondable masks

Enable position control for revolute and prismatic joints

Import

10.VREP导入STL文件

将准备好的STL文件放置于无中文字符的路径下。点击VREP中的file。按图选择,之后点击选择文件,之后有出现shape的属性设置问题。Mesh files支持obj、dxf、ply、stl、dae。

5.VREP常见问题2第8张
图31 Import导入窗口-1
5.VREP常见问题2第9张
图32 Import导入窗口-2
5.VREP常见问题2第10张
图33 Import导入窗口-3

上图中的相关参数可以不设置,等到导入之后再根据实际需求进行调整。

免责声明:文章转载自《5.VREP常见问题2》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇php 例子 如何转换ISO8601为 utc时间UE中使用正则表达式的一些技巧下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

随便看看

HP服务器设置iLO

HP Server Setting iLO Step 1.开机后出现界面-按F11进入BootMenu;2.选择GenericUSBBoot并输入;3.选择SystemConfiguration(系统配置)并按Enter键;4.选择iLO4ConfigurationUtility进入;5.选择NetworkOptions Enter将DHCPEnable设置...

【原生】CocosCreator Android和游戏的通讯 (Java和TS互相调用、传递JSON数据、监听返回键)

Cocos版本:2.4.4参考:Cocos文档-Java原生反射机制Cocos文档-JSB使用指南-在Cocos中调用Android方法2在Android中调用Cocos方法3传输JSON数据4倾听返回键5 Cocos和Android相互调用时遇到的问题,TypeScript方法可以在Java中调用,Java方法可以在TypeScript中调用。在Cocos...

使用AutoHotKey提升工作效率

打开网站并按TAB键,直到到达输入字段并计算点击次数。使用以下代码将“名字”、“中间名”、“姓氏”和其他两个ID放入Web表单。...

IIS 中 "另一个程序正在使用此文件,进程无法访问!"

然而,自从昨晚重新启动机器后,发现iis无法启动。手动启动并提示:“另一个程序正在使用此文件,进程无法访问它!”百度得知这是由港口冲突造成的。什么软件使用端口80?同时,我更改了iis的默认端口80,没问题。接下来,我想知道是哪一方秘密占用了端口80。但是,在执行上述命令后,我没有找到占用端口80的程序。我惊讶地发现没有人占用端口80。...

Wayland 源码解析之代码结构

Wayland实现的代码组成可以分为以下四个部分:1.Wayland库的核心部分,大部分Wayland协议实现都位于该库中。1) 该工具程序分析Wayland协议文件并生成相应的头文件和代码文件。源代码文件列表:wayland/cursor/wayland cursor。通道/光标/通道光标。cwyland/cursor/os兼容性。cwyland/curs...

如何下载Chrome离线版EXE安装文件和MSI版安装文件

对于Chrome的稳定版本(官方版本),您只需添加“?”在Chrome的“最终用户许可协议”页面上的链接之后?Standalone=1对于Beta版和开发版Chrome,只需记住以下地址:http://dl.google.com/chrome/install/{versionnumber}/crome_安装程序中的版本号。exe表示要下载的Chrome版本号...