Gazebo | Ignition | Community
Ask Your Question

AbdealiJK's profile - activity

2017-10-25 16:13:37 -0500 received badge  Famous Question (source)
2017-10-25 16:13:37 -0500 received badge  Notable Question (source)
2016-02-08 13:49:35 -0500 received badge  Famous Question (source)
2016-02-08 13:49:34 -0500 received badge  Notable Question (source)
2015-12-30 02:31:07 -0500 received badge  Popular Question (source)
2015-12-21 20:11:58 -0500 asked a question Gazebo takes up 1 core when physics is paused

I'm trying to use gazebo on a fairly old laptop of mine - a core 2 duo with 2 gb ram. I'm using Lubuntu 14.04 (with ROS indigo + gazebo2)

I ran gazebo using gzserver (no GUI) and paused the physics of gazebo and was checking cpu resources on top (a task manager) - No GUI + physics = RAM is less than 500 MB and CPU usage is 100% for both the cores (And cpu temperature rises up to 70s) - No GUI + Paused physics = RAM is less than 500 MB and CPU usage is 100% for 1 core (And cpu temperature for that core rises up to 70s)

Finally, I have 3 questions:

  1. Why is gazebo taking up 100% cpu when physics is paused ? Is this expected ?
  2. How do I throttle the resources gazebo can take ? I don't want the CPU temperature to go higher than ~60s. Is there a method for me tell gazebo to only work 50% of each core at maximum or something ? (Obviously the simulation will be slower, I don't mind that)
  3. Is there any generic way for me to figure out which function in a node is taking up most of the processing power ? How do I profile it ?
2015-12-21 15:23:02 -0500 commented answer 100% CPU use when physics paused and GUI closed

I get this in gazebo 2.2.3 also. Any fix for it ?

2015-09-16 20:10:39 -0500 received badge  Famous Question (source)
2015-09-15 03:58:45 -0500 received badge  Notable Question (source)
2015-09-14 01:08:35 -0500 received badge  Popular Question (source)
2015-09-12 08:02:56 -0500 received badge  Famous Question (source)
2015-09-10 06:18:11 -0500 asked a question Rpeatable results in gazebo

I am trying to get repeatable results in gazebo, along with a ros_control in hector_quadrotor.

It seems as though the controller is giving me different results every time. If I disable the controller, the model falls freely - and the positions after every 10 steps can be reproduced consistently. But when I switch on the controller and set a constant velocity of z as 100 (the controller uses /cmd_vel) - I get different positions every 10 steps.

I dont understand why this would happen

2015-09-03 09:52:28 -0500 received badge  Popular Question (source)
2015-09-02 23:15:50 -0500 received badge  Editor (source)
2015-09-02 23:08:50 -0500 commented answer peek - Finding location of models after specified time

niall, I tried subscribing to /clock, but I had to set my queueDepth to 10000, as with queueDepth=1, it skipped a lot of clock ticks. I found that the rosnode was lagging behind the actual gazebo simulation. I need to set a new velocity every time I query the current state, and as the rosnode and gazebo are running at different speeds, I the action is being set in the future according to gazebo. You mentioned I can make the rosnode "can run as fast as I want" - what did you mean by that ?

2015-09-02 22:40:13 -0500 commented answer peek - Finding location of models after specified time

When I said I was using the ros service, I did it through a C code (where I used the usleep function for the time gap). I'll try the /clock you mentioned and see if that works out. I hope the simulation does not become considerably slower because of the topic to /clock

2015-09-02 02:02:47 -0500 asked a question peek - Finding location of models after specified time

I want to find the estimated position of a model after a time X. So, I basically want gazebo to run the simulation for time X and give back the ModelState after it runs it for time X.

I am currently using the ROS Service /gazebo/get_model_state and /gazebo/pause_physics with /gazebo/unpause_physics to:

unpause -> wait for time X -> pause -> query model state

But this is giving inaccurate results. I guess because the "wait for time X" is bad. I need it to give the same positions repeatably.

How do I do something like what I want ?

EDIT: This is the algorithm I wish to run:

  1. Launch file is run, Node1 and gazebo started. Gazebo is paused initially.
  2. Node1 sets some motor velocities
  3. Gazebo is unpaused. As soon as 1 sec passes in simulation time, gazebo pauses and give back the state of the model
  4. Node1 finds the new motor velocities to set, and it publishes that.
  5. Goto step 3
2015-08-20 04:51:48 -0500 received badge  Notable Question (source)
2015-06-29 09:22:13 -0500 received badge  Popular Question (source)
2015-06-26 22:18:16 -0500 asked a question Gazebo plugin: unable to use world ptr in service

I am trying to make a plugin which creates a service that can run Gazebo for a specific number of physics loops.

So, I made this:

#include <rl_gazebo/run_physics.h>

#include <std_msgs/String.h>

namespace gazebo {

GazeboRunPhysicsPlugin::GazeboRunPhysicsPlugin() { }

GazeboRunPhysicsPlugin::~GazeboRunPhysicsPlugin() {
  delete node_handle_;

void GazeboRunPhysicsPlugin::Load(physics::WorldPtr _world, sdf::ElementPtr _sdf) {
  // Make sure the ROS node for Gazebo has already been initialized
  if (!ros::isInitialized()) {
    ROS_FATAL_STREAM("A ROS node for Gazebo has not been initialized, unable to load plugin. "
      << "Load the Gazebo system plugin '' in the gazebo_ros package)");

  world_ = _world;
  node_handle_ = new ros::NodeHandle;
  service_ = node_handle_->advertiseService("run_physics_loops", &GazeboRunPhysicsPlugin::RunPhysicsLoops, this);

bool RunPhysicsLoops(rl_msgs::RunPhysicsLoops::Request &req,
                     rl_msgs::RunPhysicsLoops::Response &res) {
  int nloops = req.num_loops;
  world_->RunBlocking(nloops); // ERROR Here
  return true;

// Register this plugin with the simulator

} // namespace gazebo

I get a compilation error at the point world_->RunBlocking(nloops); which says:

.../src/ In function ‘bool gazebo::RunPhysicsLoops(rl_msgs::RunPhysicsLoops::Request&, rl_msgs::RunPhysicsLoops::Response&)’:
.../src/ error: ‘world_’ was not declared in this scope

What i am trying to do ...

I have a ros node which has it's own main loop - and in each oop of that I want to run gazebo's physics loop 10 (for example) times. I was using the ros services/topics to communicate with gazebo because I am using hector_quadrotor - which requires gazebo to be run using gazebo_ros.

Hence, I cannot make a gazebo server inside my rosnode - and need it to be run separately. So, I need a ros-service which should be able to call the line world->runBlocking(10). After a little digging I found a plugin can do this and now am trying to make one.

2015-06-20 03:52:57 -0500 asked a question Pausing and unpausing gazebo for specific times

I need to be able to control gazebo using my ros node.

What i exactly want :

  1. My node tells gazebo to use a particular velocity for my bot.
  2. My node tells gazebo to give the result of the bot after 1 second and pause after that.
  3. My node gets the result from gazebo and chooses the next velocity

So, basically I want to descritize my time - and I do not want gazebo to run until I give it the next action.

I know of gazebo's services to pause and unpause physics - but I am unable to tell it to do it for a specific time.

I am using roscpp.