How to create rviz display plugin for msg without header?

asked 2019-11-19 21:10:38 -0600

ssht gravatar image

Hi,

I'm developing custom rviz display plugin, according to the ImuDisplay tutorial. But when I changed sensor_msgs::Imu to my custom msg, build failed because my custom msg doesn't have header. How to create rviz display plugin for msg without header?

I changed

rviz::MessageFilterDisplay<sensor_msgs::Imu> to rviz::MessageFilterDisplay<mu_custom_msg>

Build error log

In file included from /opt/ros/kinetic/include/rviz/message_filter_display.h:41:0,
                 from /home/myname/catkin_ws/src/my_rviz_plugins/src/imu_display.h:36,
                 from /home/myname/catkin_ws/src/my_rviz_plugins/src/imu_display.cpp:43: /opt/ros/kinetic/include/rviz/frame_manager.h: In instantiation of ‘void rviz::FrameManager::messageCallback(const ros::MessageEvent<const M>&, rviz::Display*) [with M = my_custom_msg_<std::allocator<void>
>]’: /opt/ros/kinetic/include/rviz/frame_manager.h:176:41: required from ‘void rviz::FrameManager::registerFilterForTransformStatusCheck(tf::MessageFilter<M>*, rviz::Display*) [with M = my_custom_msg_<std::allocator<void>
>]’ /opt/ros/kinetic/include/rviz/message_filter_display.h:106:7: required from ‘void rviz::MessageFilterDisplay<MessageType>::onInitialize() [with MessageType = my_custom_msg_<std::allocator<void>
>]’ /home/myname/catkin_ws/src/my_rviz_plugins/src/imu_display.cpp:80:13: required from here /opt/ros/kinetic/include/rviz/frame_manager.h:217:5: error: ‘const struct my_custom_msg_<std::allocator<void>
>’ has no member named ‘header’
     messageArrived(msg->header.frame_id, msg->header.stamp, authority, display);
     ^ /opt/ros/kinetic/include/rviz/frame_manager.h:217:5: error: ‘const struct my_custom_msg_<std::allocator<void>
>’ has no member named ‘header’

Thanks,

edit retag flag offensive close merge delete

Comments

How to create rviz display plugin for msg without header?

this is certainly possible, but: what is your plugin actually doing? If it is going to render your message in the 3D visualisation of RViz, how would you know where to place the object(s) if you have no TF data (ie: no frame_id)?

gvdhoorn gravatar imagegvdhoorn ( 2019-11-20 02:06:59 -0600 )edit

Thank you. Actually, my custom msg is like this,

--

my_custom_msgs/Arrows.msg

my_custom_msgs/Arrow[] arrows

--

my_custom_msgs/Arrow.msg

geometry_msgs/PoseStamped pose

--

So, each Arrow.msg can be placed in 3D space, but I want to display them together by Arrows.msg.

ssht gravatar imagessht ( 2019-11-20 21:16:54 -0600 )edit