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.dev28.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0326b4d70b8611e76305546866a1188496639a067aa59d02a7973283f5bd1c0 |
|
MD5 | 480b21ba5f82974862914993ad473157 |
|
BLAKE2b-256 | 3bb594a7c179ff23a554312bd96e4ae11691a45ed7ba0c4c833d0c1fa8346d50 |
Hashes for gazebo_yarp_synchronizer-0.1.dev28-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a64dad7acfd13f30188ad44e63276571f343d691717dc338761868c92fd553f2 |
|
MD5 | 796edb6fface8e1d00b5b2190b7de574 |
|
BLAKE2b-256 | 2176c39af3c985d092f84afc32f98251526c4ebd6c0a4cb0ba35239993fa41a1 |
Hashes for gazebo_yarp_synchronizer-0.1.dev28-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 016db4b53359cfc69cf1ee2adb47b488f6e698593eafc5541aaeee41806ad0a9 |
|
MD5 | 037b0b6f436f0638d0e81bca0e82cd79 |
|
BLAKE2b-256 | 499ab8d3d772b1256588d22f3122de8e8d5593c1c7b58c814709ed8d81c242fe |
Hashes for gazebo_yarp_synchronizer-0.1.dev28-cp37-cp37m-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | afe4971b9d6e702a3ea3c4db6cffded0725dedd4ed353700c1712e97492a1243 |
|
MD5 | 124d2b8f9507f98c713ae59a10ba3fe3 |
|
BLAKE2b-256 | f3883eb1c338c6db99cd68cbc1283cd0f31547aa261dc478db5f7a5f7ccccb3a |