gazebo

转载地址:http://gazebosim.org/tutorials

http://blog.csdn.net/zhangrelay/article/details/53318991

http://www.linuxidc.com/Linux/2017-03/141505.htm


Indigo 自带的gazebo是2.0版本,与官网的教程中用的示例版本7.0,不一致,得先卸载2.0,然后安装gazebo7。卸载安装的步骤百度即可。

大概是参考http://blog.csdn.net/zhangrelay/article/details/53318991,

http://www.linuxidc.com/Linux/2017-03/141505.htm,来卸载旧的gazebo2,安装新的gazebo7

先刷基本的教程,对gazebo界面的基本操作和SDF文件有个大致认识

gazebo_第1张图片 gazebo_第2张图片

重点是Control plugin  ,Connect to ROS

然后是针对 Categorized中的一些重点分类再仔细看了,后面用到哪些再回头看。

Write a plugin

A plugin is a chunk of code that is compiled as a shared library and inserted into the simulation. The plugin has direct access to all the functionality of Gazebo through the standard C++ classes.

Plugin Types

There are currently 6 types of plugins

  1. World
  2. Model
  3. Sensor
  4. System
  5. Visual
  6. GUI
The  gazebo/gazebo.hh  file includes a core set of basic gazebo functions. It doesn't include  gazebo/physics/physics.hh gazebo/rendering/rendering.hh , or  gazebo/sensors/sensors.hh  as those should be included on a case by case basis. All plugins must be in the  gazebo  namespace.

Each plugin must inherit from a plugin type. 在前面的例子中: class VelodynePlugin : public ModelPlugin,当前的例子中:

class WorldPluginTutorial : public WorldPlugin

虚函数的重载

 public: void Load(physics::WorldPtr _world, sdf::ElementPtr _sdf)
            {
            }

插件的声明:

GZ_REGISTER_WORLD_PLUGIN,GZ_REGISTER_MODEL_PLUGINGZ_REGISTER_SENSOR_PLUGINGZ_REGISTER_GUI_PLUGINGZ_REGISTER_SYSTEM_PLUGINand GZ_REGISTER_VISUAL_PLUGIN.

编写CMakeLists


从网上下载  Learning_ROS_for_Robotics_Programming_2nd_edition   indigo code,编译。编译过程中遇到了许多问题:比如,

<1>编译时提示没有:opencv_nonfree
sudo add-apt-repository --yes ppa:xqms/opencv-nonfree  
sudo apt-get update  
sudo apt-get install libopencv-nonfree-dev 


<2> set( CMAKE_CXX_FLAGS "-std=c++11" ) 使能C++11


<3>cv::ocl::integral(cv::ocl::oclMat const&, cv::ocl::oclMat&)’未定义的引用
  find_package(OpenCV REQUIRED core ocl)
  include_directories(SYSTEM ${OpenCV_INCLUDE_DIRS})
  target_link_libraries( ${OpenCV_LIBRARIES} opencv_nonfree) 

慢慢一个一个百度解决,编译成功后,按照http://blog.csdn.net/zhangrelay/article/details/53318991 在gazebo7 中模拟跑机器人

刚开始启动 roslaunch robot1_gazebo gazebo_wg.launch后,gazebo莫名的崩溃退出,终端提示的是gazebo-2进程退出, gazebo-2已经卸载了,难道是没卸载成功??  第二天又运行相同的命令后,竟然又好了,启动的是gazebo-7




你可能感兴趣的:(工具)