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

Revision history [back]

click to hide/show revision 1
initial version

Check out the wiki. It shows you how to add topics to visualize with rviz.

In short, in rviz:

  1. Click "Add" towards the bottom of the "Displays" window.
  2. A new window will pop up with two tabs, click on the tab labeled "By topic".
  3. You will see all the topics that rviz can visualize. Find the topic that you want to visualize, click on it
  4. Click "OK".

Check out the wiki. It shows you how to add topics to visualize with rviz.rviz and much more.

In short, in rviz:

  1. Click "Add" towards the bottom of the "Displays" window.
  2. A new window will pop up with two tabs, click on the tab labeled "By topic".
  3. You will see all the topics that rviz can visualize. Find the topic that you want to visualize, click on it
  4. Click "OK".

Check out the wiki. It shows you how to add topics to visualize with rviz and much more.

In short, in rviz:

  1. Click "Add" towards the bottom of the "Displays" window.
  2. A new window will pop up with two tabs, click on the tab labeled "By topic".
  3. You will see all the topics that rviz can visualize. Find the topic that you want to visualize, click on it
  4. Click "OK".

Update:

So, if I understand your question correctly you want to display the path that your robot is taking. A way to do this is by subscribing to the robot's odometry topic (/odom?) and then take the robot's pose and republish them as a path. Here's a simple script that should be a decent starting point for you.

#!/usr/bin/env python
import rospy

from nav_msgs.msg import Path
from nav_msgs.msg import Odometry
from geometry_msgs.msg import PoseStamped

path = Path()

def odom_cb(data):
    global path
    path.header = data.header
    pose = PoseStamped()
    pose.header = data.header
    pose.pose = data.pose.pose
    path.poses.append(pose)
    path_pub.publish(path)

odom_sub = rospy.Subscriber('/odom', Odometry, odom_cb)
path_pub = rospy.Publisher('/path', Path, queue_size=10)

if __name__ == '__main__':
    rospy.init_node('path_node')
    while not rospy.is_shutdown():
        rospy.spin()

Check out the wiki. It shows you how to add topics to visualize with rviz and much more.

In short, in rviz:

  1. Click "Add" towards the bottom of the "Displays" window.
  2. A new window will pop up with two tabs, click on the tab labeled "By topic".
  3. You will see all the topics that rviz can visualize. Find the topic that you want to visualize, click on it
  4. Click "OK".

Update:

So, if I understand your question correctly you want to display the path that your robot is taking. A way to do this is by subscribing to the robot's odometry topic (/odom?) and then take the robot's pose and republish them as a path. Here's a simple script that should be a decent starting point for you.

#!/usr/bin/env python
import rospy

from nav_msgs.msg import Path
from nav_msgs.msg import Odometry
from geometry_msgs.msg import PoseStamped

path = Path()

def odom_cb(data):
    global path
    path.header = data.header
    pose = PoseStamped()
    pose.header = data.header
    pose.pose = data.pose.pose
    path.poses.append(pose)
    path_pub.publish(path)

odom_sub = rospy.Subscriber('/odom', Odometry, odom_cb)
path_pub = rospy.Publisher('/path', Path, queue_size=10)

if __name__ == '__main__':
    rospy.init_node('path_node')
    while not rospy.is_shutdown():
        rospy.spin()

Check out the wiki. It shows you how to add topics to visualize with rviz and much more.

In short, in rviz:

  1. Click "Add" towards the bottom of the "Displays" window.
  2. A new window will pop up with two tabs, click on the tab labeled "By topic".
  3. You will see all the topics that rviz can visualize. Find the topic that you want to visualize, click on it
  4. Click "OK".

Update:

So, if I understand your question correctly you want to display the path that your robot is taking. A way to do this is by subscribing to the robot's odometry topic (/odom?) and then take the robot's pose and republish them as a path. Here's a simple script that should be a decent starting point for you.

#!/usr/bin/env python
import rospy

from nav_msgs.msg import Path
from nav_msgs.msg import Odometry
from geometry_msgs.msg import PoseStamped

path = Path()

def odom_cb(data):
    global path
    path.header = data.header
    pose = PoseStamped()
    pose.header = data.header
    pose.pose = data.pose.pose
    path.poses.append(pose)
    path_pub.publish(path)

rospy.init_node('path_node')

odom_sub = rospy.Subscriber('/odom', Odometry, odom_cb)
path_pub = rospy.Publisher('/path', Path, queue_size=10)

if __name__ == '__main__':
    rospy.init_node('path_node')
    rospy.spin()