1 拷贝程序文件
cp -r ***/chapter7_tutorials/ ~/joey_ws/src
2 编辑URDF模型
vim ~/joey_ws/src/chapter7_tutorials/robot1_description/urdf/robot1.urdf
3 启动RViz仿真平台
roslaunch robot1_description display.launch model:="
rospack find robot1_description
/urdf/robot1.urdf"
4 手动调试RViz平台模型运动
roslaunch robot1_description display.launch model:="
rospack find robot1_description
/urdf/robot1.urdf" gui:=true
5 代码控制RViz平台模型运动
vim ~/joey_ws/src/chapter7_tutorials/robot1_description/src/state_publisher.cpp
编译过程中出现如下错误
- fake错误
sudo apt-get install ros-indigo-fake-localization
- map server错误
- SDL错误 SDL/SDL_image.h: No such file or directory
rosdep install --from-paths src --ignore-src --rosdistro=indigo -y
运行程序
roslaunch robot1_description state_xacro.launch model:="
rospack find robot1_description
/urdf/robot1.xacro"
6 使用外部建模工具 SketchUp
windouws中安装SketchUp(Sketch Up只能在win与mac中运行)
下载比较慢,下回再试
7 Gazebo 仿真
7.1 运行gazebo
gazebo
7.2 下载gazebo环境
sudo apt-get install ros-indigo-gazebo-ros-pkgs ros-indigo-gazebo-roscontrol
7.3 运行 ros-gazebo
roscore & rosrun gazebo_ros gazebo
打开模型
roslaunch robot1_gazebo gazebo.launch model:="`rospack find robot1_ description`/urdf/robot1_base_01.xacro"
出现错误 IOError:
[Errno 2] No such file or directory: '/urdf/robot1_base_01.xacro'
问题是无法找到所述文件,解决方法为将rospack find robot1_ description
更换为实际地址
roslaunch robot1_gazebo gazebo.launch model:="/home/exbot/joey_ws/src/chapter7_tutorials/robot1_description/urdf/robot1_base_01.xacro"