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.1.dev30.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e28e39ee820753f656c00a150e351c993d58790f8958dcf7db540f3303e4e2e6 |
|
MD5 | d6956dbd02f757f0d35a5465458d67df |
|
BLAKE2b-256 | deb83eed528027ba98d48ddae5ea2b89688ae55500ccd499fb9a62a398c6e275 |
Hashes for gazebo_yarp_synchronizer-0.1.dev30-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d531db7993d903b89fc9d5b2d309ef72a80668a1ef26070094645d436df24f20 |
|
MD5 | b1b0b2b002612c8b0a60c6088e4bc064 |
|
BLAKE2b-256 | e11dcc0f5c2806344cfe730e7d68a810de579bd7200c825dca951463aac447d6 |
Hashes for gazebo_yarp_synchronizer-0.1.dev30-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 406024b973738a4890ca6e886de0007137c13d4a2be310712bea1a6ea8503dba |
|
MD5 | c5af624165fa47e09f51b72b1c78d1a8 |
|
BLAKE2b-256 | 59ad3fa19d0061935cedd027f6ab8e816aec22675d860bb1e45c7cf2f3ab799f |
Hashes for gazebo_yarp_synchronizer-0.1.dev30-cp37-cp37m-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af11f82afdedfa39617498c6b619120f00f26c594dd9863ae1f64f2526633835 |
|
MD5 | 43b33a32001cf7aab20c7bca97646c67 |
|
BLAKE2b-256 | 5281c852b843518ea8e417c1625e037172d6a747f0b1b6fd6cfe7c2127e87d9d |