0
$\begingroup$

Rosanswers logo

Hi I'm new to ROS and I'm an amateur when it comes to pointers. I just did the subscriber and publisher tutorials and I am currently experimenting and converting them into classes for future use. I noticed that in the callback function it has the following parameters:

 void chatterCallback(const std_msgs::String::ConstPtr& msg)

then I opened another cpp code with a subscriber and found:

  void joyCallback(const sensor_msgs::Joy::ConstPtr& joy);

My question, is 'joy' and 'msg' specifc to use for their message::message type? How can I know what to put after the ConstPtr& say for sensor_msgs::Range? Thank you.


Originally posted by J. J. on ROS Answers with karma: 60 on 2018-08-31

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

No; the variable name is not specific to the message type or the callback. You can name the argument joy or msg or gerorge or whatever you want.


Originally posted by ahendrix with karma: 47576 on 2018-08-31

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by J. J. on 2018-08-31:
Thank you. That cleared up my mind.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.