ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Get Robot global pose from a costmap in Python

asked 2016-11-29 11:39:37 -0500

carlsaldanha gravatar image

Is there any way to get the global pose of the robot from Python. I have a costmap and a robot with a LIDAR sensor. I was wondering whether I could publish the global pose over a topic and get it in Python. Is this the correct way to do this?

http://wiki.ros.org/costmap_2d

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-10-23 13:59:36 -0500

dna gravatar image

Here is a way,

  1. install this robot_pose_publisher
  2. rosrun robot_pose_publisher robot_pose_publisher.
  3. write a subscriber for the topic '/robot_pose' with following callback_function. `

    import rospy
    from rospy import logdebug
    from geometry_msgs.msg import Pose
    
    def get_tf_pose_callback(pose):
          logdebug("robot is at : {0}".format(pose.position))
    
    if __name__ == '__main__':
          rospy.Subscriber("robot_pose", Pose, get_tf_pose_callback)
          rospy.spin()
    

` 4. rosrun your node.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2016-11-29 11:39:37 -0500

Seen: 935 times

Last updated: Nov 29 '16