matlab ros wiki,groovy/Planning/Matlab

ROS on MATLAB

SIG Coordinators: Remo Pillat and Giampiero Campa, Topics: ROS-MATLAB and ROS-Simulink Interfaces

Mailing List:

Official MATLAB ROS Support

Official ROS Support from MathWorks was released in January 2014. Users can create ROS nodes in MATLAB and exchange messages with other nodes on the network. This allows control of ROS-enabled robots and simulators through a convenient MATLAB interface. Building on top of the newest rosjava Hydro library, the software can be used cross-platform on Windows and Linux. It provides a MATLAB API interface for the following functionality:Create ROS nodes, publishers, or subscribers directly from MATLAB

Create and send ROS messages from MATLAB

Enable publishers to publish MATLAB data to their advertised topics

Enable subscribers to execute arbitrary user-defined MATLAB functions

Enable launching of a ROS core on the local host from MATLAB

A demo application controlling a simulated Turtlebot in Gazebo is available on File Exchange.

Some commercial companies also provide examples on how to use this interface:

Other Interfaces

This is a list of existing interfaces, some of which are somewhat documented and in fair working conditions. However note that the extent to which these interfaces are actually actively maintained is unknown.

IPC Bridge

IPC Bridge, developed originally by Nathan Michael and packaged up by Ben Cohen at UPenn (last updated on March 2013). It is an inter-process communication layer that allows MATLAB and ROS to communicate. It is mature and relatively well documented, but installation requires several steps. Roughly speaking the limitations of this approach are due to the fact MATLAB and ROS just talk to each other but are not really "integrated".

ros4mat

ros4mat, is an open source client/server library, developed at Laval University, which allows for a platform-independent connection between a robot (running ROS) and multiple clients (running only Matlab). The communication between servers and clients is based on standard TCP sockets, therefore the main concept is not dissimilar from the IPC bridge solution described above, except that, as argued by the authors, ros4mat is multiplatform, easier to install and use, and generally more flexible. Currently, the ros4mat node integrates eight sensor types (IMU, GPS, RGB Cameras, Laser Rangefinder, Kinect, Analog Inputs, Battery Information, and System Information).

Java MATLAB Bridge

The Java_MATLAB_Bridge, developed by Tingfan Wu at UCSD (last updated on October 2012). This is based on rosjava. Specifically some rosjava JAR files are repackaged so that they can be invoked directly from MATLAB. The result is a easy-to-use cross-platform ros_matlab_bridge. This approach leads to a much closer integration between MATLAB and ROS. Total platform independence, ROS automatic java code generation for messages and topics, and the fact that java datatypes are converted and available in the MATLAB workspace automatically are just some advantages of this approach.

The MEX Approaches:

A different approach is to write mex files that wrap up ROS C-APIs. However, the versions of dynamic libraries (eg. boost) and compilers (gcc) used by ROS are different and incompatible from those shipped with MATLAB. This causes compile-time and runtime errors. An obvious solution is to rebuild ROS with the same version of GCC/DLLs used by Matlab. Along these lines there are 3 different attempts:

rosmatlab

Johannes Meyer at TU Darmstadt has developed a rosmatlab package (last updated on May 2013, and also described here). With this package, it only takes minutes to download the necessary boost headers and download and install groovy from source (using catkin) into a subfolder of the Matlab root directory with the BOOST_ROOT/BOOST_INCLUDEDIR/BOOST_LIBRARYDIR variables set correctly. This allows code built on top of roscpp to be compiled against the MATLAB/Mex libraries.

MATLAB/Mex Tools

Edward T. Kaszubski at USC has developed a package called MATLAB/Mex Tools (updated in November 2011, so perhaps it's not being maintained anymore), which uses CMake to allow for easy compilation against the MATLAB/Mex libraries (from an existing MATLAB installation). A C++ wrapper around the mxArray data type and a simple ROS/Mex bridge that allows for ROS messages to be sent and received within a Mex file are also included.

The manual approach at MPI

Finally, Martin Riedel, (working for the Antonio Franchi's Group at the Max Planck Institute in Tübingen, Germany) had some success, (previous attempts are also described here).

Reading ROS Bags in MATLAB

matlab_rosbag is a small library (last updated in May 2013) which lets you read ROS bags in MATLAB. This library (also described here) is intended to replace the one-off python / C++ programs / shell scripts that one has to write to analyze or play data inside MATLAB. The library wraps the C++ rosbag API and therefore it supports bag file format 1.2 and later, including things like reading compressed messages. Message instances are converted to MATLAB structs using the message definitions contained within the bag.

Note that ROS doesn't need to be installed on the system to use the library, (you just need to download a mex function and a matlab class file).

Other possible approaches (speculative)

This part lists other possible approaches that one could use towards interfacing MATLAB and ROS:

Code Generation from MATLAB/Simulink

It is possible (and actually it is common practice in the control community) to generate C code from Simulink, for different target hardware and operating systems. On a Linux installation, the Simulink Coder can generate C code and compile it as a Linux executable using the generic GRT and ERT Targets (integrating the Embedded Coder with Eclipse allows even more flexibility).

This allows the possibility of creating a Simulink model which, when compiled into a Linux executable, can fully connect to ROS. Note that this approach is different from the point #3 above because the connection to ROS does not happen during the simulation of the model, but when the executable generated by the model is run. This is how, for example, the orocos-simulink-toolbox integrates Simulink with OROCOS.

It is important to note that, differently from a mex file (which must work within Simulink), the executable generated by the Simulink Coder does not need to connect to Simulink at all and does not have to link to the same dynamic libraries used by MATLAB, therefore sidestepping many problems faced by the approach #3.

A guide that explain how to build blocks that, when compiled, perform target-specific operations is here.

Rosbridge

It should be possible to use the Rosbridge suite to interface MATLAB and ROS, and a few groups (including for example Felix Meßmer of the Fraunhofer IPA) plan to attempt this, but nothing is available yet as far as I know.

Use Cases and Requirements

Interested in an interface between ROS and MATLAB ? What is your "use case" ? What are you trying to accomplish ? More generally, what are in your opinion the requirements that such an interface should fulfill ?

Please feel free to share your thoughts either in the mailing list or in a private email to the coordinator of this page.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
资源包主要包含以下内容: ASP项目源码:每个资源包中都包含完整的ASP项目源码,这些源码采用了经典的ASP技术开发,结构清晰、注释详细,帮助用户轻松理解整个项目的逻辑和实现方式。通过这些源码,用户可以学习到ASP的基本语法、服务器端脚本编写方法、数据库操作、用户权限管理等关键技术。 数据库设计文件:为了方便用户更好地理解系统的后台逻辑,每个项目中都附带了完整的数据库设计文件。这些文件通常包括数据库结构图、数据表设计文档,以及示例数据SQL脚本。用户可以通过这些文件快速搭建项目所需的数据库环境,并了解各个数据表之间的关系和作用。 详细的开发文档:每个资源包都附有详细的开发文档,文档内容包括项目背景介绍、功能模块说明、系统流程图、用户界面设计以及关键代码解析等。这些文档为用户提供了深入的学习材料,使得即便是从零开始的开发者也能逐步掌握项目开发的全过程。 项目演示与使用指南:为帮助用户更好地理解和使用这些ASP项目,每个资源包中都包含项目的演示文件和使用指南。演示文件通常以视频或图文形式展示项目的主要功能和操作流程,使用指南则详细说明了如何配置开发环境、部署项目以及常见问题的解决方法。 毕业设计参考:对于正在准备毕业设计的学生来说,这些资源包是绝佳的参考材料。每个项目不仅功能完善、结构清晰,还符合常见的毕业设计要求和标准。通过这些项目,学生可以学习到如何从零开始构建一个完整的Web系统,并积累丰富的项目经验。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值