1 拷貝程序文件
cp -r ***/chapter7_tutorials/ ~/joey_ws/src
2 編輯URDF模型
vim ~/joey_ws/src/chapter7_tutorials/robot1_description/urdf/robot1.urdf
3 啟動(dòng)RViz仿真平臺(tái)
roslaunch robot1_description display.launch model:="
rospack find robot1_description
/urdf/robot1.urdf"
4 手動(dòng)調(diào)試RViz平臺(tái)模型運(yùn)動(dòng)
roslaunch robot1_description display.launch model:="
rospack find robot1_description
/urdf/robot1.urdf" gui:=true
5 代碼控制RViz平臺(tái)模型運(yùn)動(dòng)
vim ~/joey_ws/src/chapter7_tutorials/robot1_description/src/state_publisher.cpp
編譯過(guò)程中出現(xiàn)如下錯(cuò)誤
- fake錯(cuò)誤
sudo apt-get install ros-indigo-fake-localization
- map server錯(cuò)誤
- SDL錯(cuò)誤 SDL/SDL_image.h: No such file or directory
rosdep install --from-paths src --ignore-src --rosdistro=indigo -y
運(yùn)行程序
roslaunch robot1_description state_xacro.launch model:="
rospack find robot1_description
/urdf/robot1.xacro"
6 使用外部建模工具 SketchUp
windouws中安裝SketchUp(Sketch Up只能在win與mac中運(yùn)行)
下載比較慢,下回再試
7 Gazebo 仿真
7.1 運(yùn)行g(shù)azebo
gazebo
7.2 下載gazebo環(huán)境
sudo apt-get install ros-indigo-gazebo-ros-pkgs ros-indigo-gazebo-roscontrol
7.3 運(yùn)行 ros-gazebo
roscore & rosrun gazebo_ros gazebo
打開(kāi)模型
roslaunch robot1_gazebo gazebo.launch model:="`rospack find robot1_ description`/urdf/robot1_base_01.xacro"
出現(xiàn)錯(cuò)誤 IOError:
[Errno 2] No such file or directory: '/urdf/robot1_base_01.xacro'
問(wèn)題是無(wú)法找到所述文件裳扯,解決方法為將rospack find robot1_ description
更換為實(shí)際地址
roslaunch robot1_gazebo gazebo.launch model:="/home/exbot/joey_ws/src/chapter7_tutorials/robot1_description/urdf/robot1_base_01.xacro"