forked from LASR-at-Home/Base
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: handle list of requests & add sensor sending/retrieval (LASR-at…
- Loading branch information
Showing
7 changed files
with
138 additions
and
56 deletions.
There are no files selected for viewing
9 changes: 6 additions & 3 deletions
9
common/vision/lasr_vision_cropped_detection/examples/request.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
#!/usr/bin/env python3 | ||
import rospy | ||
from lasr_vision_msgs.msg import CDRequest | ||
from lasr_vision_msgs.srv import CroppedDetection, CroppedDetectionRequest | ||
|
||
|
||
if __name__ == "__main__": | ||
service = rospy.ServiceProxy("/vision/cropped_detection", CroppedDetection) | ||
service.wait_for_service() | ||
while not rospy.is_shutdown(): | ||
request = CroppedDetectionRequest() | ||
request.method = "closest" | ||
request_srv = CroppedDetectionRequest() | ||
request = CDRequest() | ||
request.method = "centered" | ||
request.use_mask = True | ||
request.yolo_model = "yolov8x-seg.pt" | ||
request.yolo_model_confidence = 0.5 | ||
request.yolo_nms_threshold = 0.3 | ||
request.object_names = ["person", "bottle", "chair"] | ||
response = service(request) | ||
request_srv.requests = [request] | ||
response = service(request_srv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# 2D methods are "centered", "left-most" "right-most" "top-most" "bottom-most" | ||
# 3D methods are "closest" "furthest" | ||
string method | ||
|
||
# Whether to turn all pixels other than the YOLo mask to black | ||
# If false, uses bounding-box cropping. | ||
bool use_mask | ||
|
||
# Name of the objects to get | ||
string[] object_names | ||
|
||
# Name of the yolo model to use for detections. If using mask is True, | ||
# this must be a valid segementation model. | ||
string yolo_model | ||
|
||
# Confidence for YOLO model detections. | ||
float32 yolo_model_confidence | ||
|
||
# NMS threshold for YOLO model detections | ||
float32 yolo_nms_threshold | ||
|
||
# List of polygons to be used for 3D detections only | ||
geometry_msgs/Polygon[] polygons | ||
|
||
|
||
# Whether to return the img or pointcloud that inference was run on | ||
bool return_sensor_reading | ||
|
||
# Optionally can give an RGB Image to run inference on | ||
sensor_msgs/Image rgb_image | ||
|
||
# Optionally can give a pointcloud to run inference on | ||
sensor_msgs/PointCloud2 pointcloud |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# The combined masked image, if use_mask is True, else empty. | ||
sensor_msgs/Image masked_img | ||
|
||
# A list of all the cropped images of detections sorted according to the | ||
# given method. | ||
sensor_msgs/Image[] cropped_imgs | ||
|
||
# A list of 2D detections, sorted to match the cropped_imgs | ||
lasr_vision_msgs/Detection[] detections_2d | ||
|
||
# A list of 3D detections, sorted to match the cropped_imgs | ||
lasr_vision_msgs/Detection3D[] detections_3d | ||
|
||
# Euclidian distance of given crop metric | ||
float32[] distances | ||
|
||
# IDs corresponding to which polygon(s) the detection centroid is contained in. | ||
# An ID of 0 corresponds to the first polygon in the request, etc. | ||
uint8[] polygon_ids | ||
|
||
# The RGB image used for the 2D crop | ||
sensor_msgs/Image rgb_image | ||
|
||
# The pointcloud used for the 3D crop | ||
sensor_msgs/PointCloud2 pointcloud |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,6 @@ | ||
# 2D methods are "centered", "left-most" "right-most" "top-most" "bottom-most" | ||
# 3D methods are "closest" "furthest" | ||
string method | ||
|
||
# Whether to turn all pixels other than the YOLo mask to black | ||
# If false, uses bounding-box cropping. | ||
bool use_mask | ||
|
||
# Name of the objects to get | ||
string[] object_names | ||
|
||
# Name of the yolo model to use for detections. If using mask is True, | ||
# this must be a valid segementation model. | ||
string yolo_model | ||
|
||
# Confidence for YOLO model detections. | ||
float32 yolo_model_confidence | ||
|
||
# NMS threshold for YOLO model detections | ||
float32 yolo_nms_threshold | ||
|
||
# List of polygons to be used for 3D detections only | ||
geometry_msgs/Polygon[] polygons | ||
# List of detection requests | ||
lasr_vision_msgs/CDRequest[] requests | ||
|
||
--- | ||
# The combined masked image, if use_mask is True, else empty. | ||
sensor_msgs/Image masked_img | ||
|
||
# A list of all the cropped images of detections sorted according to the | ||
# given method. | ||
sensor_msgs/Image[] cropped_imgs | ||
|
||
# A list of 2D detections, sorted to match the cropped_imgs | ||
lasr_vision_msgs/Detection[] detections_2d | ||
|
||
# A list of 3D detections, sorted to match the cropped_imgs | ||
lasr_vision_msgs/Detection3D[] detections_3d | ||
|
||
# Euclidian distance of given crop metric | ||
float32[] distances | ||
|
||
# IDs corresponding to which polygon(s) the detection centroid is contained in. | ||
# An ID of 0 corresponds to the first polygon in the request, etc. | ||
uint8[] polygon_ids | ||
# List of detection responses | ||
lasr_vision_msgs/CDResponse[] responses |