mavros/local_position/pose only giving altitude

asked 2019-04-17 09:48:52 -0500

Luxiam gravatar image

Setup:

  • List item
  • Linux ubuntu 16.04.
  • ROS kinetic
  • Mavros PX4 on a pixhawk 3 pro.

I'm reading out the data from the /mavros/local_position/pose to get a estimated location. The gazebo simulation runs the code fine. and returns all values as expected. When the IRL drone is running the topic gets updated like normal but the code only get a Z_alt value when reading the topic (code below), all the other values are 0.000000f or -0.0000000f. The only difference I can see is that the IRL drone sends data to the /mavros/vision_pose/pose topic to estimate its location.

geometry_msgs::PoseStamped edge;

    while (ros::ok())
     {
        sharedEdge = ros::topic::waitForMessage<geometry_msgs::PoseStamped>("/mavros/local_position/pose", n);

        if (sharedEdge != NULL)
        {
            edge = *sharedEdge;
            ROS_INFO("x:%f y:%f z:%f", edge.pose.position, edge.pose.position.y, edge.pose.position.z);
        }
        ros::spinOnce();

}
edit retag flag offensive close merge delete