Skip to content

Commit 1b17465

Browse files
authored
Merge pull request #88 from PickNikRobotics/pr-use-core-sam-behavior
Use core segmentation behavior in `lab_sim`
2 parents df876ef + 1292a68 commit 1b17465

File tree

6 files changed

+89
-47
lines changed

6 files changed

+89
-47
lines changed

src/example_behaviors/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ example_interfaces)
1515
foreach(package IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS})
1616
find_package(${package} REQUIRED)
1717
endforeach()
18-
find_package(moveit_pro_ml REQUIRED)
1918

2019
add_library(
2120
example_behaviors
@@ -41,7 +40,6 @@ target_include_directories(
4140
PRIVATE ${PCL_INCLUDE_DIRS})
4241
ament_target_dependencies(example_behaviors
4342
${THIS_PACKAGE_INCLUDE_DEPENDS})
44-
target_link_libraries(example_behaviors onnx_sam2)
4543

4644
# Install Libraries
4745
install(

src/lab_sim/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ install(
3333
config
3434
description
3535
launch
36+
models
3637
objectives
3738
waypoints
3839
DESTINATION
File renamed without changes.

src/lab_sim/objectives/run_sam2_onnx.xml

Lines changed: 0 additions & 45 deletions
This file was deleted.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<root
3+
BTCPP_format="4"
4+
main_tree_to_execute="Segment Point Cloud from Clicked Point"
5+
>
6+
<!--//////////-->
7+
<BehaviorTree
8+
ID="Segment Point Cloud from Clicked Point"
9+
_description="Captures a point cloud and requests the user to click an object in the image to be segmented. The point cloud is then filtered to only include the selected object."
10+
_favorite="true"
11+
>
12+
<Control ID="Sequence">
13+
<Action ID="ClearSnapshot" />
14+
<Action
15+
ID="GetImage"
16+
topic_name="/wrist_camera/color"
17+
timeout_sec="5.000000"
18+
message_out="{image}"
19+
/>
20+
<Action
21+
ID="GetPointsFromUser"
22+
point_prompts="Select the object to be segmented;"
23+
point_names="Point1;"
24+
view_name="/wrist_camera/color"
25+
pixel_coords="{pixel_coords}"
26+
/>
27+
<Action
28+
ID="GetMasks2DFromPointQuery"
29+
image="{image}"
30+
pixel_coords="{pixel_coords}"
31+
masks2d="{masks2d}"
32+
decoder_model_path="models/decoder.onnx"
33+
encoder_model_path="models/sam2_hiera_large_encoder.onnx"
34+
model_package="lab_sim"
35+
/>
36+
<Action
37+
ID="GetPointCloud"
38+
topic_name="/wrist_camera/points"
39+
timeout_sec="5.000000"
40+
message_out="{point_cloud}"
41+
/>
42+
<Action
43+
ID="GetCameraInfo"
44+
topic_name="/wrist_camera/camera_info"
45+
message_out="{camera_info}"
46+
timeout_sec="5.000000"
47+
/>
48+
<Action
49+
ID="GetMasks3DFromMasks2D"
50+
camera_info="{camera_info}"
51+
masks2d="{masks2d}"
52+
point_cloud="{point_cloud}"
53+
masks3d="{masks3d}"
54+
/>
55+
<Decorator
56+
ID="ForEach"
57+
vector_in="{masks3d}"
58+
out="{mask3d}"
59+
index="{index}"
60+
>
61+
<Action
62+
ID="GetPointCloudFromMask3D"
63+
point_cloud="{point_cloud}"
64+
mask3d="{mask3d}"
65+
point_cloud_fragment="{point_cloud_fragment}"
66+
/>
67+
</Decorator>
68+
<Action
69+
ID="SendPointCloudToUI"
70+
point_cloud="{point_cloud_fragment}"
71+
pcd_topic="/pcd_pointcloud_captures"
72+
/>
73+
<Action
74+
ID="PublishPointCloud"
75+
point_cloud="{point_cloud_fragment}"
76+
point_cloud_topic="/my_point_cloud"
77+
/>
78+
<Action ID="SwitchUIPrimaryView" primary_view_name="Visualization" />
79+
</Control>
80+
</BehaviorTree>
81+
<TreeNodesModel>
82+
<SubTree ID="Segment Point Cloud from Clicked Point">
83+
<MetadataFields>
84+
<Metadata runnable="true" />
85+
</MetadataFields>
86+
</SubTree>
87+
</TreeNodesModel>
88+
</root>

0 commit comments

Comments
 (0)