Ask Your Question

gammell's profile - activity

2013-02-11 11:05:18 -0500 received badge  Notable Question (source)
2013-02-11 11:05:18 -0500 received badge  Popular Question (source)
2013-02-11 11:05:18 -0500 received badge  Famous Question (source)
2011-05-16 12:21:47 -0500 marked best answer Updating Publishers from CTurtle to Diamondback

Looking at the cturtle code path. I don't see any constructor for std_msgs::String for instance which should have allowed for the conversion. Nor can I see any code path for for publisher::publish that would allow it separately.

I would expect that the code you posted would not work in CTurtle either. I would go back and double check that it worked in the first place.

If it really does work, if you're using eclipse, follow the publish function, back to its declaration, and see which invocation it's calling. Or, follow std_msgs::String's constructor back and see what constructor could possibly create a string message directly from a std::string.

2011-05-12 08:50:37 -0500 received badge  Nice Question (source)
2011-05-12 06:27:53 -0500 commented answer Updating Publishers from CTurtle to Diamondback
Ok. So I haven't tracked down how it *works* in CTurtle yet, but I know why it doesn't work in Diamondback. It's the ROS_ASSERT_MSG at line 111 of publisher.h that throws the error. Those ROS_ASSERT_MSG were not present in the publisher.h in CTurtle...
2011-05-12 02:23:39 -0500 commented answer Updating Publishers from CTurtle to Diamondback
Eric, I agree that rospy is probably the reason someone wrote this code in the first place, but I can confirm that it absolutely does work in roscpp in CTurtle. I will see if I can track down the invocation or something similar.
2011-05-10 06:31:27 -0500 received badge  Student (source)
2011-05-10 01:23:38 -0500 asked a question 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);


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"



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; = state;

But I'm just curious if this is an intended change or if I'm missing something?