On Mon, Oct 25, 2010 at 10:51 AM, Josh Faust <
jfaust@willowgarage.com> wrote:
> You have two sets of errors there, one of which is unrelated to the
> MessageEvent. Did you maybe fix one problem but not the other?
Yes, the second error I think is because I'm trying to assign a
control_mode_statusConstPtr& to a control_mode_status. Which brings up
another question, and this may just be my inexperience with C++ but,
how can I get a (copy of) the control_mode_status message itself to
assign to my data member?
> And, just to be sure, did you try:
> const control_mode_statusConstPtr& msg = event.getMessage();
> ?
Yes.
> In a quick test, both:
> void chatterCallback(const ros::MessageEvent<std_msgs::String const>& evt)
> {
> const std_msgs::StringConstPtr msg = evt.getMessage();
> ROS_INFO("I heard: [%s]", msg->data.c_str());
> }
> and
> void chatterCallback(const ros::MessageEvent<std_msgs::String>& evt)
> {
> const std_msgs::StringPtr msg = evt.getMessage();
> ROS_INFO("I heard: [%s]", msg->data.c_str());
> }
>
> work fine.
But what about:
const std_msgs::StringConstPtr& msg = event.getMessage();
(note the &), as in the example in the docs? Is it a typo?
Pat