ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
2018-05-26 07:03:05 -0500 | received badge | ● Famous Question (source) |
2017-04-19 16:03:48 -0500 | received badge | ● Notable Question (source) |
2016-05-10 10:49:43 -0500 | received badge | ● Supporter (source) |
2015-11-16 13:19:34 -0500 | commented question | Using the same data structure in multiple nodes That would work but it would mean referencing the code from the different package and I thought this would not be really clean either. Or do you consider such an approach alright? |
2015-11-16 11:05:37 -0500 | received badge | ● Popular Question (source) |
2015-11-16 05:22:31 -0500 | commented answer | Using the same data structure in multiple nodes It works, I just had to make a few more adjustments. You have to add lines
in |
2015-11-16 03:57:13 -0500 | asked a question | Using the same data structure in multiple nodes I am designing a system which consists of multiple nodes. Among others there is a "gui" node for visualization and a "controls" node for controlling the whole application. During runtime I need to keep and update the information about a so called camera_unit for which I created a class CameraUnit (.h + .cpp files). The thing is I need to use this class both in "gui" and "controls" node, as the gui uses the info for visualization and the controls for other computations, but I do not want to duplicate the code. What are my options? I have thought of these: 1. Duplicate the code (Probably the worst option as I would have to always copy .h and .cpp file between nodes when editing them) 2. Make the static library out of the CameraUnit class which would be linked to both "controls" and "gui" node (That seems possible but I still feel there is a more elegant option) 3. Merge "gui" and "controls" nodes to one node and make the gui run in a separate thread (I would like to prevent this option as it would change my architecture) Thank you for any advice! |
2015-11-16 03:42:11 -0500 | received badge | ● Famous Question (source) |
2015-09-16 06:53:24 -0500 | commented answer | Addressing messages using different topics vs. using in-message identifier Yes, I share your opinion so I will stick with the first option and it is a good idea to create the array of publishers to avoid duplicate code. Thank you! |
2015-09-16 06:09:45 -0500 | received badge | ● Notable Question (source) |
2015-09-15 13:42:53 -0500 | received badge | ● Popular Question (source) |
2015-09-15 07:54:12 -0500 | asked a question | Addressing messages using different topics vs. using in-message identifier Suppose we have one control node ns_a/control and multiple device nodes ns_b_[1|2|3|...]/device (i.e. for 2 device nodes it would be ns_b_1/device, ns_b_2/device). I want to send a control message m1 tp different device nodes. There are two possibilities to do so. 1) Create specific topic for each tuple (ns_a/control, ns_b_1/device), (ns_a/control, ns_b_2/device) and so on. Thus the message m1 will always get to one specific device node depending on which topic I publish to. The drawback is the fact that I would have to create as many publishers as many device nodes I have. 2) Create only one topic to publish to and specify the receiver in the message m1 itself. I could for instance add variable int receiver to the message m1 which would specify for which device the message was sent. The drawback of this approach is the fact, that all device nodes would have to process all messages m1 no matter for which device node this message was sent and they would have to check themselves whether the message was addressed for them. Which approach is more 'clean' and/or is there any other and better approach to deal with such a situation? Thank you in advance. |