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.dev31.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 267934648961eecb404bc6e7560224065a3f761347bda8d679ec7470bd091003 |
|
MD5 | 76cb24db1bd8908fd605bd3ba98068bc |
|
BLAKE2b-256 | f2828dc4fe35ee9d67cf209534a30053b691bf9def2fe46b3f02c43c2cac0bd7 |
Hashes for gazebo_yarp_synchronizer-0.1.dev31-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 561d8f13b39db48e43f051a2687022ea88618b6e1529fab6beedb989ce4ca901 |
|
MD5 | 5febe412f87d8f12601ffca27160555f |
|
BLAKE2b-256 | 82f6cbeabe04c167bfb0665f5a2b398d2637811b2a77eb93708152b81106c3c5 |
Hashes for gazebo_yarp_synchronizer-0.1.dev31-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a35ec09c2f2e0142e5d21d98bad3e37e0526e8e4a8877795c7b0d3b49d660efc |
|
MD5 | 1bbbd965e3604fe19acf1acae73242b3 |
|
BLAKE2b-256 | 36df0680494e2d201c300d383f9142c61a6331490cae355d0a9ee872e4493b00 |
Hashes for gazebo_yarp_synchronizer-0.1.dev31-cp37-cp37m-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f741f0184f9e84ff33a9eda64cf2a93c116c56c59f5dfa3781367bc76fcb1ea |
|
MD5 | 7211ca38edb5b8260aae66c2cae28e8e |
|
BLAKE2b-256 | b50cee749b542aac1964a6b0f47c722dd73d3cda20c0b5bb7b04a3a56766c632 |