-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate standalone nodelet executable with oneline cmake macro #47
base: indigo-devel
Are you sure you want to change the base?
Conversation
2751d88
to
cbb7568
Compare
cbb7568
to
528c0e5
Compare
This seems like a lot of extra infrastructure and and complexity to support something that could be done with a one line script that gets installed. For example if you create an executable script
It has the same effect. Looking at the code this duplicates the code here: https://github.com/ros/nodelet_core/blob/indigo-devel/nodelet/src/nodelet.cpp#L295-L310 also is already showing divergence in not checking the return code. In general I think that this will create more confusion as it's creating another use type of hybrid object that's between a nodelet and a node that will only be implemented in some nodelets so it won't be consistent between packages. And the script requires even less cmake lines than the above since it only needs an install rule. |
It seems fine. To pass command line arguments for remapping or setting rosparam, below is collect?
|
Yes, it's recommended to use quotes too: https://www.gnu.org/software/bash/manual/bash.html#Special-Parameters |
Then, what about adding a macro to generate that bash script? |
575fe8f
to
eff1d39
Compare
eff1d39
to
bcf3bd5
Compare
Any idea? |
I'm not sure that I believe that this is beneficial in the long run. It's adding a lot of complexity for relatively small benefit. The benefits are:
The downsides are:
For usage on the command line I think the benefit of discoverability could be added by adding tab completion for the current standalone nodelet instead of creating a new redirection entity that adds complexity but does not provide any additional functionality. |
I think what you're saying is reasonable, but adding some completions to rosrun seems difficult (I posted to ros.answers but no answer): Making |
I don't think there's a standard way to do it. The optimal would be that rosrun could generically detect tab completion for the target executables and invoke the appropriate completion rules for any ros node if that node has defined completion. I expect that's possible but I am not familiar with tab completion so cannot make suggestions how to implement it. |
I've implemented a CMake helper macro https://github.com/ctu-vras/ros-utils/tree/master/cras_cpp_common#list-of-provided-cmake-helpers Install add_library(cras_count_messages_nodelet src/count_messages.cpp)
add_dependencies(cras_count_messages_nodelet ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(cras_count_messages_nodelet ${catkin_LIBRARIES})
# This is the added line
cras_node_from_nodelet(cras_count_messages_nodelet cras::CountMessagesNodelet OUTPUT_NAME count_messages) It only requires two arguments - the CMake target generating the nodelet, and the fully qualified C++ class name of the nodelet's class. Specifically, it does not require the nodelet to be split into header/implementation files (but if your nodelet is, you can use the header, too, with a slightly different notation). |
Example: