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

A more sinister form of this mistake is if you declare a global ros::Time or ros::Rate variable. Since global variables are created before main(), the advise from the error message will not apply, since wherever you put your ros::NodeHandle or ros::Time::init(), the global variable will still be constructed before it.

In fact, I believe there is no way to initialize a global ros::Time or ros::Rate variable.

A more sinister form of this mistake is if you declare a global or static ros::Time or / ros::Rate variable. Since global and static variables are created before main(), the advise from the error message will not apply, since wherever you put your ros::NodeHandle or ros::Time::init(), the global variable will still be constructed before it.

In fact, I believe there is no way to initialize a global ros::Time or ros::Rate variable.