ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
As the answer by @gvdhoorn pointed out, isValid is a static function and not related to your time instance.
To get the result you expected, you should change your code to:
#include <ros/ros.h>
int main(int argc, char** argv) {
ros::init(argc, argv, "rostime_example");
ros::NodeHandle n;
// default construct a time
ros::Time t;
ROS_WARN_STREAM("time value: " <<t.toSec());
ROS_WARN_STREAM("time valid: " <<t.isZero()==false);
return 0;
}