首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ROS_安装一个第三方仿真软件包——机器人模拟世界

ROS_安装一个第三方仿真软件包——机器人模拟世界

作者头像
凌川江雪
发布2018-10-09 12:34:37
2.1K0
发布2018-10-09 12:34:37
举报
文章被收录于专栏:李蔚蓬的专栏李蔚蓬的专栏

本文记录安装一个第三方仿真软件包的实战,从下载到成功运行! 环境:ubuntu16.04 & ROS-Ubuntu2

下载源码包

在Ubuntu系统上,确保git已经安装
sudo apt-get install git

然后再创建一个名为tutorial_ws的工作空间,在它的src路径下克隆ROS-Academy-for-Beginners软件包
cd
mkdir -p tutorial_ws/src           创建catkin工作空间
cd tutorial_ws/src                 进入src路径,克隆教学软件包
git clone https://github.com/DroidAITech/ROS-Academy-for-Beginners.git

安装依赖

安装依赖:

cd ~/tutorial_ws
rosdep install --from-paths src --ignore-src --rosdistro=kinetic -y

过程图:

注意:以上命令非常重要,缺少依赖将导致软件包无法正常编译和运行。 在开始编译之前,需要确保Gazebo在7.0版本以上

gazebo -V

编译

接着回到catkin_ws下编译:

cd ~/tutorial_ws
catkin_make

过程图:

下面是刷新环境的两种方法:

source ~/tutorial_ws/devel/setup.bash
rospack profile

过程图:

运行仿真程序

首先需要解决一个问题,不然待会儿运行时会闪退:

roslaunch robot_sim_demo robot_spawn.launch

下面是运行过程图(是的,一开始可能会遇到一个报错[robot_spawn.launch] is neither a launch file in package [robot_sim_demo] nor is [robot_sim_demo] a launch file name The traceback for the exception was written to the log file,然而下面的过程图已经是从报错到解决报错成功运行的过程了):

liweipeng@liweipeng-virtual-machine:~$ rospack profile
Full tree crawl took 0.189714 seconds.
Directories marked with (*) contain no manifest.  You may
want to delete these directories.
To get just of list of directories without manifests,
re-run the profile with --zombie-only
-------------------------------------------------------------
0.141810   /opt/ros/kinetic/share
0.000770 * /opt/ros/kinetic/share/OpenCV-3.3.1-dev
0.000257 * /opt/ros/kinetic/share/doc
0.000043 * /opt/ros/kinetic/share/OpenCV-3.3.1-dev/haarcascades
0.000019 * /opt/ros/kinetic/share/OpenCV-3.3.1-dev/lbpcascades
0.000008 * /opt/ros/kinetic/share/doc/liborocos-kdl
liweipeng@liweipeng-virtual-machine:~$ roslaunch robot_sim_demo robot_spawn.launch 
[robot_spawn.launch] is neither a launch file in package [robot_sim_demo] nor is [robot_sim_demo] a launch file name
The traceback for the exception was written to the log file
liweipeng@liweipeng-virtual-machine:~$ roslaunch robot_sim_demo robot_spawn.launch 
[robot_spawn.launch] is neither a launch file in package [robot_sim_demo] nor is [robot_sim_demo] a launch file name
The traceback for the exception was written to the log file
liweipeng@liweipeng-virtual-machine:~$ cd ~/tutorial_ws
liweipeng@liweipeng-virtual-machine:~/tutorial_ws$ roslaunch robot_sim_demo robot_spawn.launch 
[robot_spawn.launch] is neither a launch file in package [robot_sim_demo] nor is [robot_sim_demo] a launch file name
The traceback for the exception was written to the log file
liweipeng@liweipeng-virtual-machine:~/tutorial_ws$ source ~/tutorial_ws/devel/setup.bash
liweipeng@liweipeng-virtual-machine:~/tutorial_ws$ rospack profile
Full tree crawl took 0.025369 seconds.
Directories marked with (*) contain no manifest.  You may
want to delete these directories.
To get just of list of directories without manifests,
re-run the profile with --zombie-only
-------------------------------------------------------------
0.016329   /opt/ros/kinetic/share
0.008478   /home/liweipeng/tutorial_ws/src
0.008405   /home/liweipeng/tutorial_ws/src/ROS-Academy-for-Beginners
0.000169 * /opt/ros/kinetic/share/OpenCV-3.3.1-dev
0.000036 * /opt/ros/kinetic/share/doc
0.000035 * /opt/ros/kinetic/share/OpenCV-3.3.1-dev/haarcascades
0.000015 * /opt/ros/kinetic/share/OpenCV-3.3.1-dev/lbpcascades
0.000006 * /opt/ros/kinetic/share/doc/liborocos-kdl
liweipeng@liweipeng-virtual-machine:~/tutorial_ws$ roslaunch robot_sim_demo robot_spawn.launch 
... logging to /home/liweipeng/.ros/log/3bcd5ac4-be9d-11e8-a270-000c29f43d2c/roslaunch-liweipeng-virtual-machine-2603.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

xacro: Traditional processing is deprecated. Switch to --inorder processing!
To check for compatibility of your document, use option --check-order.
For more infos, see http://wiki.ros.org/xacro#Processing_Order
xacro.py is deprecated; please use xacro instead
started roslaunch server http://liweipeng-virtual-machine:41819/

SUMMARY
========

PARAMETERS

再打开一个终端,输入以下命令,用键盘控制机器人移动,聚焦控制程序窗口,按下i、j、l等按键,控制机器人移动:

rosrun robot_sim_demo robot_keyboard_teleop.py

过程图如下,记得运行前要刷新环境,或者用上面的方法把刷新命令添加到脚本:

呐,对比上图,我把它移到了简介牌的右边:

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018.09.23 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 下载源码包
  • 安装依赖
  • 编译
  • 运行仿真程序
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档