Gazebo | Ignition | Community
Ask Your Question

Smoke simulation in simulator_gazebo

asked 2013-07-18 22:00:37 -0500

ZeeQ gravatar image

Hi all,

I am making an smoke animation in blender 2.5 using its particle system. Currently i am using ros electric on ubuntu 10.04 and simulator_gazebo stack.

My ist question is whether it is possible to import that animation correctly in simulatorgazebo? if not then migrating to gazeborospkgs with Hydro or Groovy will help me to achieve this objective?
Second, Is there any other good approach to achieve this functionality for example simulating particles inside simulator
gazebo without using any other models(.dae, .stl) etc?
Last, I will prefer some solution sticking to same distro of ros but can migrate too.
Thanks alot.

(P.S detailed answer will be appreciated since my conceptual grasp on the topic is very less and limited)

edit retag flag offensive close merge delete


You only want to visualize the smoke? You could try to animate it , check out this tutorial: `` it currently only works with an older version of gazebo

AndreiHaidu gravatar imageAndreiHaidu ( 2013-07-19 04:38:57 -0500 )edit

You could try to write a Gui-Plugin ( to make it work using an Ogre ParticlePlugin. There is a smoke simulation in the Ogre/Samples

But this would only do a visualisation there would be no collisions with your robots.

I don't think you can easily port ParticleSystems from Blender to Gazebo, but I might be wrong in this point.

evilBiber gravatar imageevilBiber ( 2013-07-19 07:17:29 -0500 )edit

@Andrei No visualization is less important in my case. I want something which reacts to Laser Range sensor and when density is decrease or increase difference could be seen in Laser readings. So visualization is not important even a set of particles just floating will do the trick without any smoke like look. question is how to simulate it? Thanks

ZeeQ gravatar imageZeeQ ( 2013-07-19 09:24:12 -0500 )edit

Currently there is no particle simulation in Gazebo, you could make one by spawning multiple spheres and controlling them via plugins (computing forces between them etc), but that will take a lot of CPU time, and the simulation will get really slow. I am also currently having a project to integrate particles in Gazebo, but the project is not even close to being complete, (here are some videos: ) there is no real interaction yet with the gazebo objects.

AndreiHaidu gravatar imageAndreiHaidu ( 2013-07-19 15:00:38 -0500 )edit

Isn't there any option to add some noise to the scanner? And maybe then you could hack it to give an area where the laser will be noisy

AndreiHaidu gravatar imageAndreiHaidu ( 2013-07-19 15:03:32 -0500 )edit

Thanks alot. That is very impressive work in video. So hopefully my last question what could be the smart way to spawn multiple spheres which are static not moving? no need of simulation and plugins. I can make an assumption that smoke is uniformly distributed at specific place in environment and is not evaporating any more? and i can experiment with increasing or decreasing the density of these spheres and check the laser range behaviour.

ZeeQ gravatar imageZeeQ ( 2013-07-19 17:25:01 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-07-20 03:13:35 -0500

AndreiHaidu gravatar image


You could create a world plugin which spawns the spheres. Here is a similar example of a plugin: (don't forget to set them as static if you don't want them to move, that way it doesn't use as much CPU as well)

#include "gazebo/gazebo.hh"
#include "physics/physics.hh"
#include "common/Plugin.hh"
#include "transport/transport.hh"
#include <math.h>

namespace gazebo
  class FactoryLiquid : public WorldPlugin
        public: virtual ~FactoryLiquid()

    public: void Load(physics::WorldPtr _parent, sdf::ElementPtr _sdf)
        math::Vector3 p3, init_pos;

        /////// SDF PARAMETERS

        ////////////// Get nr of spheres
        if (!_sdf->HasElement("nr_spheres"))
          std::cout << "Missing parameter <nr_spheres> in FactoryLiquid, default to 0" << std::endl;
          nr_spheres = 0;
        else nr_spheres = _sdf->GetElement("nr_spheres")->GetValueUInt();

        ////////////// Set up the initial position parameter
        if (!_sdf->HasElement("init_pos"))
          std::cout << "Missing parameter <init_pos> in FactoryLiquid, default to 0 0 0" << std::endl;
          init_pos.x = 0.0;
          init_pos.y = 0.0;
          init_pos.z = 0.0;
        else init_pos = _sdf->GetElement("init_pos")->GetValueVector3();

        // etc. other parameters from the world file

        /////// END SDF PARAMETERS

        //////////////////////////// START XML LIQUID
        xml << "<?xml version='1.0'?>\n";
        xml << "<sdf version='1.4'>\n";
        xml << "<model name='liquid_spheres'>\n";
        xml << "\t<static>false</static>\n";
        xml << "\t<pose>" << init_pos.x << " " << init_pos.y << " " << init_pos.z << " 0 0 0 </pose>\n";

        for (unsigned int i=0; i<nr_spheres; i++)
                p3 = FactoryLiquid::part_position(i, radius, spawned, level);
                xml << "\t\t<link name='sphere_link_" << i << "'>\n";
                xml << "\t\t\t<self_collide>true</self_collide>\n";
                xml << "\t\t\t<pose>" << p3.x << " " << p3.y << " " << p3.z << " 0 0 0</pose>\n";

                xml << "\t\t\t<inertial>\n";
                xml << "\t\t\t\t<pose> 0 0 0 0 0 0 </pose>\n";
                xml << "\t\t\t\t<inertia>\n";
                xml << "\t\t\t\t\t<ixx>" << inertia << "</ixx>\n";
                xml << "\t\t\t\t\t<ixy>0</ixy>\n";
                xml << "\t\t\t\t\t<ixz>0</ixz>\n";
                xml << "\t\t\t\t\t<iyy>" << inertia << "</iyy>\n";
                xml << "\t\t\t\t\t<iyz>0</iyz>\n";
                xml << "\t\t\t\t\t<izz>" << inertia << "</izz>\n";
                xml << "\t\t\t\t</inertia>\n";
                xml << "\t\t\t\t<mass>" << mass << "</mass>\n";
                xml << "\t\t\t</inertial>\n";

                xml << "\t\t\t<collision name='collision_" << i << "'>\n";
                xml << "\t\t\t\t<geometry>\n";
                xml << "\t\t\t\t\t<sphere>\n";
                xml << "\t\t\t\t\t\t<radius>" << radius << "</radius>\n";
                xml << "\t\t\t\t\t</sphere>\n";
                xml << "\t\t\t\t</geometry>\n";
                xml << "\t\t\t\t<surface>\n";
                xml << "\t\t\t\t\t<friction>\n";
                xml << "\t\t\t\t\t\t<ode>\n";
                xml << "\t\t\t\t\t\t\t<mu>" << mu << "</mu>\n";
                xml << "\t\t\t\t\t\t\t<mu2>" << mu2 << "</mu2>\n";
                xml << "\t\t\t\t\t\t\t<fdir1>0.0 0.0 0.0</fdir1>\n";
                xml << "\t\t\t\t\t\t\t<slip1>" << slip1 << "</slip1>\n";
                xml << "\t\t\t\t\t\t\t ...
edit flag offensive delete link more


Thanks Andrei, I am using Simulatorgazebo in ROS electric under ubuntu 10.04 and i am unable to compile it using the method in this tutorial. Any suggestions please? When i compile the example in the given tutorial it does not recognize gazebo headers files and other classes. Thanks

ZeeQ gravatar imageZeeQ ( 2013-07-26 00:50:02 -0500 )edit

well you are using a pretty old version of gazebo which is deprecated, can't you install a newer version?

AndreiHaidu gravatar imageAndreiHaidu ( 2013-07-26 03:40:29 -0500 )edit

Question Tools


Asked: 2013-07-18 22:00:37 -0500

Seen: 1,478 times

Last updated: Jul 20 '13