Real OO in ROS/C++?
Hi,
What is your best practice when designing OO architectures?
Are you designing real C++ classes and serialize to messages and let class functions call messages?
Or are you just writing the nodes while offering services/topics? So that the node is the object and the services its functions?
One important point for me is how different class instances communicate over ros' messaging system.
Suppose this problem in OO world:
Two classes: Rover, World Three objects: Rover1, Rover2, World1
So lets say World holds information about the world, and offers a functions that would simply give me the world's state. Lets say the rovers have several fields as parameters like size, model, weight, current_position, etc. and functions such as go_to, pick_up, etc. Functions that act like those would call services in ros.
If each object would maintain a node and I initialized the three objects, how would one node know what their affiliated object's fields are?
E.g. lets say two rovers are supposed to interact, so Rover1 wants to tell Rover2 "go_to(...)". Rover1 calls the service of Rover2, but at this point we do not arrive at a initialized instance of a class, but at the class code. So from this, I can't infer what weight or model of a rover this is.