Synchronization between Python and Gazebo Classic via YARP.
Project description
gazebo-yarp-synchronizer
Synchronization with Gazebo Classic via YARP. With Python batteries.
This project is the client side of the Clock Plugin included in robotology/gazebo-yarp-plugins
, with some sugar on top.
It provides GazeboYarpSynchronizer
, a new class that extends the automatically generated resources from the thrift service and provides initialization and termination helpers.
The main scope of this repository is providing a PyPI package for Python usage, but nothing prevents importing and using it from plain C++.
Dependencies
gazebo-yarp-synchronizer
expects to find installed and configured the following dependencies:
Installation
pip3 install gazebo-yarp-synchronizer
Usage
In different terminals, execute:
# 1. Start the YARP server
yarpserver
# 2. Open Gazebo paused
gazebo -u -slibgazebo_yarp_clock.so
# 3. Make sure that YARP is running
yarp detect
# 4. Open the Python interpreter
ipython
Then, in the Python interpreter:
# Import the module
>>> from gazebo_yarp_synchronizer import GazeboYarpSynchronizer
# Create the Gazebo synchronizer
>>> gys = GazeboYarpSynchronizer(gazebo_rpc_port_name="/clock/rpc")
# Initialize the Gazebo synchronizer
>>> gys.init()
# [INFO] |yarp.os.Port| Port /tmp/port/1 active at tcp://192.168.8.102:10056/
# [INFO] |yarp.os.impl.PortCoreOutputUnit| Sending output from /tmp/port/1 to /clock/rpc using tcp
# Inspect simulation status
>>> gys.get_step_size(), gys.get_simulation_time()
# (0.001, 0.0)
# Advance the simulation synchronously
>>> gys.step_simulation_and_wait(number_of_steps=250)
# Print time
>>> gys.get_simulation_time()
# 0.25
# Advance the simulation synchronously
>>> gys.run_simulation_and_wait(duration=0.75)
# Print time
>>> gys.get_simulation_time()
# 1.0
# Terminate the synchronizer
>>> gys.fini()
# [INFO] |yarp.os.impl.PortCoreOutputUnit| Removing output from /tmp/port/1 to /clock/rpc
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for gazebo_yarp_synchronizer-0.9.1.dev9.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ecf63ebdcb67ba1504c82f690150f26b40363c95333d40f50f507f5be2d628dc |
|
MD5 | f94f2bd2fe8db6ee25759c3e62017508 |
|
BLAKE2b-256 | f86a119a6ac9e15de0ed1a9a4942f5876389750bcb67de0e5d13c5f43a064aef |
Hashes for gazebo_yarp_synchronizer-0.9.1.dev9-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45324334c81e1076c737619025d93578f6407e0ba7730756e6654df403426f4c |
|
MD5 | 5a42993e2af9e2a962970fec334c379e |
|
BLAKE2b-256 | 9ead5aa2b473995ad4f038afc95997e03c1053500d13a0ab0002672639e4758f |
Hashes for gazebo_yarp_synchronizer-0.9.1.dev9-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17767fc7ee1eb4d675e9f0b1fd620216a0dd46f91ff8c53f41d77e717ad81082 |
|
MD5 | eff77808362930337772699060dbecbf |
|
BLAKE2b-256 | f22eedfc16de877b28dc0ef08777f38a073c981ac466601e1cfcd96cffbd7e7f |
Hashes for gazebo_yarp_synchronizer-0.9.1.dev9-cp37-cp37m-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5d70fa6f272d149143296831e5f9cd5c40c26df0de4597159338011d3836cb7 |
|
MD5 | bea3b43765cacc44adc685c7549f7046 |
|
BLAKE2b-256 | ef849a47730d75e1664f859de93f3e516bc3f3f15039bb339ab0e7fd15882946 |