-
Notifications
You must be signed in to change notification settings - Fork 11
Home
During the creation of the ros-interface
out-of-tree (OOT) module, we found difficulties to link this new module against the external ROS libraries. Actually, the compilation process run just fine; the problem appeared at run-time with the following Python message: AttributeError: 'module' object has no attribute 'ros_interface'
The problem is due to improper linking against ROS libraries, which is fixed with appropriate directives in the CMakeLists.txt
file in the root of the module as well as in the CMakeLists.txt
file under lib/
:
target_link_libraries(gnuradio-ros_interface ${roscpp_LIBRARIES} ... )
Similarly, we had to explicitly define the linking against the LZ4 compression library by creating a proper FindLZ4.cmake
file under cmake/Modules/
and adding ${LZ4_LIBRARY}
to target_link_libraries
:
target_link_libraries(gnuradio-ros_interface ${roscpp_LIBRARIES} ${LZ4_LIBRARY} ... )
When we converted the ros-interface
OOT block into a ROS node, we found that the callback function to process incoming ROS messages was never called. This was because the ROS spin()
or spinOnce()
functions were never called since the ros-interface
instance is not a standalone program with a main
function to call them. We solved this by using an alternative version of spin()
, called AsyncSpinner
. Then, when the ros-interface
block is instantiated, the asynchronous spinner is started in the background.