Is there any rosservice or topic to just '1' step the simulation? (simulation syncronizing to other node)

asked 2019-04-18 03:23:02 -0500

JEon gravatar image

I'm currently trying to implementing a project with python and cpp.

python node send(publish) action(Force, torque, etc..) to cpp node with modelplugin.

and I'm currently stuck in timestep align...

what I want to implement is gazebo simulation's update (connected with "ConnectWorldUpdateBegin" event) function is working only at when subscribe action from python node.

I found several funcions like pause_physics using rosservice but I failed with it.

and adding a while loop in update function has also failed. (like below)

    // get action by subscribe
public: void OnRosMsg(const std_msgs::Float32ConstPtr &_msg)

public: void update()//connected to ConnectWorldUpdateBegin so when world steps, it runs one time.
            //do something

so what I'm thinking is, if there is a rosservice kind of function that when just do '1 step' the simulation, I maybe implement like below:

  1. pausing the simulation
  2. python node send action to gazebo node(cpp)
  3. python node send '1 step' command to gazebo node(cpp)
  4. gazebo node read action and to simulation 1 step.
  5. simulation 1 and view result
  6. back to 2.

I'll be waiting your any kinds of answers.

edit retag flag offensive close merge delete