Robotics StackExchange | Archived questions

Get Robot global pose from a costmap in Python

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

Asked by carlsaldanha on 2016-11-29 12:39:37 UTC

Comments

Answers

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.

Asked by dna on 2017-10-23 13:59:36 UTC

Comments