0
$\begingroup$

Rosanswers logo

Hi there! ;)

I'm working on a communication between two Nodelets by making use of the intraprocess communication with shared pointers as mentioned here.

I got three questions and hope you can help:

  1. Is it possible to use the shared pointer kind communication with services/requests, too? How?

  2. If you send out a message as shared pointer you must take care of that the sender doesn't write to this message again after sending it out. If there are a lot of subscribers, who is responsible for freeing the used memory if the message isn't used any longer AND how can the sender check if this is the case?

  3. Regarding to this the Nodelets don't have to care about there callbacks to be called as Nodes do. It is simply neccessary to subscribe for the messages at a (MT)NodeHandle and there is NO NEED to call ros::spin_once() or ros::spin() in an self created thread. Is that correct?


Originally posted by Ted on ROS Answers with karma: 41 on 2012-05-24

Post score: 4

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

  1. I don't know. Maybe. You could try sending the request as a boost::shared_ptr. I don't see how the reply would work, though.

  2. The boost::shared_ptr does that automatically, using a reference count which is decremented when the pointer deconstructor runs.

  3. Yes. The nodelet manager handles the spin logic.


Originally posted by joq with karma: 25443 on 2012-05-24

This answer was ACCEPTED on the original site

Post score: 5

$\endgroup$

Your Answer

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