Ask Your Question

Can't visualize Pose in Rviz

asked 2019-12-07 23:59:39 -0500

TenderTadpole7 gravatar image

updated 2022-03-05 18:26:11 -0500

lucasw gravatar image

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.header.seq = 1
    p.header.stamp =
    p.header.frame_id = 'map'
    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

What am i doing wrong

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-12-08 00:03:48 -0500

TenderTadpole7 gravatar image

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

edit flag offensive delete link more



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.

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

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

TenderTadpole7 gravatar image TenderTadpole7  ( 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.

gvdhoorn gravatar image gvdhoorn  ( 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?

skpro19 gravatar image skpro19  ( 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.

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-12-07 23:56:07 -0500

Seen: 350 times

Last updated: Mar 05