Send an opaque pointer through client-server setup
Ubuntu 16.04 - ROS Kinetic Kame
I have an opaque pointer which is defined in .h file as follows:
typedef struct SomeObject* SomeContext_t;
I need to share this between different nodes as the entities defined in SomeContext_t
only exists in itself. I am doing this to have external control over a sdk without having to send data through TCP/IP i.e I want to have decentralised control over components. Already considered nodelets but do not want to use it because it will go down even if one nodelet goes down.
Looking at this question: https://answers.ros.org/question/208597/object-pointer-as-ros-message/ , is it possible to customize msg/srv to send such type of pointer? It says that one can use custom message but I am unable to understand how? I have already read the tutorials for customizing message but could not comprehend
Asked by Atul Ahirrao on 2019-11-27 15:46:20 UTC
Comments
As noted in the previous question, you can't pass pointers between different processes. If you want a more detailed answer, you should tell us what the object that you're trying to pass actually is.
Asked by ahendrix on 2019-11-27 22:08:25 UTC
The object is an opaque pointer, which is obviously protected by whoever wrote it down. I know how to use it from the documentation but type of this pointer, I am completely clueless.
Asked by Atul Ahirrao on 2019-12-05 12:16:43 UTC
If you cannot provide any more information, then I cannot help you, and I suspect that what you're asking is not possible.
Instead of sharing the pointer, you may need to build a ROS API that proxies to the SDK that you're trying to use.
Asked by ahendrix on 2019-12-05 12:59:31 UTC
I wish I could but it is a black-box to me. What do you mean by building a ROS API that proxies the SDK?
Asked by Atul Ahirrao on 2019-12-05 16:25:40 UTC
For each function in the API, make a ROS service or topic for that part of the API.
Asked by ahendrix on 2019-12-07 00:06:39 UTC
Sorry for the late reply @ahendrix. Apparently the opaque pointer is not supposed to be shared. So I ended up creating ROS topic to share the underlying entities in the "SomeContext_t". Thanks for your advice and also I found out some other pointers from your other threads :)
Asked by Atul Ahirrao on 2019-12-13 14:00:45 UTC