using simple timers in ROS - doesn't show up in rqt [closed]
I am on ROS Hydro (with Catkin). I made a node with a C++ timer, with the following code;
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
int main(int args,char* argv[])
{
clock_t startTime = clock(); //Start timer
double secondsPassed;
bool flag = true;
while(flag)
{
secondsPassed = (clock() - startTime) / CLOCKS_PER_SEC;
if(secondsPassed >= 120)
{
std::cout << "Hello ROS, this is a C++ node and " << secondsPassed << " seconds have passed" << std::endl;
flag = false;
}
}
}
This works just fine ! but the funny part is that it doesn't show up on rqt. If the node is running for 120 seconds, it should register in rqt for those 120 seconds - which it doesn't ! Any hints ? explanation ? or am I doing something wrong ?