ROS机器人项目开发11例-ROS Robotics Projects(6)Matlab和Android





Robot Operating System (ROS)

Access ROS networks, robots, and simulators

Robotics System Toolbox™ enables you to interface with ROSand use ROS functionality in MATLAB® and Simulink®. You canconnect to a ROS network, collect data, send and receive your ownmessages, and deploy code to a standalone system. To get started,you must first connect to a ROS network. See Get Started with ROS.

Frequently Viewed Topics



version 1.0 (35.5 KB) by James

GUI to connect to ROS master .

This GUI simplifies connection to a ROS Network. It also has built-in teleoperation features. Step 1: On the 'Connection' panel, set the IP address of the Master node.

Step 2: Click 'Connect'. Successful connection will result output like this 'Initializing global node /matlab_global_node_88657 with NodeURI' appearing on Matlab command prompt.

Step 3: On the 'Topics' panel, click on 'List out Topics' to see the topics available. Select the topics that you wish to publish/subscribe and click 'Publish' or 'Subscribe'.

Step 4: On the 'Nodes' panel, click on 'List out Nodes' to see the nodes available. Their respective subscriptions, publications and services are shown on the right.

Step 5: Use the Control buttons (Move Front, Move Right...etc) to control the simulated robot in gazebo or the actual robot.


Gazebo Matlab Bridge using Ros serialization

This package provides a gazebo plugin and a mex interface for fast communication between matlab and Gazebo. The mex interface provides fast access to link and joint states; easy application of link and joint efforts; way to set model and joint states. Various matlab examples have been provided in MATLAB


Prerequisite installations:

  • ros-hydro/indigo
  • Gazebo 1.9/2.x
  • ros-hydro-gazebo-packages

Install hydro for ubuntu 12.04 and indigo for ubuntu 14.04.

Instructions for Installing PQP:

Download PQP from here; Untar the file and run make in the folder. If you are running a 64 bit operating system you should add the following lines to the Makefile :

Add these lines after "CFLAGS = -O2 -I." in Makefile for x86_64 systems


Once compiled copy the files into your system using the following commands:

sudo cp -r include /usr/local/include/PQP
sudo cp lib/libPQP.a /usr/local/lib/libPQP.a
sudo ldconfig

Instructions for setting ROS:

For Hydro/Indigo installation follow instructions here/here; Choose the Desktop-Full Install (Recommended) version when installing ROS.

Then to setup a catkin workspace follow the instructions here. Once the environment is setup run the following command:

echo "source ~/catkin_ws/devel/setup.bash">>~/.bashrc

Once the environment is setup, install the prerequisites:

For hydro:

sudo apt-get install ros-hydro-gazebo-ros ros-hydro-gazebo-ros-pkgs

For Indigo:

sudo apt-get install ros-indigo-gazebo-ros ros-indigo-gazebo-ros-pkgs

Package installation:

Go into catkin workspace (~/catkin_ws for above instructions)/src folder:

cd ~/catkin_ws/src

Clone the package from git:

git clone

Run the setup_script.bash with the arguments as MATLAB_ROOT(Directory where MATLAB is installed) and ROS_WORKSPACE(~/catkin_ws) if you have followed instructions above)

Example Usage:

source setup_script /usr/local/MATLAB/R2014a ~/catkin_ws

After installing the main components, if PQP is installed, you can run "source pqp_setup.bash" to setup collision checking module.

Further Documentation:

Lookup documentation.pdf . Also Checkout Tutorials

Matlab Documentation:


Compile PQP with -fPIC under x86_64 systems since it produces static libraries



This repo has Matlab and Python code for reading data from a ROS bag file directly into a Matlab workspace. See the documentation for bagReader.m and bagInfo.m for information on how to use the code. This requires Matlab and ROS to run. Tested with ROS Kinetic Kame, Matlab R2015b, and R2016b.

The bagReader() Matlab script reads all data from a bag for a given topic. Simply call bagReader.m with the bag name and the topic to read to get all of the data from that topic as a table. For example, bagReader('flight.bag', '/uav/pose') will read all of the data published on the '/uav/pose' topic that is stored within 'flight.bag'.

bagInfo() returns the names and types of all the topics in a bag. For example: bagInfo('flight.bag') will return two cell arrays, one with the topic names, and the other with the corresponding types.

For convenience, there is also a Matlab function for converting ROS images from sensor_msgs/Image messages to a representation Matlab can understand. This functionality is in rosImageToMatlab.m. Currently, only mono8 and bgr8 conversions are supported.


SZE academic robotics projects

This repository contains various projects developed in the Széchenyi István University (SZE) located in Győr, Hungary.

1. V-REP MATLAB interoperation demo

Name: VrepMatlabInteroperation

Description: The aim of the project is to demonstrate the V-REP Remote API functions in MATLAB.

Demo images

V-REP scene:

The same scene in MATLAB:

2. Robot follows human project

Name: NeobotixRobotFollowsHuman

Description: A project where humans are followed by a Neobotix moblie robot. You can watch a video on youtube about this project.

Demo images

The scenario and the hardware components:

The illustration of the scenario:

3. Robotic arm - Kinect project

Name: RoboticArmKinect

Description:A project to control an own developed robotic arm with the help of Kinect. You can watch a video on youtube about this project.

4. V-REP C# interoperation demo

Name: VrepCsharpInteroperation

Description: The aim of the project is to demonstrate the V-REP Remote API functions in C#.

5. Coverage path planning algorithms on grid maps

Name: RobotGridCoveragePathPlanning

Description: Some grid map (occupancy grid) based coverage path planning algorithms implemented in MATLAB.

Demo images

The illustration:



This page contains the source code of a set of Matlab C++ S-functions that can be used to:

  • synchronize simulink with the system clock, thus obtaining a soft-real-time execution;
  • interface simulink blocks with other ROS nodes using ROS messages.

This project is based on a work started by Martin Riedel and Riccardo Spica at the Max Plank Institute for Biological Cybernetics in Tuebingen (Germany).This fork is currently supported by Riccardo Spica and Giovanni Claudio at the Inria Istitute in Rennes (France).

The software is released under the BSD license. See the LICENSE file in this repository for more information.

Configuring Matlab

Before proceeding with the next steps you need to configure Matlab mex compiler.

For Matlab 2014b and older, run matlab and type the following command in the command window:

mex -setup

When you get the following message:

Enter the number of the compiler (0-1):

Enter 1 to select the first option. This should create a mex option file in ~/.matlab/R2014a/ this file and make sure that the correct version of the gnu compiler is used.

For Matlab 2015a and newer, run matlab and type the following commands in the command window

mex -setup
mex -setup C++

This should create two files in ~/.matlab/<matlab_version>/ named mex_C_glnxa64.xml and mex_C++_glnxa64.xml.Open mex_C++_glnxa64.xml and substitute all instances of "g++" and "$GCC" with "g++-4.7" (or 4.4 for older versions of Matlab).Open mex_C_glnxa64.xml and substitute all instances of "gcc" and "$GCC" with "gcc-4.7" (or 4.4 for older versions of Matlab).

Compiling the bridge

The process of compiling the matlab_ros_bridge is not straightforward. The main problem is that MATLAB doesn't use the system distribution of boost but instead comes with its ows shipped version, which can be found in, e.g. 'matlabroot/bin/glnxa64/'.Since the mex files that we generate will run inside matlab it is important that they are linked against the same version of boost that is used in MATLAB. Moreover, since the mex files will also be linked to ROS libraries, we also need to recompile ROS and link it to the same version of boost.Finally we also need to compile everyting (boost, ros and our mex files) using a c/c++ compiler officially supported by the MATLAB distribution that we are using.

###Compiling boost

This section will guide you through the process of compiling the required version of boost with the compiler supported by your Matlab version. Before doing this you should try using one of the precompiled boost distributions available in the download section of this repository. Check the version correspondance table below in this page to find the correct download link.If you cannot find a precompiled boost download link for you setup then keep reading, otherwise skip to the following section.

  1. Download the correct version of boost from here in a folder of your choice (later referred to as <boost_dir>). To know which version you need you can type, in a matlab command window, the following command: ls([matlabroot '/bin/glnxa64/libboost_date_time*'])
  2. Open a new terminal and navigate to <boost_dir> and give the following command: $ ./ --prefix=path/to/boost/installation/prefix
  3. Edit the file <boost_dir>/project-config.jam with your favourite tool and substitute: using gcc; with (e.g.) using gcc : 4.4 : g++-4.4 : -std=c++0x ; The exact version of gcc/g++ that you need to use depends on the matlab release (check it on Matlab website).
  4. Build boost by doing: $ ./bjam link=shared -j8 install

Note: while building Boost you might encounter this pseudo-bug due to an incompatibility between older versions of Boost and the new C11 standard. To solve this you can either substitute all occurrences of TIME_UTC in all Boost headers with TIME_UTC_ (as done in more recent versions of Boost). For istance, in version 1.49.0, you need to modify <boost_dir>/boost/thread/xtime.hpp and <boost_dir>/libs/thread/src/pthread/timeconv.inl.

In some cases you might be able to solve this issue by modifying <boost_dir>/project-config.jam so as to change

using gcc : 4.4 : g++-4.4 ;


using gcc : 4.4 : g++-4.4 : -U_GNU_SOURCE ;

If you are building boost on a x64 system you might also encounter this bug. In this case just apply the proposed fix.

Compiling ROS

  1. Follow the instructions for your ROS distribution on<distro>/Installation/Source (e.g. for Indigo), to install ROS-Comm in the "wet" version until you need to compile. DON'T COMPILE NOW (it means that you don't have to do a catkin_make or catkin_make_isolated). To reduce the number of ros packages to compile, you can also initialize your workspace with $ rosinstall_generator roscpp geometry_msgs std_msgs sensor_msgs shape_msgs --rosdistro indigo --deps --wet-only --tar > mrb.rosinstall $ wstool init -j8 src mrb.rosinstall
  2. In a terminal navigate to the src directory of the catkin workspace created in the previous step and do: $ wstool set matlab_ros_bridge --git $ wstool update matlab_ros_bridge
  3. Before compiling you might also need to modify the file src/roscpp/src/libros/param.cpp as described here.
  4. Compile ros and the bridge with: $ src/catkin/bin/catkin_make --cmake-args -DBOOST_ROOT=path/to/boost/installation/prefix -DBoost_NO_SYSTEM_PATHS=ON -DCMAKE_C_COMPILER=/usr/bin/gcc-4.7 -DCMAKE_CXX_COMPILER=/usr/bin/g++-4.7 -DMATLAB_DIR=/usr/local/MATLAB/R2015b note that you might need to change this command according to your <boost_dir>, Matlab path and compiler version.Add install at the end or run catkin_make install if desired.For old versions of ROS (before Indigo) you may need to use the command catkin_make_isolated instead of catkin_make.Note: the incompatibility issue discussed in the previous section might cause rosbag (and possibly other packages) to fail building. If this is the case, either substitute all occurrences of TIME_UTC in all rosbag source files with TIME_UTC_ or add -DCMAKE_CXX_FLAGS=-U_GNU_SOURCE to your catkin_make command above.
  5. Make sure you have "sourced" your workspace by running: $ source /path/to/your/catkin_ws/devel_isolated/setup.bash Navigate to the build directory of the package matlab_ros_bridge. It should be catkin_ws/build/ or catkin_ws/build_isolated/matlab_ros_bridge if you used catkin_make_isolated. Now generate the simulink block library by running: $ cmake . $ make generate_library

Running MATLAB

  1. In your MATLAB Startup File add the following lines: addpath(fullfile('path','to','your','catkin_ws','devel_isolated','matlab_ros_bridge','share','matlab_ros_bridge')); run(fullfile('path','to','your','catkin_ws','devel_isolated','matlab_ros_bridge','share','matlab_ros_bridge','setup.m'));
  2. To run matlab open a terminal and type the following: $ source /path/to/your/catkin_ws/devel_isolated/setup.bash $ matlab

Testing that everything works

  1. In your matlab command window navigate to the folder /path/to/your/catkin_ws/src/matlab_ros_bridge/matlab_ros_bridge/models and type Tsim = 2e-5; Now open the model test.slx and try to run it in all different running mode.


It might be possible (but it has never been tested) to avoid compiling boost and try to link ros and the mex files against the boost libraries contained in the MATLAB installation directory.

Matlab boost and cpp version correspondances and download link

Matlab version

gcc supported version

shipped boost vesion

compiled boost download

Matlab compiled version


GNU gcc/g++ 4.4.x





GNU gcc/g++ 4.4.x





GNU gcc/g++ 4.4.x





GNU gcc/g++ 4.7.x





GNU gcc/g++ 4.7.x





GNU gcc/g++ 4.7.x





GNU gcc/g++ 4.7.x





GNU gcc/g++ 4.7.x





GNU gcc/g++ 4.9.x




Ros/Matlab combinatios that have already been tested:












never tested

never tested

never tested

never tested

never tested


never tested






never tested


never tested

never tested

never tested

never tested

never tested

never tested

not working




Wifi data aquistion between Android and ROS

More information,get in my blog in Chinese!


RosClient: Android app for ROS

Android communicate with ROS(Robot Operating System),based on rosbridge protocol

see more in my blog (In Chinese)


  1. Enum all ROS nodes,service,topics
  2. Show params in service or topics
  3. Subscribe or publish ros topic
  4. Call ros service
  5. Process topic "/cmd_vel", control the movement of robot
  6. Process topic "/map", show the map of SLAM,like rviz


Use Library


Copyright 2016 xxhong

Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.








ROS-autom Team

This project is active again.

Prepare your distro for compile:

  • Download Android Studio from
  • Follow the introduction until you reach the IDE
  • Save the SDK to /home/android_sdk
  • Open SDK Manager (Press the icon with blue arrow and android logo on tool bar)
  • From SDK platforms select all API levels from 26 to 22
  • From SDK Tools select 'Show package details'
  • Select 21.1.2 and 26.0.0
  • Press apply and ok
  • Accept the license and let it download the required files
  • Run the android studio: . /path/to/studio/bin/
  • File->Open->RobotCA/src/android_foo
  • Wait gradle to be initialized


  • touch ~/.gradle/ && echo "org.gradle.daemon=true" >> ~/.gradle/
  • echo "org.gradle.parallel=true" >> ~/.gradle/
  • echo "org.gradle.configureondemand=true" >> ~/.gradle/

and finally run our script

  • cd to the husky_kinetic/RobotCA and run ./


If you get aapt exited with code 127 ,please runsudo apt-get install lib32z1 lib32ncurses5 lib32stdc++6


ros-autom team, Thessaloniki of Greece 2017

Originally posted by:

University of South Carolina

CSCE 490 & 492 Capstone Design

Our project is to design an Android application to control a robot. Specifically, the goal is to create a native Android tablet application to interface with a Robot Operating System (ROS) robot, Clearpath Robotics' HUSKY model, for direct drive, diagnostic, and navigation information. The application will have to process data from various sensors on the robot and display the information in a user understandable fashion. For example, the robot will have a laser ranging system which will be collecting data on the environment. The application must parse this data and display the environment that the robot "sees".

Download from the Google Play Store today!


  • ROS
  • ROSJava
  • Android 4.0+ (API level 13+)

Client Information: Dr. Ioannis Rekleitis Assistant Professor University of South Carolina

----ROS2 for Java

ROS2 for Java

Build status




This is a set of projects (bindings, code generator, examples and more) that enables developers to write ROS2applications for the JVM and Android.

Besides this repository itself, there's also:

Is this Java only?

No, any language that targets the JVM can be used to write ROS2 applications.

Including Android?

Yep! Make sure to use Fast-RTPS as your DDS vendor and at least this revision.


The current set of features include:

  • Generation of all builtin and complex ROS types, including arrays, strings, nested types, constants, etc.
  • Support for publishers and subscriptions
  • Tunable Quality of Service (e.g. lossy networks, reliable delivery, etc.)
  • Clients and services
  • Timers
  • Composition (i.e. more than one node per process)
  • Time handling (system and steady, ROS time not yet supported
  • Support for Android

Sounds great, how can I try this out?

First of all, download the ament repositories in a separate workspace:

mkdir -p ~/ament_ws/src
cd ~/ament_ws
vcs import ~/ament_ws/src < ament_java.repos
src/ament/ament_tools/scripts/ build --symlink-install --isolated

We need to split the build process between Ament and the rest of ros2_java workspace so that the additional build type for Gradle projects is picked up by Ament.

The following sections deal with building the ros2_java codebase for the desktop Java runtime and for Android.


mkdir -p ~/ros2_java_ws/src
cd ~/ros2_java_ws
vcs import ~/ros2_java_ws/src < ros2_java_desktop.repos
cd ~/ros2_java_ws/src/ros2/rosidl_typesupport
patch -p1 < ../../ros2_java/ros2_java/rosidl_typesupport_ros2_java.patch
cd ~/ros2_java_ws
. ~/ament_ws/install_isolated/
ament build --symlink-install --isolated

Now you can just run a bunch of examples, head over to for more information.


The Android setup is slightly more complex, you'll need the SDK and NDK installed, and an Android device where you can run the examples.

Make sure to download at least the SDK for Android Lollipop (or greater), the examples require the API level 21 at least and NDK 14.

You may download the Android NDK from the official website, let's assume you unpack it to ~/android_ndk

mkdir -p ~/ros2_android_ws/src
cd ~/ros2_android_ws
vcs import ~/ros2_android_ws/src < ros2_java_android.repos
cd ~/ros2_android_ws/src/ros2/rosidl
touch python_cmake_module/AMENT_IGNORE
touch rosidl_generator_py/AMENT_IGNORE
cd ~/ros2_android_ws/src/ros2/rosidl_typesupport
patch -p1 < ../../ros2_java/ros2_java/rosidl_typesupport_ros2_android.patch
cd ~/ros2_android_ws
. ~/ament_ws/install_isolated/
ament build --isolated --cmake-args \
  -DPYTHON_EXECUTABLE=/usr/bin/python3 \
  -DCMAKE_FIND_ROOT_PATH="$HOME/ament_ws/install_isolated;$HOME/ros2_android_ws/install_isolated" \
  -DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-clang -DANDROID_STL=gnustl_shared \
  -DANDROID_ABI=armeabi-v7a \
  -DANDROID_NDK=$HOME/android_ndk/android-ndk-r14 \
  -DCMAKE_TOOLCHAIN_FILE=$HOME/android_ndk/android-ndk-r14/build/cmake/android.toolchain.cmake \
  -- \
  --ament-gradle-args \
  -Pament.android_stl=gnustl_shared -Pament.android_abi=armeabi-v7a -Pament.android_ndk=$HOME/android_ndk/android-ndk-r14 --

You can find more information about the Android examples at



Schedule and slides of my presentations. Invitations are welcome.

我的演讲的日程安排以及演讲资料下载。如果想要跟我做技术交流,欢迎给我发邮件 :)







如果你在阅读完这本小册子之后,在日常的团队管理中能够有帮助,对于我而言是莫大的鼓励。如果有问题或勘误,欢迎与我联系讨论,我的邮箱是 lazyparser[at]








  • 我们提供一个月的内部培训,希望你能够有至少三个月的实习时间,并能够保证每周有一些连续的时间可以用来实习。
  • 有强烈地上进心,希望能够有更强的技术能力。
  • 并且能够积极而谦卑地与他人一起共事。
  • 遇到编译、运行错误时,会使用google找到错误信息相关的网页。对,google。
  • 最好是使用过Linux,并且知道Bash脚本编程的基本概念。如果目前没有,没有关系,可以看看我们的 linux技能表Bash技能表
  • 最好是使用过Python,能看到简单的Python程序。如果还不会python,没有关系,可以看看我们的python技能表
  • 最好是用过git,知道git技能列表中的git merge,git rebase等概念。
  • 最好是有github账号,知道如何开新分支,提交PR。这个如果不知道可以看看github官网的帮助,很详细。

工作内容: 具体岗位需求可能随时间变化,请查看我们的开放职位列表

关于远程工作: 除了ROS设备相关的实习工作需要来软件所xlab现场调试机器人之外,其它岗位默认都是远程办公(or work from home)。

协作方式: 我们通过 slack + GitHub 作为主要的协作工具。偶尔也用微信/QQ。

实习工资: 很少,每月1500,基本上等于没有(尴尬)。





(0人)安卓开发(Android Dev)

  • 与XBot机器人UI交互程序的开发、调试、测试和集成。
  • 目前主要是 XBot_Head 项目的开发。

(5人)ROS开发(ROS Dev)

  • 参与机器人操作系统相关的软件开发、测试、调试、部署。
  • 在第一个月内训中提供ROS基础培训。
  • 目前我们在做的项目有:底盘驱动、导航、避障、骨骼检测等。

(1人)机器人测试开发(Robot Test Automation)

  • 参与机器人测试过程的脚本开发及测试自动化。
  • 需要会写 Bash 和 Python 脚本。
  • 内训后需要会 ROSBag / Gazebo 等的知识。

(3人)深度学习/机器学习(Deep Learning Engineering)

  • 尝试将现有已发表的深度学习开源研究成果跑起来,在算力和功耗都有局限的嵌入式设备(or 机器人)中运行起来。通过降低计算精度、网络稀疏化等方式优化神经网络在树莓派、TK1、TX1等设备上的执行速度。
  • 需要一名实习生将AlexNet为代表的一系列ImageNet识别模型,裁剪并移植到嵌入式设备上。
  • 需要一名实习生实现本地的语音识别,主要是近场的关键词识别。
  • 需要一名实习生将OpenPose为代表的骨骼检测算法进行裁剪并移植到TK1/TX1设备上。

(0人)社区经理(Community Manager)

  • 参与XBot机器人社区的日常维护活动,组织线上及线下的爱好者交流活动。该岗位跟ROS岗位一样会有ROS培训,内训结束后具备ROS基础知识。
  • 需要有良好的沟通能力,以及帮助他人的热情。

(0人)全栈网页开发(Full Stack Web Dev)

  • 为XBot开发基于Web的呈现和控制系统。

(0人)XBot/ROS机器人培训师(XBot/ROS Instructor)

  • 在完成我们的XBot/ROS培训师培训之后,能够在线下组织进行XBot/ROS的技术交流。





0 条评论
登录 后参与评论