rviz2: Message Filter dropping message [closed]
Hello,
I have the following problem. I get a speed vector from a subscriber. As a first step I want to create a line in rviz which moves according to the speed vector.
As soon as I start rviz2 and set the right topic I get the following output on the terminal: INFO] [rviz]: Message Filter dropping message: frame 'line_ID' at time 1607353081.030 for reason 'Unknown'.
tracking_node.cpp
subscriber_callback
private:
void tracking_linear_vel_callback(sensor_msgs::msg::Imu::SharedPtr msg)
{
//vec_vel_struct linear_vel;
linear_vel_.at(0) = msg->linear_acceleration.x;
linear_vel_.at(1) = msg->linear_acceleration.y;
linear_vel_.at(2) = msg->linear_acceleration.z;
// get lines for rviz
lines_ = obj_Print_rviz.init_linear_vel(linear_vel_);
lines_.header.stamp = this->now();
//publish rviz lines
rviz_pub->publish(lines_);
}
setup_rviz
#include "print_to_rviz.h"
using namespace print_to_rviz;
PrintToRviz::PrintToRviz()
{
line_strips.header.frame_id = "line_ID";
line_strips.ns = "lines";
line_strips.action = visualization_msgs::msg::Marker::ADD;
line_strips.pose.orientation.w = 1.0;
line_strips.id = 0;
line_strips.type = visualization_msgs::msg::Marker::LINE_STRIP;
//sacling
line_strips.scale.x = 2;
//color
line_strips.color.a = 1.0;
line_strips.color.b = 1.0;
}
PrintToRviz::~PrintToRviz()
{
}
visualization_msgs::msg::Marker PrintToRviz::init_linear_vel(std::array<double, 3> linear_vel)
{
line_strips.points.clear();
// create vertecs
points.x = linear_vel.at(0);
points.y = linear_vel.at(1);
points.z = linear_vel.at(2);
// push points into line strip
line_strips.points.push_back(points);
// std::cout <<"x: " << linear_vel.at(0)<<"\n"<< "\n";
// std::cout <<"y: " << linear_vel.at(1)<<"\n"<< "\n";
// std::cout <<"z: " << linear_vel.at(2)<<"\n"<< "\n";
return line_strips;
}
I have now expected that every time the Subscriber_Callback is called a new line is written to rviz2 instead of the speed vector. What exactly am I doing wrong? Many thanks for the help in advance!
@Schloern93 What question is this a duplicate of? I am having a similar issue.
Why is this closed as a duplicate question?
Looks like this is the top Google search result for this rviz2 error message. @tfoote or @gvdhoorn can you see where the original question this is a duplicate of is?
I don't know it was self closed by @schloem93
But I found a very similar error message here: https://answers.ros.org/question/3577...
It mentions that they weren't filling in the timestamp and I'll note that this code example also doesn't set the timestamp of the
line_strips
If this is the case an enhancement issue for the message filters to give a more useful error would be helpful. Or even better a PR.
Yeah, looks like @Schloern93 closed it himself.
I always encourage people to post a comment with a link to what it is a duplicate of, but seems that didn't happen here.
If anyone gets this issue, it's saying that rviz2 cannot render the data because it's not attached to the main tf tree. Even view_frames won't see it. You'll need to setup a static transform between it and the map, such as