vrep和matlab,ROS_Kinetic_18 使用V-Rep3.3.1和Matlab2015b(vrep_ros_bridge)续

ROS_Kinetic_18 使用V-Rep3.3.1和Matlab2015b(vrep_ros_bridge)续

上一节配置的v-rep在ros kinetic中是可以看图像,并订阅主题的,但是无法发送消息让机器人动起来,

在Top启发下,研究了一下,终于解决了,官方提供的正对3.3.1版本的vrep需要额外的步骤。

ln -s compiledRosPlugins/libv_repExtRos.so

配置后在

kinetic中是会报错的,这时候需要重新编译生成该文件。

1 编译生成

这里,需要注意catkin_make和catkin build的区别,并灵活使用。

复制在v-rep安装目录ros_packages到catkin_relay/src中:

/home/relaybot/Rob_Soft/V-REP_PRO_EDU_V3_3_1_64_Linux/programming/externalIkDemo1/ros_packages

需要修改,其中CMakeLists.txt,加入:

link_directories("/opt/ros/kinetic/lib")

ce7a66200c71f4fd12de9f66f02cca5b.png

使其可以用于kinetic,需要修改多处。然后编译,这里推荐用catkin build:

~$ cd catkin_relay/

~/catkin_relay$ catkin build

36a270cd626fb10694dea5552448aa21.png

完成后,就可以在devel/lib下看到新的.so。

1a0891e0f39af560bd7f17da81d5da87.png

~/Rob_Soft/V-REP_PRO_EDU_V3_3_1_64_Linux$ ln /home/relaybot/catkin_relay/devel/lib/libv_repExtRosBridge.so

~/Rob_Soft/V-REP_PRO_EDU_V3_3_1_64_Linux$ ln /home/relaybot/catkin_relay/devel/lib/libv_repExtRos.so

这时,启动./vrep.sh,就不会出错了。

2 图像识别

分别启动roscore和v-rep。

打开Pioneer_p3dx_traj_DEMO.ttt场景并运行。

新打开一个终端,运行:

~$ roslaunch demo_pioneer demo-visual-servo-pioneer-simulation.launch

476ef1791cc1538a63d13fd56587944f.png

6c57ddff043be49e1e06ca6bb4940c7c.png

图像被标记出。这里需要用到visp,demo_pioneer等。

3 控制机器人

~$ rosrun rqt_publisher rqt_publisher

d12e88bac666f2a0463cdb69a48f6b23.png

77fdb12adf3f04c3e6e40dcd20c4e5f4.png

77c91728c51ede168bde7f4edbb46e0c.png

4 Matlab

Matlab2015b之后版本可以直接使用ROS,测试过indigo和kinetic都没有问题。也可以用matlab直接和vrep调试。

69f80ed7e91a07becded4019f03dde6f.png

4be14c93896ca512f126ada0bdaaf11f.png

最后补一组图,ros和vrep控制空中机器人也很方便的。

937f0e83ea7689d5b92eb79c7f44d6ef.png

b1f936afe005d46af3995f91d891fec4.png

554df7c7342211f2704af98374c9eeb4.png

-End-

补充 API接口

Remote API

The remote API is part of the V-REP API framework.

V-REP offers a remote API allowing to control a simulation (or the simulator itself) from an external application or a remote hardware (e.g. real robot, remote computer, etc.). The V-REP remote API is composed by approximately one hundred specific functions and one generic function, that can be called from a C/C++ application, a Python script, a Java application, a Matlab/Octave program, an Urbi script, or a Lua script. The remote API functions are interacting with V-REP via socket communication in a way that reduces lag and network load to a great extent. All this happens in a hidden fashion to the user. The remote API can let one or several external applications interact with V-REP in a synchronous* or asynchronous* way (asynchronous by default), and even remote control of the simulator is supported (e.g. remotely loading a scene, starting, pausing or stopping a simulation for instance).

The word Synchronous is used in the sense that each simulation pass runs synchronously with the remote API application (i.e. the simulator will wait for a trigger signal from a client to start next simulation pass at a time t+dt). This is different from synchronous/asynchronous in the sense of blocking/non-blocking operation. The remote API also supports blocking and non-blocking operations.

Make sure you understand how the remote API is operating by reading this section. Also have a look at the external controller tutorial.

The remote API functionality comes in 2 separate entities, that are interacting via socket communication:

the client side (i.e. your application): the remote API on the client side is available for many different programming languages. Currently following languages are supported: C/C++, Python, Java, Matlab, Octave, Urbi and Lua. Bindings for other languages can easily be created by yourself. Instructions on how to enable the remote API on the client side are given here.

the server side (i.e. V-REP): the remote API on the server side is implemented via a V-REP plugin that should be loaded by V-REP by default: v_repExtRemoteApi.dll, libv_repExtRemoteApi.dylib or libv_repExtRemoteApi.so. The plugin project files are located in V-REP's installation directory, in the "programming" folder. Instructions on how to enabled the remote API on the server side are given here.

Recommended topics

本文同步分享在 博客“zhangrelay”(CSDN)。

如有侵权,请联系 support@oschina.cn 删除。

本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值