gazebo-yarp-plugins
Gazebo Plugins exposing YARP interfaces.
Loading...
Searching...
No Matches
gazebo::GazeboYarpClock Class Reference

Plugin exposing the Gazebo Clock on the YARP network, allowing to synchronize the simulation with an external controller. More...

#include <Clock.hh>

Inheritance diagram for gazebo::GazeboYarpClock:
Collaboration diagram for gazebo::GazeboYarpClock:

Public Member Functions

 GazeboYarpClock ()
 
virtual ~GazeboYarpClock ()
 
virtual void Load (int _argc=0, char **_argv=NULL)
 
void gazeboYarpClockLoad (std::string world_name)
 
void clockUpdate ()
 
void clockPause ()
 pause the simulation
 
void clockContinue ()
 resume the simulation
 
void clockStep (unsigned steps=1)
 Step the simulation for the input number of steps.
 
common::Time getSimulationTime ()
 Returns the simulation time.
 
void resetSimulationTime ()
 Reset the simulation time back to zero.
 
void resetSimulationState ()
 Reset the simulation state back to initial state.
 
void resetSimulation ()
 Reset the simulation time and state back to zero.
 
virtual double getStepSize ()
 Get the current step size in seconds.
 

Detailed Description

Plugin exposing the Gazebo Clock on the YARP network, allowing to synchronize the simulation with an external controller.

The plugin itself exposes two features:

  • It publishes the simulation time on a Yarp port /clock
  • It opens a Yarp RPC Port (/clock/rpc) to allows control of the simulation time.

How to launch it

The plugin should be launched as a system plugin:

gazebo -slibgazebo_yarp_clock.so

Plugin details

The RPC communication API is written in thrift and a stub is automatically generated and can be used for remote procedure calls. The APIs allow to stop, resume and step the simulation.

Synchronize with the simulation

The features exposed by this plugin should be enough to cover most of the synchronization issues.

If you need to implement synchronization in your module, you should use the RPC calls to properly step the simulation.

Already-implemented synchronization methods

At the current state, you can use the synchronization out-of-the-box in these two cases:

1) Yarp module

Yarp already supports the use of an external clock. In this case, the only thing that is needed is to set the environmental variable YARP_CLOCK to be equal to the clock port, e.g., YARP_CLOCK=/clock. We strongly advice you to NOT put the variable in your .bashrc but to do it explicitly for each module.

2) Simulink with WB-Toolbox

If you are using the WB-Toolbox a block called Simulator Synchronizer already implements the correct RPC calls. You only have to put the block in your Simulink model.

Constructor & Destructor Documentation

◆ GazeboYarpClock()

gazebo::GazeboYarpClock::GazeboYarpClock ( )

◆ ~GazeboYarpClock()

gazebo::GazeboYarpClock::~GazeboYarpClock ( )
virtual

Member Function Documentation

◆ Load()

void gazebo::GazeboYarpClock::Load ( int _argc = 0,
char ** _argv = NULL )
virtual

◆ gazeboYarpClockLoad()

void gazebo::GazeboYarpClock::gazeboYarpClockLoad ( std::string world_name)

◆ clockUpdate()

void gazebo::GazeboYarpClock::clockUpdate ( )

◆ clockPause()

void gazebo::GazeboYarpClock::clockPause ( )

pause the simulation

◆ clockContinue()

void gazebo::GazeboYarpClock::clockContinue ( )

resume the simulation

◆ clockStep()

void gazebo::GazeboYarpClock::clockStep ( unsigned steps = 1)

Step the simulation for the input number of steps.

Defaults to 1

Parameters
[in]stepsnumber of steps

◆ getSimulationTime()

common::Time gazebo::GazeboYarpClock::getSimulationTime ( )

Returns the simulation time.

Returns
the simulation time

◆ resetSimulationTime()

void gazebo::GazeboYarpClock::resetSimulationTime ( )

Reset the simulation time back to zero.

◆ resetSimulationState()

void gazebo::GazeboYarpClock::resetSimulationState ( )

Reset the simulation state back to initial state.

◆ resetSimulation()

void gazebo::GazeboYarpClock::resetSimulation ( )

Reset the simulation time and state back to zero.

◆ getStepSize()

double gazebo::GazeboYarpClock::getStepSize ( )
virtual

Get the current step size in seconds.

Returns
the step size in seconds

The documentation for this class was generated from the following files: