ros Gazebo上搭建wheel imu camera的仿真平台

Gazebo上搭建wheel imu camera的仿真平台

ubuntu 16.04平台上,安装的gazebo的版本为gazebo 7,其他版本的ubuntu需要确认,至少ubuntu12.04以后,gazebo 7都是可以使用的。gazebo 7ros不是必须一起使用的,但是在ros下使用gazebo确实会方便不少。

ROS Kinetic安装

安装ROS Kinect的命令如下:

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:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

sudo apt-get update

sudo apt-get install ros-kinetic-desktop-full

sudo rosdep init 

rosdep update

echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc

source ~/.bashrc

sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential

#安装catkin build工具
sudo apt-get install python-catkin-tools

Gazebo 7安装

安装gazebo 7的命令如下所示:

sudo sh -c 'echo "deb  http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'

wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -

sudo apt-get update

sudo apt-get install gazebo7

安装完以后,在终端里面输入gazebo应该就会弹出来gazebo的使用界面。

GazeboROS的交互环境配置

安装rosgazebo的包,有两种安装的方式,一种是直接安装deb包,另外一种方式是从源码编译。

cd ~/catkin_ws/src

git clone https://github.com/ros-simulation/gazebo_ros_pkgs.git -b kinetic-devel

#rosdep用来安装包的依赖项
rosdep update
#检查当前目录下的包的依赖项
rosdep check --from-paths . --ignore-src --rosdistro kinetic
#安装当前目录下的包的依赖项
rosdep install --from-paths . --ignore-src --rosdistro kinetic -y
#编译(-j后面的参数根据自己的电脑来选择,如果性能差,可以用-j1)
catkin build -j2

安装了ros gazebo以后,还需要配置gazebo的模型。方便起见,可以事先下载这些模型,下载的脚本如下:

#!/bin/sh

# Download all model archive files
wget -l 2 -nc -r "http://models.gazebosim.org/" --accept gz

# This is the folder into which wget downloads the model archives
cd "models.gazebosim.org"

# Extract all model archives
for i in *
do
  tar -zvxf "$i/model.tar.gz"
done

# Copy extracted files to the local model folder
cp -vfR * "$HOME/.gazebo/models/"

然后把下载的models解压,把~/models里面的所有内容复制到~/.gazebo/models目录下。
现在ros gazebo已经安装好了,可以测试下该程序是否可以运行,命令如下:

roslaunch gazebo_ros empty_world.launch

创建robot wheel imu camera的模型

这里,我们从gazebo上已经有的robot模型开始造轮子,这里使用turtlebot来进行仿真,turtlebot的代码在这里turtlebot的仿真模型中已经有了IMU,轮速和rgbd相机,对应的topic分别为/camera/rgb/image_raw,odom/mobile_base/sensors/imu_data。命令为

cd ~/catkin_ws/src
git clone https://github.com/turtlebot/turtlebot_simulator
rosdep check --from-paths . --ignore-src --rosdistro kinetic
rosdep install --from-paths . --ignore-src --rosdistro kinetic -y
cd ..
catkin build

运行仿真程序

roslaunch turtlebot_gazebo turtlebot_world.launch

场景如下图所示:
这里写图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值