robotology / gz-sim-yarp-plugins

YARP plugins for Modern Gazebo (gz-sim).
BSD 3-Clause "New" or "Revised" License
9 stars 2 forks source link

Port basic clock plugin functionality from gazebo-yarp-plugins #60

Closed xela-95 closed 10 months ago

xela-95 commented 10 months ago

Clock plugin docs is https://github.com/robotology/gazebo-yarp-plugins/blob/master/plugins/clock/include/gazebo/Clock.hh#L35 .

The clock functionality are two:

This issue focus on the first functionality, i.e. publication of simulation time on yarp port /clock.

xela-95 commented 10 months ago

Useful resource: https://github.com/robotology/gz-sim-yarp-plugins/issues/4 .

xela-95 commented 10 months ago

I'm gathering documentation related to this feature to understand how to perform the porting:

xela-95 commented 10 months ago

I've seen that the clock plugin makes use of the thrift definition for the Clock service: https://github.com/robotology/gazebo-yarp-plugins/blob/cb3521f7543a5a07e2a65a82dedd2eb2ec2cea12/thrift/clock/clock_rpc.thrift

This file gets compiled and produces a ClockServer class, that in turn is inherited by ClockServerImpl class. This class is used as a data member of class GazeboYarpClock that implements the gazebo::SystemPlugin base class.

I have to understand how this logic maps to the new Gazebo sim paradigm and whether it is needed to use the thrift definitions for the clock service.

xela-95 commented 10 months ago

CC @traversaro

traversaro commented 10 months ago

I have to understand how this logic maps to the new Gazebo sim paradigm and whether it is needed to use the thrift definitions for the clock service.

If you want to implement the /clock/rpc part of the plugin, yes. However, as a first iteration you can also just concentrate on publishing the /clock port.

xela-95 commented 10 months ago

I leave here some refs to useful classes and tutorials for controlling the simulation that @diegoferigo showed me:

I think this will be useful in future to control the clock rpc part.

xela-95 commented 10 months ago

@traversaro, up to now the clock plugin sends on the /clock port the current simulation time at each simulation step, do you think it's useful to add a check to avoid writing a message if the current timestamp is the same of the previous sent?

This could be useful to avoid sending thousands of messages of the same timestamp when gazebo server is launched or when in general the simulation is paused, but maybe there are cases that I don't have in mind for which it is better to always send the timestamp.

traversaro commented 10 months ago

@traversaro, up to now the clock plugin sends on the /clock port the current simulation time at each simulation step, do you think it's useful to add a check to avoid writing a message if the current timestamp is the same of the previous sent?

Yes, I think it make sense.