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.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c93befc1d937cef9e3708d86584b6c31f1c79291f5898fa8deb259d112b86467 |
|
MD5 | c4311466666024fb613e69a8c89fcefa |
|
BLAKE2b-256 | 832b6601c2e2753d90ce1d275dfea5f4583fad762eff05ab0b597776a4865e25 |
Hashes for gazebo_yarp_synchronizer-0.9.0-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2bbdec8dde407e34b600278a1bbb5a4996d053dc3da654f79344473aa3c4f69 |
|
MD5 | f48d2fea301751b1a4e3a6fe80e461e4 |
|
BLAKE2b-256 | 0598dba436394d307514841e99a246e535886bbfc28ec2761b7bdfe4165972ab |
Hashes for gazebo_yarp_synchronizer-0.9.0-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd3ccd379e12588c106f417f5d06cf48afa88f4312d59ebb5d1afaaef3eee382 |
|
MD5 | d41df2cbdad6982c35c21a166d89d919 |
|
BLAKE2b-256 | 15dc25a22dd5ec9e26d094585bb37f99ddbefb0e73ec3f16f335b7222e30a740 |
Hashes for gazebo_yarp_synchronizer-0.9.0-cp37-cp37m-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 512ee573db72ea3d1364b1c20ee38e7928342f9c67869748fa02878443d8d372 |
|
MD5 | fbe7268e453a353b1696ddfd8c6e36f0 |
|
BLAKE2b-256 | 2e1e09ccbee386475c011d622810396a128947ff22e9b339d54d2b9ed0d30939 |