ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The problem is not that the marker is not published; the problem is that Rviz didn't have time to be started at the first marker publishing.

The solution is to give time to Rviz to start before publishing anything:

  // Color
  marker.color.r = marker.color.b = 0.2;
  marker.color.g = 0.6f;
  marker.color.a = 1.0;
  sleep(5); // TODO: Give time to Rviz to be fully started
  marker_pub.publish(marker);
  return 0;

The problem is not that the marker is not published; the problem is that Rviz didn't have time to be started at the first marker publishing.

The solution is to give time to Rviz to start before publishing anything:

  // Color
  marker.color.r = marker.color.b = 0.2;
  marker.color.g = 0.6f;
  marker.color.a = 1.0;
  sleep(5); // TODO: Give time to Rviz to be fully started
  marker_pub.publish(marker);
  return 0;

As @dornhege mentioned this is not ideal. The best option is to use a latched publisher.

The problem is not that the marker is not published; the problem is that Rviz didn't have time to be started at the first marker publishing.

The solution is to give time to Rviz to start before publishing anything:

  // Color
  marker.color.r = marker.color.b = 0.2;
  marker.color.g = 0.6f;
  marker.color.a = 1.0;
  sleep(5); // TODO: Give time to Rviz to be fully started
  marker_pub.publish(marker);
  return 0;

As @dornhege mentioned this is not ideal. The best Another option is to use a latched publisher.