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

I am not sure what you code is supposed to do, maybe, there is a more elegant to create your desired behaviour....

However, your problem is, that your tf::TransformBroadcaster br; is created before ros::init. As class member it is implizitly instantiated:

    RvizPlotter::RvizPlotter(int argc, char **argv)
// br is created implizitly at this point in the code
{
      ros::init(argc, argv, "plotter");
      ros::NodeHandle node;

Before ros::init and the first nodeHandle is created, it can not set up its internal publishers, i. e. is invalid.

I am not sure what you code is supposed to do, maybe, there is a more elegant to create your desired behaviour....

However, your problem is, that your tf::TransformBroadcaster br; is created before ros::init. ros::init. As class member it is implizitly instantiated:

    RvizPlotter::RvizPlotter(int argc, char **argv)
// br is created implizitly at this point in the code
{
      ros::init(argc, argv, "plotter");
      ros::NodeHandle node;

Before ros::init ros::init and the first nodeHandle is created, it can not set up its internal publishers, i. e. is invalid.