Hi,
I'm trying to make a program works with roscopter (https://code.google.com/p/roscopter/). In python I don't have any problem, but when I try to translate that to cpp, I don't know how to use the publisher and the subscriber.
In python, the publisher is just:
pub_rc = rospy.Publisher('send_rc', roscopter.msg.RC)
where "roscopter.msg.RC" is the type, and 'send_rc' is the variable that I want to publish.
In cpp, I think that I have to do something like this:
ros::NodeHandle nh; ros::Publisher publisher = nh.advertise< ::roscopter::RC>("send_rc", 1);
But that doesn't work, and I think than it is because < ::roscopter::RC> is not the correct type. Does someone know some way to know the right type?
Thank you!
---- EDIT ----
With the solution of jarvisschultz it compiles. But I think there is still a problem with the type. "msg" should be an array int32[8], but I cannot fill that array.
I try just with: roscopter::RC msg; msg[2] = 1000;
And the error is: no match for ‘operator[]’ in ‘msg[2]’
Originally posted by Iván on ROS Answers with karma: 3 on 2013-05-13
Post score: 0
Original comments
Comment by jarvisschultz on 2013-05-13:
The first set of double colon's inside of the typedef seem weird to me... try roscopter::RC . Also be sure to #include "roscopter/RC.h"
Comment by Iván on 2013-05-13:
I already have that include. And I used < ::roscopter::RC> just because I thought it should be some similar to that and in the RC.h file I read this line:
typedef boost::shared_ptr< ::roscopter::RC_ > Ptr; and a lot of similar lines.