Subscriber return value roscpp

Hi, how do I return an integer from a subscriber callback in cpp?

Hey @mpheng96,

Just return the integer with

// return integer; e.g
return 0;

// or if the integer is stored in a variable
int ret = 0;
// ....
return ret;

That said, what is the use case for returning an integer in you subscriber callback? How do you intend to use the return value? Please note that, by convention, C(++) functions return 0 to indicate they were successful, and any non-zero to indicate failure.

Hi thanks for reply, I do not need that anymore!