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

rostopic pose not available

asked 2021-10-19 06:21:56 -0500

MPR gravatar image

updated 2022-03-08 07:01:21 -0500

lucasw gravatar image

I was trying to publish pose.When i try to list the topics ,the pose topic is not available.

aimotion@aimotion:~/catkin_ws$ rosmsg show geometry_msgs/Pose
geometry_msgs/Point position
  float64 x
  float64 y
  float64 z
geometry_msgs/Quaternion orientation
  float64 x
  float64 y
  float64 z
  float64 w

aimotion@aimotion:~/catkin_ws$ rostopic type /Pose
unknown topic type [/Pose]
aimotion@aimotion:~/catkin_ws$ rostopic type /pose
unknown topic type [/pose]

Any solution?How can I publish into pose?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-10-19 07:15:15 -0500

Ranjit Kathiriya gravatar image

updated 2021-10-19 07:27:14 -0500

Hey there,

First, you need to create a publisher it can be either python or cpp file. Let's take an example and create python file.

#!/usr/bin/env python
import rospy
from geometry_msgs.msg import Pose

def publisher():
    pub = rospy.Publisher('cmd_vel', Pose, queue_size=1)
    rospy.init_node('pose_publisher', anonymous=True)
    rate = rospy.Rate(2) # Hz
    while not rospy.is_shutdown():
        p = Pose()
        p.position.x = 0.5
        p.position.y = -0.1
        p.position.z = 1.0
        # Make sure the quaternion is valid and normalized
        p.orientation.x = 0.0
        p.orientation.y = 0.0
        p.orientation.z = 0.0
        p.orientation.w = 1.0
        pub.publish(p)
        rate.sleep()

if __name__ == '__main__':
    try:
        publisher()
    except rospy:
        pass

You can publish your topic via terminal by:

rostopic pub -r 1000 /cmd_vel geometry_msgs/Pose '{position: [1,2,3], orientation: [0.0,0.0,0.0,0.0]}'

Pose will be published on /cmd_vel topic and 1000 means every 1 sec it will be published

Now, the pose is published into pose topic.

You can view all topic by:

rostopic list

You can check data for topic by:

rostopic echo pose

You can view type by :

rostopic type /cmd_vel

Terminal or python run example response will be : geometry_msgs/Pose

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2021-10-19 06:21:56 -0500

Seen: 102 times

Last updated: Oct 19 '21