republishing a Gazebo topic to a ROS topic
Hi,
I'm currently working on trying to get a gazebo topic into the ROS topic list so I can access it through the matlab interface with ROS.
Right now I managed to create a subscriber to the gazebo topic in question (gazebo/default/physics/contacts) but I can't figure out exactly what type of ROS message it is to allow me to publish it again in ROS.
Here is the code:
import trollius
from trollius import From
import pygazebo
import pygazebo.msg.contacts_pb2
@trollius.coroutine
def publish_loop():
manager = yield From(pygazebo.connect())
def callback(data):
message = pygazebo.msg.contacts_pb2.Contacts.FromString(data)
print(message)
subscriber = manager.subscribe('/gazebo/default/physics/contacts',
'gazebo.msgs.Contacts',
callback)
yield From(subscriber.wait_for_connection())
while(True):
yield From(trollius.sleep(1.00))
print('wait...')
print(dir(manager))
import logging
logging.basicConfig()
loop = trollius.get_event_loop()
loop.run_until_complete(publish_loop())
So, my problem could be solved in two ways:
- Figuring out a way to find the corresponding essage type in ROS to publish it.
- Figuring out a simpler way to do what i want to do.
Currently I'm working on both possibilities but I'm having a hard time...
Thank you for your help!