pygazebo with pioneer3at issue

asked 2017-10-07 01:19:21 -0500

Cameron gravatar image

I am attempting to move a pioneer3at robot inside of gazebo using pygazebo. I have a world with a pioneer3at robot added and nothing else. I am attempting to drive the robot using the following python code,

import trollius
from trollius import From

import pygazebo
import pygazebo.msg.pose_pb2

@trollius.coroutine
def publish_loop():
    manager = yield From(pygazebo.connect())

    publisher = yield From(
        manager.advertise('/gazebo/default/pioneer3at/vel_cmd',
                          'gazebo.msgs.Pose'))

    message = pygazebo.msg.pose_pb2.Pose()
    message.position.x = 1
    message.position.y = 0
    message.position.z = 0

    while True:
        yield From(publisher.publish(message))
        yield From(trollius.sleep(1.0))

loop = trollius.get_event_loop()
loop.run_until_complete(publish_loop())

This code runs without errors, but seems to do nothing. I also tried viewing the output of this code using the command,

gz topic --verbose -u -e /gazebo/default/pioneer3at/vel_cmd

This produces the output,

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.1.124

and nothing more. To further investigate I used the command,

sudo tcpdump -i any port 11345

to view the data flowing through the port, but I only got data when the previous two commands were stopped or started, but not once a second as I expected from the python code.

Any tips on how to get this working would be greatly appreciated.

edit retag flag offensive close merge delete