Closed hofbi closed 4 months ago
This is not going to work for various reasons with Bazel. One of them is that roslaunch changes cwd to $ROS_HOME, which doesn't work with Bazel. Instead, you should use a cleaned up version from this repo: //third_party/legacy_roslaunch
.
I tried you proposal, but still get
import roslaunch
E ModuleNotFoundError: No module named 'roslaunch'
OK, I'll look at this.
BTW, you need to do the following:
from third_party import legacy_roslaunch # as roslaunch
What if I cannot change the python code, but only the BUILD.bazel
. Having it as propoased in this PR allows for import roslaunch
Good point.
The proposed Bazel change is fine, it's that the original roslaunch code is not going to fit well with Bazel way of working. So, you'll need to set up a dummy roslaunch package+bazel target (in e.g. your repo) that will depend on //third_party/legacy_roslaunch
from this repo and can implement a single __init__.py
that only has e.g. from third_party.legacy_roslaunch import *
.
Eventually we should have such a package in this repo for use-cases like yours.
Happy to contribute this here. Where should we put it?
Fixed. You should depend on //third_party/ros:roslaunch
.
BTW, I did a cleanup/modernization. Take a look at .bazelrc for instance.
Similar to https://github.com/mvukov/rules_ros/pull/5, this adds the missing
roslanch
python library