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

poseArray.header.frame_id = "/map" will only work if the /map frame exists, i.e, if you are localizing your device/robot to some /map frame. poseArray.header.frame_id actually represents from where this pose is measured. So if I want to publish a pose five meters in front of my robot's head (which is indicated by a frame_id of "camera_rgb_optical_frame), I would send a pose with position.z = 5.0 and set poseArray.header.frame_id = "/camera_rgb_optical_frame".

Try setting the frame_id to to a frame you know exists, and also setting the fixed frame to this as well... Can't really say much more without more info (what frames exists, are you using a robot/device, ...)

poseArray.header.frame_id = "/map" will only work if the /map frame exists, i.e, if you are localizing your device/robot to some /map frame. poseArray.header.frame_id actually represents from where this pose is measured. So if I want to publish a pose five meters in front of my robot's head (which is indicated by a frame_id of "camera_rgb_optical_frame), I would send a pose with position.z = 5.0 and set poseArray.header.frame_id = "/camera_rgb_optical_frame".

Try setting the frame_id to to a frame you know exists, and also setting the fixed frame to this as well... Can't really say much more without more info (what frames exists, are you using a robot/device, ...)

EDIT: I tried running this code and it worked for me, with only running openni_launch openni.launch on a kinect plugged into my computer. Perhaps you can give it a shot, or change poseArray.header.frame_id = "/camera_rgb_optical_frame":

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

if __name__ == '__main__':
    rospy.init_node('pose_array')
    r = rospy.Rate(60.0)
    pub = rospy.Publisher("/poseArrayTopic", PoseArray)
    while not rospy.is_shutdown():
        poseArray = PoseArray()
        poseArray.header.stamp = rospy.Time.now()
        poseArray.header.frame_id = "/camera_rgb_optical_frame"
        for i in range(1, 5):
            somePose = Pose()
            somePose.position.x = 0.0
            somePose.position.y = 0.0
            somePose.position.z = i

            somePose.orientation.x = 0.0
            somePose.orientation.y = 0.0
            somePose.orientation.z = 0.0
            somePose.orientation.w = 1.0

            poseArray.poses.append(somePose)

        pub.publish(poseArray)
        r.sleep()