# Can't visualize Pose in Rviz

I'm trying to implement a path planning algorithm on a static image. I have obtained an occupancy grid and have also published a point via geometry_msgs/PoseStamped, but i cannot visualize this on Rviz .

This is the publisher that Ive written

pub = rospy.Publisher('move_base_simple/goal',PoseStamped,queue_size=1)
rospy.init_node('pose_publisher',anonymous = True)
rate = rospy.Rate(1)
while not rospy.is_shutdown():
p = PoseStamped()
p.pose.position.x = 100
p.pose.position.y = 100
p.pose.position.z = 0
p.pose.orientation.x = 0
p.pose.orientation.x = 0
p.pose.orientation.x = 0
p.pose.orientation.w = 1
pub.publish(p)
rate.sleep()


What am i doing wrong

edit retag close merge delete

Sort by ยป oldest newest most voted

After increasing the scale of the pose arrow i was able to vizualise it

more

1

Seems you've already figured it out, but just the draw some attention to it:

p.pose.position.x = 100
p.pose.position.y = 100


This places the PoseStamped at 100 metres in the X direction and 100 metres in the Y direction.

While of course perfectly valid, it is quite a distance.

( 2019-12-08 02:25:15 -0500 )edit

Thanks for bringing this to my attention, I hadn't noticed that this was in meters

( 2019-12-08 11:21:11 -0500 )edit

As everything in ROS, PoseStamped uses SI units. See also REP-103: Standard Units of Measure and Coordinate Conventions.

( 2019-12-08 11:57:13 -0500 )edit

@gvdhoorn If the frame_id is set to map, shouldn't p.pose.position.x and p.pose.position.y represent the co-ordinates (x,y) in the map frame rather than (x metres, y metres) in the map frame? In case we want to represent a point (x,y) in the map frame, we need to set the p.pose.position.x and p.pose.position.y as x*resolution and y * resolution respectively?

( 2021-08-01 01:59:22 -0500 )edit

No. ROS uses metres for distances. How would a pose publisher know the resolution of your map? Or any other map? Making poses resolution dependent would immediately complicate software reuse, as suddenly everyone would need to take map resolution into account.

( 2021-08-01 02:25:52 -0500 )edit