Build Ros Nodes with bazel
Is it possible to Build ROS nodes with Bazel? e.g. could we build below example with Bazel? http://wiki.ros.org/ROS/Tutorials/Wri...
Please share your views.
Thanks.
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
Is it possible to Build ROS nodes with Bazel? e.g. could we build below example with Bazel? http://wiki.ros.org/ROS/Tutorials/Wri...
Please share your views.
Thanks.
Unless you have a very compelling reason to use bazel, don't. It does a lot of things that aren't terribly compatible with the ROS package management system or traditional open-source build systems and package management.
The company that I work for uses bazel for our internal build system, and we have custom build rules for all of the ROS packages that we use, and a custom compatibility layer between bazel packages and ROS packages. Our rules are pretty specific to our application and are a pretty invasive modification to ROS, so we're not willing to open source them.
Bazel doesn't have any way to import local packages that are build by other tools (it can't read pkgconfig files or cmake find-package files), so it isn't easy to bring in external packages.
In theory you could install the precompiled ROS packages for Ubuntu or build and install ROS the normal way, and then add those libraries to bazel's WORKSPACE file, but that's still quite a bit of setup and you lose all of the inter-package dependencies that are defined in the cmake files and the package.xml files, so you'd have to either lump all of the ROS libraries into a single target, or redefine all of the packages and their dependencies within bazel.
Update: https://github.com/bazelbuild/rules_f... allows building libraries with CMake inside bazel project.
@ahendrix does this new functionality affect your view at all?
I don't think that substantially changes my position. Those rules might save you some time importing C++ packages (but it's not clear how to handle dependencies between imported cmake projects), but they don't help at all with python or for making package management in ROS and bazel work together.
Just an fyi: for ROS2 there is apparently a colcon compatibility pkg for Bazel: colcon/colcon-ros-bazel. That is the opposite direction of what the OP (and probably @robames) ask for, but I thought I'd mention it none-the-less.
I published a demo of how you would go about building ROS nodes in Bazel: https://github.com/nicolov/ros-bazel
It imports a pre-built ROS distribution, so there's no need to maintain separate Bazel definitions for the whole ecosystem. Your custom code (including C++ and Python message generation) is built and tested by Bazel.
Asked: 2017-11-16 16:25:07 -0600
Seen: 2,346 times
Last updated: Nov 16 '17
recall multiple ROS nodes in one main cpp ROS node
Several ROS nodes through a single serial port
How ROS nodes communicate offline?
Is it possible to get the number of all existing ROS_Nodes or to shut down all Nodes except one?
Why does node not run when called from LAUNCH file?
How can I run a node from Code?
Import header files from bazel generated project to ROS code