Topic Nav2 Goal from Rviz2

Hi everyone
I would like to know which topic can be used to get the values for the nav2 goals that are sent through rviz2. I thought that I could use the /goal_pose but it doesnt receveived a value when using this tool.
Thanks in advance

Hi @lfernandez ,

My immediate suggestion would be to set a subscriber to /goal_pose topic.
So when you click on some place on Rviz2 and send a goal pose to /goal_pose, you can see the Pose (position + orientation) value in the subscriber.

At the moment, I assume that /goal_pose is a topic and not a service or an action.

Regards,
Girish

Thanks @girishkumar.kannan. That’s what I thought but the topic /goal_pose gets nothing when you send a Nav2 goal through Rviz2. It’s strange to me.

Hi @lfernandez ,

Here is my output from /goal_pose:

user:~$ ros2 topic echo /goal_pose
header:
  stamp:
    sec: 1678726728
    nanosec: 281811410
  frame_id: map
pose:
  position:
    x: -0.6831712126731873
    y: 0.5041952133178711
    z: 0.0
  orientation:
    x: 0.0
    y: 0.0
    z: 0.050374112943495156
    w: 0.998730418453927
---

So here is what I did:

  1. Make sure that the real robot or the simulation is running.
  2. Make sure you have ros_bridge enabled, if it is needed.
  3. Make sure ROS2 nav2_stack is initialized and running, that is, map_server, amcl along with bt_navigator, planner, controller, recoveries.
  4. Make sure Rviz2 is up and running and make sure the robot is properly localized on Rviz2.
  5. Now, subscribe to /goal_pose using terminal or with your own program.
  6. Issue the goal pose on Rviz2 using 2D Nav Goal button.
  7. Now you should see the goal pose on the /goal_pose subscriber.

I am not sure why it is not working for you. But I am sure this method will work.

Regards,
Girish

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.