Cant publish a time object
I am trying to publish the current wallclock time but some how during the build process it always gives an error : Const Class ros::Time does not have any member named getMD5su
Here is the code :
#include "ros/xmlrpc_manager.h" #include "std_msgs/Float32.h" #include "std_msgs/String.h" #include "std_msgs/Time.h" #include "ros/time.h" #include "time.h" #include "sstream" using namespace std;
int main(int argc, char **argv){
ros::init(argc, argv, "talker");
ros::NodeHandle n;
ros::Publisher sum_publisher = n.advertise<std_msgs::Time>("sum", 1000);
std::cout<<ros::XMLRPCManager::instance()->getServerURI()<<std::endl;
ros::Rate loop_rate(1);
int a = 0;
int count = 0;
while (ros::ok()){
std_msgs::Time msg;
msg.data = ros::Time::now();
sum_publisher.publish(msg);
ros::spinOnce();
loop_rate.sleep();
//++count;
}
return 0;
}
I guess i should be advertising std_msgs::Time
instead of ros::Time
but it is not getting resolved. I already have included ros/time.h