Closed EricCousineau-TRI closed 1 year ago
Alternatively, we may want to reconsider the multi-Bazel-workspace approach we're using here.
It does feel like we're fighting bazel by having so many WORKSPACE
s. What if we combined drake_ros_core
, drake_ros_tf2
, and drake_ros_viz
into a single package drake_ros
? That removes some of the duplication.
Having them in separate packages as they are now allows someone to depend on drake_ros_core
without getting the extra dependencies of drake_ros_tf2
or drake_ros_viz
, but those extra dependencies are pretty small: geometry_msgs
, tf2_ros
, tf2_ros_py
, visualization_msgs
. It might be worth removing that ability to make maintenance of this repo easier.
Yeah, I'd be fine if Bazel's consumption is monorepo-esque, as Bazel itself has great mechanisms for granularity.
My only concern is how that might affect ergonomics of colcon/ament workflows. Is it possible for us to have nested stack (in ye olde ROS 1 parlance) for CMake, and then merged for Bazel?
Example:
drake_ros_core/
├──WORKSPACE
└──CMakeLists.txt
drake_ros_tf2/
├──WORKSPACE
└──CMakeLists.txt
drake_ros_viz/
├──WORKSPACE
└──CMakeLists.txt
to
drake_ros/
├──WORKSPACE
├──drake_ros_core/
│ └──CMakeLists.txt
├──drake_ros_tf2/
│ └──CMakeLists.txt
└──drake_ros_viz/
└──CMakeLists.txt
My only concern is how that might affect ergonomics of colcon/ament workflows. Is it possible for us to have nested stack (in ye olde ROS 1 parlance) for CMake, and then merged for Bazel?
It would be possible; though, in this case I think combining them might improve the ergonomics. It would make the CMake required to depend on them a bit shorter.
# ---- Before ----
find_package(drake_ros_core REQUIRED)
find_package(drake_ros_tf2 REQUIRED)
find_package(drake_ros_viz REQUIRED)
# Depending on one library
target_link_libraries(mylib PUBLIC drake_ros_core::drake_ros_core)
# Depending on all libraries
target_link_libraries(mylib PUBLIC drake_ros_core::drake_ros_core drake_ros_tf2::drake_ros_tf2 drake_ros_viz::drake_ros_viz)
# ---- After---
find_package(drake_ros REQUIRED)
#...
# Depending on one library
target_link_libraries(mylib PUBLIC drake_ros::core)
# Depending on all libraries
target_link_libraries(mylib PUBLIC drake_ros::core drake_ros::viz drake_ros::tf2)
# Now could have a shortcut to depend on all libraries?
target_link_libraries(mylib PUBLIC drake_ros::drake_ros)
Having separate packages also allows users to install only the dependencies they need, but In this case the difference between drake_ros_core
and drake_ros_viz
is pretty small. I made an Ubuntu 22.04 container with just the dependencies for drake_ros_core
excluding Drake. Then I checked how much more disk space was needed for the dependencies of drake_ros_viz
and drake_ros_tf2
. It's only 13 MB. I also checked how much Drake's dependencies are, and found that to be 1527 MB more. Since we're already depending on Drake I don't think it's worth trying to give users the opportunity to save another 13 MB.
How about
bazel_ros2_rules/ ...
drake_model_interop/...
drake_ros/
├──BUILD.bazel
├──CMakeLists.txt
├──package.xml
├──WORKSPACE
├──core/
├──tf2/
└──viz/
drake_ros_examples/
├──BUILD.bazel
├──CMakeLists.txt
├──package.xml
└──WORKSPACE
ros2_example_bazel_installed/...
Sweet, that all sounds like a great and convincing analysis to me!
Resolved by #201, thanks!
We should do this either via symlinks or shared tooling, or simple linting.
This should do things like ensure we are:
Alternatively, we may want to reconsider the multi-Bazel-workspace approach we're using here.