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.dev3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c993d9d6a9d6772e3bd3d2c7961dda892b98919bde77305a5930540744e84111 |
|
MD5 | 4f9e21cc577bd08b6967108e5857f278 |
|
BLAKE2b-256 | b1ba88e1db841d05cae463568500ed108afa65ada1ac3b608fc8217c52637c95 |
Hashes for gazebo_yarp_synchronizer-0.9.1.dev3-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e24d85aaf46d62f259b3e7add2280fbd41e5bb68844aaa5f1a37d0535f6fd394 |
|
MD5 | 2303b85d23167178dcbf44b47046c86d |
|
BLAKE2b-256 | 158d69e7c3936a2f7555a2995485652f138bb1481b7ff34b0cabb06834110864 |
Hashes for gazebo_yarp_synchronizer-0.9.1.dev3-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37ce8a60c1131c45fcad97f398950b946ef99744ad91cb8d8cf9e3baa78775ed |
|
MD5 | 02d15b9cf3156e37b8e9135b93335b9b |
|
BLAKE2b-256 | ace99a1169cc5a7ded212f0c928f9904fc35e26532a80326902ec7334dfd8dbd |
Hashes for gazebo_yarp_synchronizer-0.9.1.dev3-cp37-cp37m-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2415cb99068be7b822c637a5ed6e59f603a2df9e96d2f1268a85cb6d9549f85 |
|
MD5 | e6fd3313300fecbdd72078ed1a00c654 |
|
BLAKE2b-256 | b605d9addf96cde83a61ad5c0639dd2d3a3db5a404d9c1793a5c8c607d36d72b |