Updating Publishers from CTurtle to Diamondback
Hi, I'm in the process of migrating some other people's CTurtle code to Diamondback (while learning ROS at the same time), and I'd like to confirm some behaviour that I haven't seen documented.
In the CTurtle code, there are a lot of simple publishers that use std_msgs, such as:
stringPublisher_ = nodeHandle_.advertise<std_msgs::String>("/string", 1);
or
floatPublisher_ = nodeHandle_.advertise<std_msgs::Float32>("/float", 1);
When these are called however, it's not with a std_msgs:: data type, but instead the base data type, e.g.:
std::string state = "IDLE"
stringPublisher_.publish(state);
or
floatPublisher_.publish((float)3.14);
This code worked fine under CTurtle, but now that I'm trying to port it to Diamondback it treats the std::string/float32 as a ROS message and as a result throws an error. Specifically:
/ros-diamondback/ros_comm/clients/cpp/roscpp_traits/include/ros/message_traits.h:121: error: request for member ‘__getMD5Sum’ in ‘m’, which is of non-class type ‘const float’
This is easily fixed by pushing the data into the message variable, for e.g.:
std_msgs::String msgStr;
msgStr.data = state;
stringPublisher_.publish(msgStr);
But I'm just curious if this is an intended change or if I'm missing something?
Thanks!