Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROS2 Humble #326

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .dockerignore

This file was deleted.

15 changes: 4 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
/weights
*.pyc
*._
__pycache__
venv
.idea
.DS_Store
._.DS_Store
*.hdr
google_scanned_models/
scripts/nvisii_data_gen/output/dataset/
test/
training_script/


210 changes: 0 additions & 210 deletions CMakeLists.txt

This file was deleted.

41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Deep Object Pose Estimation (DOPE) - ROS2 Inference

This is a ROS2 package to make inference with DOPE ([original ROS1 repo](https://github.com/NVlabs/Deep_Object_Pose/tree/master)). The official code is adapted to work on the ROS2 framework with Python3.10 and the updated requirements. See the official repository for detailed info about DOPE.

## Installing

The code has been tested on Ubuntu 22.04 with ROS2 Humble and Python 3.10.

1. **Clone the repository into your ros2 workspace**
```
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone https://github.com/Vanvitelli-Robotics/DOPE.git dope -b ros2_humble
```

2. **Install python dependencies**
```
cd ~/ros2_ws/src/dope
python3 -m pip install -r requirements.txt
```

3. **Build**
```
cd ~/ros2_ws
colcon build --packages-select dope
```

4. **Run the node**

First, you need to configure your setup in */config/config_dope.yaml*, specifying the topics of your camera and the parameters of the target objects. Note that you have to also specifity the path of the weights resulting from the training for each object you want to inferred (also several objects simultaneously). You can load the weights in ```weights/``` folder (we don't provide any .pth due to the high dimension of the file).

After configuration, you can start the inference running the node as follows:
```
ros2 run dope_ros2 dope_node --ros-args --params-file ~/ros2_ws/src/dope/config/config_dope.yaml
```
or, if you prefer, you can use the available launch file:
```
ros2 launch dope_ros2 dope.launch.py
```


78 changes: 78 additions & 0 deletions config/config_dope.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/dope_node:
ros__parameters:
topic_camera: /camera/color/image_raw
topic_camera_info: /camera/color/camera_info # "/dope/webcam/camera_info"
topic_publishing: dope
input_is_rectified: true # Whether the input image is rectified (strongly suggested!)
downscale_height: 400 # if the input image is larger than this, scale it down to this pixel height

# Comment any of these lines to prevent detection / pose estimation of that object
weights:
# "apple": "package://dope/weights/apple_120.pth"
# "santal_ace": "package://dope_ros2/weights/santal_67.pth"
"lime": "package://dope_ros2/weights/lime_215.pth"
"bowl": "package://dope_ros2/weights/bowl_114.pth"
"fork": "package://dope_ros2/weights/fork_190.pth"
"glass": "package://dope_ros2/weights/red_glass_120.pth"
"cracker": "package://dope_ros2/weights/cracker_60.pth"

# Cuboid dimension in cm x, y, z
dimensions:
"apple": [9.756118059158325, 8.538994193077087, 9.590171277523041]
"santal_ace": [8.69415, 6.90914, 4.38487]
"lime": [4.0052998811006546,3.9955999702215195,5.266399681568146]
"bowl": [20.5,20.5,9.15]
"fork": [2.82,2.86,20.64]
"glass": [7.4,7.4,9.5]
"cracker": [16.403600692749023,21.343700408935547,7.179999828338623]

class_ids:
"apple": 1
"santal_ace": 4
"lime": 5
"bowl": 6
"fork": 7
"glass": 8
"cracker": 9

draw_colors:
"apple": [255, 0, 0] # red
"santal_ace": [255, 127, 80] # orange
"lime": [153, 255, 51] # lime green
"bowl": [1, 172, 142]
"fork": [120, 120, 120] # silver
"glass": [255, 2, 1] # red
"cracker": [255, 255, 0] # yellow

# optional: provide a transform that is applied to the pose returned by DOPE
# model_transforms:
# "test": [[0, 0, 1, 0], [0, -1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1]]

# optional: if you provide a mesh of the object here, a mesh marker will be
# published for visualization in RViz
meshes:
#"apple": "/home/workstation/dope_ros_ws/src/grasp_dope/scripts/models/Apple/Apple_4K/food_apple_01_4k_simplify.obj"
#"santal_ace": "/home/sfederico/Documents/cad_models/santal_ace/santal_centered.obj"
"lime" : "package://dope_ros2/meshes/Lime.obj"
"bowl" : "package://dope_ros2/meshes/bowl.obj"
"glass" : "package://dope_ros2/meshes/simple_glass.obj"
"fork" : "package://dope_ros2/meshes/fork.obj"
"cracker": "package://dope_ros2/meshes/cracker_box.obj"


mesh_scales:
"apple": 1.0
"santal_ace": 0.001
"lime" : 1.0
"bowl": 0.001
"fork": 1.0
"glass": 1.0
"cracker": 1.0

overlay_belief_images: true # Whether to overlay the input image on the belief images published on /dope/belief_[obj_name]

# Config params for DOPE
thresh_angle: 0.5
thresh_map: 0.0001
sigma: 3
thresh_points: 0.1
Loading