softbankrobotics-research / qibullet

Bullet simulation for SoftBank Robotics robots
Apache License 2.0
141 stars 38 forks source link

_broadcastOdometry parameters problem #77

Closed ysys98 closed 2 years ago

ysys98 commented 2 years ago

76

Still this problem, I found that it should be the problem of parameter of _ broadcastodometry (self, odometry_publisher), so I passed odom_pub into parameter to Is wrong?

3

And I changed odometry_ publisher file changed from .CPP to .Py file

1 2

And then when I run It shows the error log:

4

"odom_pub" is not defined

mbusy commented 2 years ago

I don't really understand what you're trying to do here, but as specified in the comments of the method, _broadcastOdometry is an internal method and shouldn't be used in a script. The method is defined in the RosWrapper class, and the ROS wrapper for each robot (PepperRosWrapper etc) inherit from that class. You don't need to call the _broadcastOdometry method manually, it's done automatically when you launch the wrapper.

Here's a quick example:

if __name__ == "__main__":
    simulation_manager = SimulationManager()
    wrap = PepperRosWrapper()
    camera_id = PepperVirtual.ID_CAMERA_BOTTOM
    pepper = simulation_manager.spawnPepper(client, spawn_ground_plane=True)

    wrap.launchWrapper(pepper, "/naoqi_driver")

    handle = pepper.subscribeCamera(camera_id)

    try:
        rospy.spin()

    except KeyboardInterrupt:
        pass
    except rospy.ROSInterruptException:
        pass
    finally:
        wrap.stopWrapper()
        simulation_manager.stopSimulation(client)

The launchWrapper is all you need, the odometry will be broadcasted

mbusy commented 2 years ago

I'm going to move this issue into the discussions and widen the scope of the issue a bit, since I think the issue has more to do with the joint usage of ROS with qiBullet. If a specific issue with the simulation arises, we'll create a more specific issue