diff --git a/.gitignore b/.gitignore index 1f3c150..2ee6cd2 100644 --- a/.gitignore +++ b/.gitignore @@ -105,3 +105,9 @@ venv.bak/ #idea .idea/ + +# vscode +.vscode/ + +# log +log/ \ No newline at end of file diff --git a/README.md b/README.md index 74b2bb4..23a2624 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,55 @@ This project depends on ROS [vision_msgs](http://wiki.ros.org/vision_msgs), whic You can select a specific model using the `model_file` ros parameter, which specifies a given `.yaml` file under `detectron2/configs`. Detectron2 is then initialized with that model, and you can send it images to be segmented through the `/detectron/segment` service. See the [service message specification](segmentation_msgs/srv/SegmentImage.srv) for details about the output format. If the `publish_visualization` parameter is set to true, the node also publishes a version of image annotated with the masks and scores, on a topic specified through the `visualization_topic` parameter. + +## Usage with [Voxeland](https://github.com/MAPIRlab/Voxeland) + +### 1. Build the Workspace + +Clean previous build artifacts and execute `colcon build` to compile the workspace. Please adapt the paths if necessary: + +```bash +cd ~/ros2_ws +rm -rf build/ install/ log/ +colcon build --symlink-install --cmake-clean-cache +``` + +### 2. Launch the Detectron2 ROS 2 Node + +Please adapt the paths if necessary: + +```bash +cd ~/ros2_ws +source install/setup.bash +ros2 run detectron_ros detectron_ros_node +``` + +### 3. Run Voxeland and Play a ScanNet ROS Bag + +Create and execute a bash script that contains the following commands. Please adapt the paths if necessary: + +```bash +cd ~/ros2_ws + +# Init voxeland_robot_perception with Detectron2 detector +gnome-terminal -- bash -c "source ~/.bashrc; source /home/ubuntu/ros2_ws/venvs/voxenv/bin/activate; ros2 launch voxeland_robot_perception semantic_mapping.launch.py object_detector:=detectron; exec bash" + +# Init voxeland server +gnome-terminal -- bash -c "ros2 launch voxeland voxeland_server.launch.xml; exec bash" + +# Open bag folder and play ros2 bag +gnome-terminal -- bash -c "cd /home/ubuntu/ros2_ws/bag/ScanNet/to_ros/ROS2_bags/scene0000_01/; ros2 bag play scene0000_01.db3; exec bash" +``` + +### Service Interface + +**Service:** `/yoloe/segment` +**Type:** `segmentation_msgs/srv/SegmentImage` + +**Request:** +- `sensor_msgs/Image image` - Input RGB image + +**Response:** +- `segmentation_msgs/SemanticInstance2D[] instances` - Detected objects with masks and bounding boxes + +**Visualization Topic:** `/segmentedImage` (if enabled) \ No newline at end of file diff --git a/detectron_ros/detectron_ros/detectron_ros.py b/detectron_ros/detectron_ros/detectron_ros.py index b0d424b..1c24c83 100644 --- a/detectron_ros/detectron_ros/detectron_ros.py +++ b/detectron_ros/detectron_ros/detectron_ros.py @@ -37,7 +37,7 @@ def __init__(self): self.interest_classes = self.declare_parameter("interest_classes", [*range(80)]).value self.publish_visualization = self.declare_parameter("publish_visualization", True).value - visualization_topic = self.declare_parameter("visualization_topic", "/detectron/segmentedImage").value + visualization_topic = self.declare_parameter("visualization_topic", "/segmentedImage").value self.visualization_pub = self.create_publisher(sensor_msgs.msg.Image, visualization_topic, 1) self.cv_bridge = CvBridge()