rviz2: Message Filter dropping message [closed]

asked 2020-12-07 09:26:27 -0600

Schloern93 gravatar image

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!

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by Schloern93
close date 2021-01-14 05:04:47.397898

Comments

@Schloern93 What question is this a duplicate of? I am having a similar issue.

Jeffrey Kane Johnson gravatar image Jeffrey Kane Johnson  ( 2021-04-06 18:19:16 -0600 )edit

Why is this closed as a duplicate question?

pmuthu2s gravatar image pmuthu2s  ( 2021-04-13 10:22:27 -0600 )edit

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?

ruffsl gravatar image ruffsl  ( 2021-04-15 23:13:36 -0600 )edit

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

tfoote gravatar image tfoote  ( 2021-04-16 02:16:51 -0600 )edit

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.

tfoote gravatar image tfoote  ( 2021-04-16 02:18:07 -0600 )edit

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.

gvdhoorn gravatar image gvdhoorn  ( 2021-04-16 03:05:34 -0600 )edit

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

ros2 run tf2_ros static_transform_publisher "0" "0" "0" "0" "0" "0" "map" "frame"
Void gravatar image Void  ( 2022-03-18 11:11:34 -0600 )edit