ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I don't think there is a "ROS-way" for doing this. I presume you can figure this out yourself, I cannot add something to your options list. A "shared-pointer-like" field which can optionally be populated is not included in the ROS msg format.
Addition on your 2) option: If your data never contains zeros maybe it be smart to use this one and check the received data for non-zero, because all ros message field are defaulted in the constructor to zero (or false for booleans).