Skip to content

PoseStamped message #3294

@subutayebru

Description

@subutayebru

Hi! I am trying to publish geometry_msgs/PoseStamped from T265. I can see the topic that i declared /camera/pose/sample published yet, no message is being echoed. All the changes I made are in the following link.

I am using ros1-legacy branch since I am working on ROS1 noetic.
Librealsense version: 2.50.0

https://github.com/subutayebru/realsense-ros/tree/ros1-legacy/realsense2_camera

I mostly made changes to base_realsense_node.cpp and its header in include folder.


        geometry_msgs::PoseStamped pose_msg;
        pose_msg.pose.position.x = -pose.translation.z;
        printf(pose_msg.pose.position.x)
        pose_msg.pose.position.y = -pose.translation.x;
        pose_msg.pose.position.z =  pose.translation.y;
        pose_msg.pose.orientation.x = -pose.rotation.z;
        pose_msg.pose.orientation.y = -pose.rotation.x;
        pose_msg.pose.orientation.z =  pose.rotation.y;
        pose_msg.pose.orientation.w =  pose.rotation.w;
        
        pose_msg.header.stamp = t;
        pose_msg.header.frame_id = _odom_frame_id;
        pose_msg.pose = _odom_msgs.pose.pose
        _pose_stamped_pub.publish(pose_msg);
        
        ROS_DEBUG("Published PoseStamped message on /camera/pose/sample");

And in the header I am declaring _pose_stamped_pub in public.

ros::Publisher _pose_stamped_pub;

I am gettting this error when catkin building the package.

/home/sherec/bru_ws/src/realsense-ros/realsense2_camera/src/t265_realsense_node.cpp:15:5: error: ‘_pose_stamped_pub’ was not declared in this scope 15 | _pose_stamped_pub = _node_handle.advertise<geometry_msgs::PoseStamped>("/camera/pose/sample", 100); | ^~~~~~~~~~~~~~~~~ /home/sherec/bru_ws/src/realsense-ros/realsense2_camera/src/base_realsense_node.cpp: In member function ‘void realsense2_camera::BaseRealSenseNode::setupPublishers()’: /home/sherec/bru_ws/src/realsense-ros/realsense2_camera/src/base_realsense_node.cpp:1034:9: error: ‘_pose_stamped_pub’ was not declared in this scope 1034 | _pose_stamped_pub = _node_handle.advertise<geometry_msgs::PoseStamped>("/camera/pose/sample", 10); | ^~~~~~~~~~~~~~~~~ /home/sherec/bru_ws/src/realsense-ros/realsense2_camera/src/base_realsense_node.cpp: In member function ‘void realsense2_camera::BaseRealSenseNode::pose_callback(rs2::frame)’: /home/sherec/bru_ws/src/realsense-ros/realsense2_camera/src/base_realsense_node.cpp:1577:9: error: ‘_pose_stamped_pub’ was not declared in this scope 1577 | if (_pose_stamped_pub) | ^~~~~~~~~~~~~~~~~ make[2]: *** [CMakeFiles/realsense2_camera.dir/build.make:104: CMakeFiles/realsense2_camera.dir/src/t265_realsense_node.cpp.o] Error 1 make[2]: *** Waiting for unfinished jobs.... make[2]: *** [CMakeFiles/realsense2_camera.dir/build.make:90: CMakeFiles/realsense2_camera.dir/src/base_realsense_node.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:2859: CMakeFiles/realsense2_camera.dir/all] Error 2 make: *** [Makefile:146: all] Error 2 cd /home/sherec/bru_ws/build/realsense2_camera; catkin build --get-env realsense2_camera | catkin env -si /usr/bin/make --jobserver-auth=3,4; cd -
Any help is appreciated!! Thanks!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions