Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You should use an actual ROS message instead of a custom class for data that you'd like to publish/subscribe to. See <a href="http://wiki.ros.org/ROS/Tutorials/CreatingMsgAndSrv" rel="nofollow">http://wiki.ros.org/ROS/Tutorials/CreatingMsgAndSrv</a> for how to create a new message that you can then use when publishing data. Using a ROS message also means that existing ROS tools such as <code>rostopic</code> and entire language bindings such as <code>rospy</code> for Python or <code>rosjava</code> for Java will be able to easily interoperate with your C++ node.</p> <p>For this particular case, you can simply use the standard ROS message for a 3D point, <a href="http://docs.ros.org/api/geometry_msgs/html/msg/Point.html" rel="nofollow">geometry_msgs/Point</a>. You can find a fairly comprehensive list of the standardized messages in the <a href="http://wiki.ros.org/common_msgs?distro=hydro" rel="nofollow">common_msgs</a> documentation. Using a standardized message has a number of benefits over creating your own message with essentially the same content - the biggest is that there are many tools or other pieces of software in the ROS ecosystem that you may want to take advantage of later, which will be a fairly painless process if you are already using standarized message types.</p> <p>If you really have a need to use your custom Position class (without simply converting it to a ROS message), you can look at the <a href="http://wiki.ros.org/roscpp/Overview/MessagesSerializationAndAdaptingTypes" rel="nofollow">roscpp serialization</a> documentation. I would <em>strongly</em> suggest against serializing your custom class instead of using either an actual ROS message that you create or a standardized message.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload