ROS Robotics Projects(9)虚拟现实VR头戴设备和Leap Motion手势操控
2017-08-17 14:39
1431 查看
除了自动驾驶汽车/人工智能外,还有一个火爆的科技热点就是虚拟现实/增强现实设备,这也是本书的第11章。
Leap Motion使用参考官网介绍和之前博文:
1 http://blog.csdn.net/zhangrelay/article/details/52356417
2 https://github.com/madratman/youbot_leapmotionteleop
ROS Android VR设备:
1 https://github.com/cloudspace/ros_cardboard
2 https://github.com/SPARbot/SPARbot-android-app
补充一个不相关内容:https://github.com/Nurgak/Virtual-Robot-Challenge
ROS+V-Rep
The goal of the Virtual Robot Challenge (VRC) is to introduce the Robotic Operating System (ROS) and V-REP simulation environment by performing autonomous tasks with a simulated robot.
This is to demonstrate the advantages of development using simulation, before eventually moving on to real robots. The advantages are that the code stays the same when moving from simulation to real robot, testing in simulation is much less time consuming (avoid mechanical failures, batteries, sensors failures/calibration...), cheaper and requires less effort in general.
All software used within the scope of this project is free to use.
The ROS tutorials are well written and straight forward, it is recommended to follow them as least for installation and workspace setup, this provides a good overview on how ROS works and how it is organized.
The robot is based on the Robopoly demonstration robot and can be physically built, any type of robot can be adapted for the simulation.
Install ROS Indigo
Install the catkin tools:
Create the workspace for ROS in
Copy the ROS interface package contents from V-REP install folder to ROS workspace:
Clone this repository to somewhere and copy the contents the ROS package to the workspace:
Build the packages (grab a coffee):
Copy the ROS interface plugin to the V-REP root folder
Source the setup file, this needs to be done in every new terminal:
The robot behavior is dictated by the Python scripts stored in
The launch files are used to start different nodes at the same time, they are stored in
Run ROS core in a terminal
From another terminal run V-REP, always start V-REP after ROS core
In V-REP open the
Click on the play button in V-REP to launch the simulation
In a third terminal launch the
Finally in a fourth terminal run the line follower program
The robot should start following the line marked on the floor.
The
----
Leap Motion使用参考官网介绍和之前博文:
1 http://blog.csdn.net/zhangrelay/article/details/52356417
2 https://github.com/madratman/youbot_leapmotionteleop
ROS Android VR设备:
1 https://github.com/cloudspace/ros_cardboard
2 https://github.com/SPARbot/SPARbot-android-app
补充一个不相关内容:https://github.com/Nurgak/Virtual-Robot-Challenge
ROS+V-Rep
Virtual Robot Challenge
The goal of the Virtual Robot Challenge (VRC) is to introduce the Robotic Operating System (ROS) and V-REP simulation environment by performing autonomous tasks with a simulated robot.
This is to demonstrate the advantages of development using simulation, before eventually moving on to real robots. The advantages are that the code stays the same when moving from simulation to real robot, testing in simulation is much less time consuming (avoid mechanical failures, batteries, sensors failures/calibration...), cheaper and requires less effort in general.
All software used within the scope of this project is free to use.
Theory
ROS is composed of small stand-alone entities called "nodes". Nodes publish and subscribe to messages called "topics" to talk between each other. One can write nodes in C++ or Python, topics are language agnostic. A good introduction can be found on the ROS official website.The ROS tutorials are well written and straight forward, it is recommended to follow them as least for installation and workspace setup, this provides a good overview on how ROS works and how it is organized.
Hardware
The robot has two wheels and a caster wheel in the back for locomotion. In the front it has six distance sensors, four pointing forwards and two pointing downwards under the robot, and a linear camera showing an image of 128 pixels wide and 1 pixel height.The robot is based on the Robopoly demonstration robot and can be physically built, any type of robot can be adapted for the simulation.
Software
The whole installation process has been fully tested on Ubuntu 14.04 with ROS Indigo. One can use VirtualBox if such a computer is not available, however it will slow down the simulation speed.Installation
Download and install the latest V-REP EDU, define theVREP_ROOTenvironment variable as the path to V-REP
export VREP_ROOT=<VREP path>
Install ROS Indigo
$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' $ sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net --recv-key 0xB01FA116 $ sudo apt-get update $ sudo apt-get install ros-indigo-desktop-full $ source /opt/ros/indigo/setup.bash
Install the catkin tools:
$ sudo apt-get install python-catkin-tools
Create the workspace for ROS in
~/catkin_ws:
$ mkdir -p ~/catkin_ws/src $ cd ~/catkin_ws/src $ catkin_init_workspace
Copy the ROS interface package contents from V-REP install folder to ROS workspace:
$ cp -r <VREP path>/programming/ros_packages/v_repExtRosInterface ~/catkin_ws/src
Clone this repository to somewhere and copy the contents the ROS package to the workspace:
$ git clone https://github.com/Nurgak/Virtual-Robot-Challenge.git $ cd Virtual-Robot-Challenge $ cp -r Software/ROS/vrc ~/catkin_ws/src
Build the packages (grab a coffee):
$ cd ~/catkin_ws $ catkin build
Copy the ROS interface plugin to the V-REP root folder
$ cp ~/catkin_ws/devel/lib/libv_repExtRosInterface.so <VREP path>
Source the setup file, this needs to be done in every new terminal:
$ cd ~/catkin_ws $ source devel/setup.bashExport the
ROS_MASTER_URIenvironment variable
$ export ROS_MASTER_URI=http://localhost:11311
Programming
The code actuating the robot motors and publishing its sensor data is written in Lua language in V-REP. It is very simple and only used to exchange data with the ROS framework, not for actual behavior logic. This is the place to add new code if one wishes to add new sensors to the simulated robot. To view the code open the V-REP scene and on the left side double-click on the script icon next to the robot node.The robot behavior is dictated by the Python scripts stored in
~/catkin_ws/src/vrc/src/. The
sample.pyscript shows how to process the data from all the different sensors on the robot.
The launch files are used to start different nodes at the same time, they are stored in
~/catkin_ws/src/vrc/launch/, think of them as shortcuts.
Follow the line
To goal is to follow a line. Very basic approach, however one can always optimize the system to make it faster.Run ROS core in a terminal
$ roscore
From another terminal run V-REP, always start V-REP after ROS core
$ sh <VREP path>/vrep.sh
In V-REP open the
arena.tttfrom the
/Simulationfolder
Click on the play button in V-REP to launch the simulation
In a third terminal launch the
arena.launchfile which will starts some nodes
$ roslaunch vrc arena.launch
Finally in a fourth terminal run the line follower program
$ rosrun vrc line_follower.py
The robot should start following the line marked on the floor.
Teleoperation
One can remotely operate the robot using the keyboard using theteleop_twist_keyboardpackage:
$ sudo apt-get install ros-indigo-teleop-twist-keyboardStop the line follower script (ctrl+c) and run:
$ rosrun teleop_twist_keyboard teleop_twist_keyboard.pyThe terminal must be in focus for the commands to be executed.
Exploration and mapping
ROS can do mapping using the robot sensors and its position. First make sure theslam_gmappingand
pointcloud_to_laserscanpackages are installed:
$ sudo apt-get install ros-indigo-slam-gmapping $ sudo apt-get install ros-indigo-pointcloud-to-laserscanAnd launch the mapping scene with:
$ roslaunch vrc mapping.launch $ rosrun vrc explorer.pyThe launch file runs the
gmappingand the RVIZ visualization nodes. Accessible areas are marked in white and inaccessible areas are marked in black.
The
explorernode makes the robot go around the arena and avoid obstacles, whenever it encounters an obstacle it will turn on itself for a random amount of time and continue.
Physical robot
When the simulation yields satisfying results one can use a real robot that subscribes to and publishes the same ROS topics as the virtual robot, this way the same software running on the computer can be used. The implementation for this can be done in various ways and is left up to the reader.----
相关文章推荐
- ROS Robotics Projects(5)深度学习
- Leap Motion颠覆操控体验的超精致手势追踪技术
- ROS Robotics Projects(6)Matlab和Android
- 怎么看待腾讯发布VR、AR一体机设备,进入虚拟现实领域
- ROS Robotics Projects(7)自主移动机器人
- ROS英文新书--ROS Robotics Projects
- VR系列——Oculus Audio sdk文档:一、虚拟现实音频技术简介(4)——听觉设备
- ROS Robotics Projects(3)嵌入式硬件和外设
- ROS Robotics Projects(8)自动驾驶汽车
- ROS Robotics Projects(2)语音部分
- 总结使用过的虚拟现实设备(A Brief Summary of Several VR Devices)
- 虚拟现实-VR-UE4-LEAP-Motion手势识别
- 虚拟现实(VR)、现实增强(AR)、全息现实以及可穿戴设备
- Leap Motion颠覆操控体验的超精致手势追踪技术【转】
- 扎克伯格20亿美元收购虚拟现实设备商Oculus VR
- ROS Robotics Projects(4)物体检测与识别
- Flock of Birds——总结使用过的虚拟现实设备之二(A Brief Summary of Several VR Devices)
- ROS Robotics Projects(10)机器人Web工具集
- 虚拟现实现状——设备篇(译:State of VR-Devices)
- 【VR】虚拟现实相关硬件设备