SilhouetteMatch¶
Introduction¶
The SilhouetteMatch module is an optional on-board module of the rc_cube and requires a separate SilhouetteMatch license to be purchased.
Warning
This module is not available in camera pipelines of type blaze
.
The module detects objects by matching a predefined silhouette (“template”) to edges in an image.
For the SilhouetteMatch module to work, special object templates are required for each type of object to be detected. Roboception offers a template generation service on their website, where the user can upload CAD files or recorded data of the objects and request object templates for the SilhouetteMatch module.
The object templates consist of significant edges of each object. These template edges are matched to the edges detected in the left and right camera images, considering the actual size of the objects and their distance from the camera. The poses of the detected objects are returned and can be used for grasping, for example.
The SilhouetteMatch module offers:
- A dedicated page on the rc_cube Web GUI for easy setup, configuration, testing, and application tuning.
- A REST-API interface and a KUKA Ethernet KRL Interface.
- The definition of 2D regions of interest to select relevant parts of the camera image (see Setting a region of interest).
- A load carrier detection functionality for bin-picking applications (see LoadCarrier), to provide grasps for objects inside a bin only.
- Storing of up to 50 templates.
- The definition of up to 50 grasp points for each template via an interactive visualization in the Web GUI.
- Support for static and robot-mounted cameras and optional integration with the Hand-eye calibration module, to provide grasps in the user-configured external reference frame.
- Selection of a sorting strategy to sort the detected objects and returned grasps.
Warning
This module is pipeline specific. Changes to its settings or parameters only affect the respective camera pipeline and have no influence on other pipelines running on the rc_cube.
However, the object templates and grasp points are stored globally. Setting, changing or deleting an object template or its grasps affects all camera pipelines.
Suitable objects¶
The SilhouetteMatch module is intended for objects which have significant edges on a common plane that is parallel to the base plane on which the objects are placed. This applies to flat, nontransparent objects, such as routed, laser-cut or water-cut 2D parts and flat-machined parts. More complex parts can also be detected if there are significant edges on a common plane, e.g. a special pattern printed on a flat surface.
The SilhouetteMatch module works best for objects on a texture-free base plane. The color of the base plane should be chosen such that a clear contrast between the objects and the base plane appears in the intensity image.
Suitable scene¶
The scene must meet the following conditions to be suitable for the SilhouetteMatch module:
- The objects to be detected must be suitable for the SilhouetteMatch module as described above.
- Only objects belonging to one specific template are visible at a time (unmixed scenario). In case other objects are visible as well, a proper region of interest (ROI) must be set.
- All visible objects are lying on a common base plane, which has to be calibrated.
- The offset between the base plane normal and the camera’s line of sight does not exceed 10 degrees.
- The objects are not partially or fully occluded.
- All visible objects are right side up (no flipped objects).
- The object edges to be matched are visible in both, left and right camera images.
Base-plane calibration¶
Before objects can be detected, a base-plane calibration must be performed. Thereby, the distance and angle of the plane on which the objects are placed is measured and stored persistently on the rc_cube.
Separating the detection of the base plane from the actual object detection renders scenarios possible in which the base plane is temporarily occluded. Moreover, it increases performance of the object detection for scenarios where the base plane is fixed for a certain time; thus, it is not necessary to continuously re-detect the base plane.
The base-plane calibration can be performed in three different ways, which will be explained in more detail further down:
- AprilTag based
- Stereo based
- Manual
The base-plane calibration is successful if the normal vector of the estimated base plane is at most 10 degrees offset to the camera’s line of sight. If the base-plane calibration is successful, it will be stored persistently on the rc_cube until it is removed or a new base-plane calibration is performed.
Note
To avoid privacy issues, the image of the persistently stored base-plane calibration will appear blurred after rebooting the rc_cube.
In scenarios where the base plane is not accessible for calibration, a plane parallel to the base-plane can be calibrated.
Then an offset
parameter can be used to shift the estimated plane onto the actual base plane where
the objects are placed. The offset
parameter gives the distance in meters by which the estimated plane
is shifted towards the camera.
In the REST-API, a plane is defined by a normal
and a distance
.
normal
is a normalized 3-vector, specifying the normal of the plane.
The normal points away from the camera.
distance
represents the distance of the plane from the camera along the normal.
Normal and distance can also be interpreted as \(a\), \(b\), \(c\), and \(d\) components
of the plane equation, respectively:
AprilTag based base-plane calibration¶
AprilTag detection (ref. TagDetect) is used to find AprilTags in the scene and fit a plane through them. At least three AprilTags must be placed on the base plane so that they are visible in the left and right camera images. The tags should be placed such that they are spanning a triangle that is as large as possible. The larger the triangle, the more accurate is the resulting base-plane estimate. Use this method if the base plane is untextured and no external random dot projector is available. This calibration mode is available via the REST-API interface and the rc_cube Web GUI.
Stereo based base-plane calibration¶
The 3D point cloud computed by the stereo matching module is used to fit a plane
through its 3D points.
Therefore, the region of interest (ROI) for this method must
be set such that only the relevant base plane is included.
The plane_preference
parameter allows to select whether the plane closest to
or farthest from the camera should be used as base plane.
Selecting the closest plane can be used in scenarios where the base plane is
completely occluded by objects or not accessible for calibration.
Use this method if the base plane is well textured or you can
make use of a random dot projector to project texture on the base plane.
This calibration mode is available via the REST-API interface
and the rc_cube Web GUI.
Manual base-plane calibration¶
The base plane can be set manually if its parameters are known, e.g. from previous calibrations. This calibration mode is only available via the REST-API interface and not the rc_cube Web GUI.
Setting a region of interest¶
If objects are to be detected only in part of the camera’s field of view, a 2D region of interest (ROI) can be set accordingly as described in Region of interest.
Setting of grasp points¶
To use SilhouetteMatch directly in a robot application, grasp points can be defined for each template. A grasp point represents the desired position and orientation of the robot’s TCP (Tool Center Point) to grasp an object as shown in Fig. 22.
Each grasp consists of an id
which must be
unique within all grasps for an object template, the template_id
representing the template
to which the grasp should be attached, and the pose
in the coordinate frame of the object template.
Grasp points can be set via the REST-API interface,
or by using the interactive visualization in the Web GUI. The rc_cube can store up to 50 grasp
points per template.
When a grasp is defined on a symmetric object, all grasps symmetric to the defined one
will automatically be considered in the SilhouetteMatch module’s detect_object
service call. Symmetric grasps
for a given grasp point can be retrieved using the get_symmetric_grasps
service call and visualized in the Web GUI.
Setting grasp points in the Web GUI¶
The rc_cube Web GUI provides an intuitive and interactive way of defining grasp points for object templates. In a first step, the object template has to be uploaded to the rc_cube. This can be done in the Web GUI in any pipeline under + Add a new Template in the Templates and Grasps section, or in in the SilhouetteMatch Templates and Grasps section. Once the template upload is complete, a dialog with a 3D visualization of the object template is shown for adding or editing grasp points. The same dialog appears when editing an existing template. If the template contains a collision model or a visualization model, this 3D model is visualized as well.
by clicking onThis dialog provides two ways for setting grasp points:
- Adding grasps manually: By clicking on the + symbol, a new grasp is placed in the object origin. The grasp can be given a unique name which corresponds to its ID. The desired pose of the grasp can be entered in the fields for Position and Roll/Pitch/Yaw which are given in the coordinate frame of the object template represented by the long x, y and z axes in the visualization. The grasp point can be placed freely with respect to the object template - inside, outside or on the surface. The grasp point and its orientation are visualized in 3D for verification.
- Adding grasps interactively: Grasp points can be added interactively by first clicking on the Add Grasp button in the upper right corner of the visualization and then clicking on the desired point on the object template visualization. If the 3D model is displayed, the grasps will be attached to the surface of the 3D model. Otherwise, the grasp is attached to the template surface. The grasp orientation is a right-handed coordinate system and is chosen such that its z axis is perpendicular to the surface pointing inside the template at the grasp position. The position and orientation in the object coordinate frame is displayed on the right. The position and orientation of the grasp can also be changed interactively. In case Snap to surface is enabled in the visualization (default), the grasp can be moved along the template or model surface by clicking on the Translate button in the visualization and then clicking on the grasp point and dragging it to the desired position. The orientation of the grasp around the surface normal can also be changed by choosing Rotate and then rotating the grasp with the cursor. In case Snap to surface is disabled, the grasp can be translated and rotated freely in all three dimensions.
If the object template has symmetries, the grasps which are symmetric to the defined grasps can be displayed by clicking on show symmetric grasps.
Setting grasp points via the REST-API¶
Grasp points can be set via the REST-API interface
using the set_grasp
or set_all_grasps
services
(see Services).
In the SilhouetteMatch module a grasp consists of the template_id
of the template
to which the grasp should be attached, an id
uniquely identifying the grasp point and
the pose
. The pose is given in the coordinate frame of the object template and
consists of a position
in meters and an orientation
as quaternion.
Setting the preferred orientation of the TCP¶
The SilhouetteMatch module determines the reachability of grasp points based on the preferred orientation of the
gripper or TCP. The preferred orientation can be set via the set_preferred_orientation
service or on
the SilhouetteMatch page in the Web GUI.
The resulting direction of the TCP’s z axis is used to reject grasps which cannot be reached by the gripper.
Furthermore, the preferred orientation can be used to sort the reachable grasps by setting the corresponding
sorting strategy.
The preferred orientation can be set in the camera coordinate frame or in the external coordinate frame, in case a hand-eye calibration is available. If the preferred orientation is specified in the external coordinate frame and the sensor is robot mounted, the current robot pose has to be given to each object detection call, so that the preferred orientation can be used for filtering and, optionally, sorting the grasps on the detected objects. If no preferred orientation is set, the orientation of the left camera is used as the preferred orientation of the TCP.
Setting the sorting strategies¶
The objects and grasps returned by the detect_object
service call are sorted according to a sorting strategy which can be
chosen by the user. The following sorting strategies are available and
can be set in the Web GUI
or using the set_sorting_strategies
service call:
preferred_orientation
: objects and grasp points with minimal rotation difference between their orientation and the preferred orientation of the TCP are returned first,direction
: objects and grasp points with the shortest distance along a defined directionvector
in a givenpose_frame
are returned first.
If no sorting strategy is set or default sorting is chosen in the Web GUI, sorting is done based on a combination of
preferred_orientation
and the minimal distance from the camera along the z axis of the preferred orientation of the TCP.
Detection of objects¶
Objects can only be detected after a successful base-plane calibration. It must be ensured that the position and orientation of the base plane does not change before the detection of objects. Otherwise, the base-plane calibration must be renewed.
For triggering the object detection, in general, the following information must be provided to the SilhouetteMatch module:
- The template of the object to be detected in the scene.
- The coordinate frame in which the poses of the detected objects shall be returned (ref. Hand-eye calibration).
Optionally, further information can be given to the SilhouetteMatch module:
- An offset in case the objects are lying not on the base plane but on a plane parallel to it. The offset is the distance between both planes given in the direction towards the camera. If omitted, an offset of 0 is assumed.
- The ID of the load carrier which contains the objects to be detected.
- The ID of the region of interest where to search for the load carrier if a load carrier is set. Otherwise, the ID of the region of interest where the objects should be detected. If omitted, objects are matched in the whole image.
- The current robot pose in case the camera is mounted on the robot and
the chosen coordinate frame for the poses is
external
or the preferred orientation is given in the external frame. - Collision detection information: The ID of the gripper to enable collision checking and optionally a pre-grasp offset to define a pre-grasp position. Details on collision checking are given below in CollisionCheck.
On the Web GUI the detection can be tested in the Try Out section of the SilhouetteMatch page. The result is visualized as shown in Fig. 23.
The left image shows the calibrated base plane in blue and the template to be matched in red with the defined grasp points in green (see Setting of grasp points). The template is warped to the size and tilt matching objects on the calibrated base plane would have.
The right image shows the detection result. The shaded blue area on the
left is the region of the left camera image which does not overlap with
the right image, and in which no objects can be detected. The chosen
region of interest is shown as bold petrol rectangle. The detected edges
in the image are shown in light blue and the matches with the template
(instances
) are shown in red. The blue circles are the origins of the detected
objects as defined in the template and the green circles are the
reachable grasp points. Unreachable grasp points will be visualized as
red dots (not shown in the figure).
The poses of the object origins in the chosen
coordinate frame are returned as results. The orientation of the detected objects is aligned with
the normal of the base plane. If the chosen template also has grasp points attached,
a list of grasps
for all objects is returned in addition to the list of detected objects.
The grasp poses are given in the desired coordinate frame and
the grasps are sorted according to the selected sorting strategy
(see Setting the sorting strategies).
There are references between the detected object instances and the grasps via their uuids
.
In case the templates have a continuous rotational symmetry (e.g. cylindrical objects), all returned object poses will have the same orientation. Furthermore, all grasps symmetric to each grasp point on an object are checked for reachability and collisions, and only the best one according to the given sorting strategy is returned.
For objects with a discrete symmetry (e.g. prismatic objects), all collision-free symmetries of each grasp point which are reachable according to the given preferred TCP orientation are returned, ordered by the given sorting strategy.
The detection results and runtimes are affected by several run-time parameters which are listed and explained further down. Improper parameters can lead to time-outs of the SilhouetteMatch module’s detection process.
Interaction with other modules¶
Internally, the SilhouetteMatch module depends on, and interacts with other on-board modules as listed below.
Note
All changes and configuration updates to these modules will affect the performance of the SilhouetteMatch module.
Stereo camera and stereo matching¶
The SilhouetteMatch module makes internally use of the rectified images from the
Camera module (rc_camera
).
Thus, the exposure time should be set properly to achieve the optimal performance of the module.
For base-plane calibration in stereo mode the disparity images from the Stereo matching module
(rc_stereomatching
) are used. Apart from that,
the stereo-matching module should not be run in parallel to the SilhouetteMatch module, because the detection runtime increases.
For best results it is recommended to enable smoothing for Stereo matching.
Estimation of gravity vector¶
For each object detection inside a load carrier, the module estimates the gravity vector as described in Estimation of gravity vector.
IO and Projector Control¶
In case the rc_cube is used in conjunction with an external random dot projector and
the IO and Projector Control module (rc_iocontrol
),
the projector should be used for the stereo-based base-plane calibration.
The projected pattern must not be visible in the left and right camera images during object detection
as it interferes with the matching process.
Therefore, it must either be switched off or operated in ExposureAlternateActive
mode.
Hand-eye calibration¶
In case the camera has been calibrated to a robot, the SilhouetteMatch module can automatically provide
poses in the robot coordinate frame.
For the SilhouetteMatch node’s Services, the frame of the
input and output poses and plane coordinates can be controlled with the pose_frame
argument.
Two different pose_frame
values can be chosen:
- Camera frame (
camera
). All poses and plane coordinates provided to and by the module are in the camera frame. - External frame (
external
). All poses and plane coordinates provided to and by the module are in the external frame, configured by the user during the hand-eye calibration process. The module relies on the on-board Hand-eye calibration module to retrieve the camera mounting (static or robot mounted) and the hand-eye transformation. If the sensor mounting is static, no further information is needed. If the sensor is robot-mounted, therobot_pose
is required to transform poses to and from theexternal
frame.
All pose_frame
values that are not camera
or external
are rejected.
Note
If no hand-eye calibration is available, all pose_frame
values should be set to camera
.
Note
If the hand-eye calibration has changed after base-plane calibration, the base-plane calibration will be marked as invalid and must be renewed.
If the sensor is robot-mounted, the current robot_pose
has to be provided depending on the value of pose_frame
and the definition of the preferred TCP orientation:
- If
pose_frame
is set toexternal
, providing the robot pose is obligatory. - If the preferred TCP orientation is defined in
external
, providing the robot pose is obligatory. - If
pose_frame
is set tocamera
and the preferred TCP orientation is defined incamera
, providing the robot pose is optional.
If the current robot pose is provided during calibration, it is stored persistently on the rc_cube.
If the updated robot pose is later provided during get_base_plane_calibration
or detect_object
as well, the base-plane calibration will be transformed automatically to this new robot pose.
This enables the user to change the robot pose (and thus camera position)
between base-plane calibration and object detection.
Note
Object detection can only be performed if the limit of 10 degrees angle offset between the base plane normal and the camera’s line of sight is not exceeded.
CollisionCheck¶
Collision checking can be easily enabled for
grasp computation of the SilhouetteMatch module by passing a collision_detection
argument to the
detect_object
service call. It contains the ID of the used gripper and
optionally a pre-grasp offset. The gripper has to be
defined in the GripperDB module
(see Setting a gripper)
and details about collision checking are given in Collision checking within other modules. In addition to collision checking between the gripper and the detected load carrier, collisions
between the gripper and the calibrated base plane will be checked, if the run-time parameter check_collisions_with_base_plane
is true.
If the selected SilhouetteMatch template contains a collision model and the run-time parameter check_collisions_with_matches
is true,
also collisions between the gripper and all other detected objects (not limited to max_number_of_detected_objects
) will be checked. The object
on which the grasp point to be checked is located, is excluded from the collision check.
If collision checking is enabled, only grasps which are collision free will be returned. However, the visualization images on the SilhouetteMatch page of the Web GUI also show colliding grasp points in red. The objects which are considered in the collision check are also visualized with their edges in red.
The CollisionCheck module’s run-time parameters affect the collision detection as described in CollisionCheck Parameters.
Parameters¶
The SilhouetteMatch software module is called rc_silhouettematch
in the REST-API and is represented in the
Web GUIin the desired pipeline under
.
The user can explore and configure the rc_silhouettematch
module’s run-time parameters, e.g. for development and testing, using the Web GUI or the
REST-API interface.
Parameter overview¶
This module offers the following run-time parameters:
Name | Type | Min | Max | Default | Description |
---|---|---|---|---|---|
check_collisions_with_ -base_plane |
bool | false | true | true | Whether to check for collisions between gripper and base plane |
check_collisions_with_matches |
bool | false | true | true | Whether to check for collisions between gripper and detected matches |
edge_sensitivity |
float64 | 0.1 | 1.0 | 0.6 | Sensitivity of the edge detector |
match_max_distance |
float64 | 0.1 | 10.0 | 2.5 | Maximum allowed distance in pixels between the template and the detected edges in the image |
match_percentile |
float64 | 0.7 | 1.0 | 0.85 | Percentage of template pixels that must be within the maximum distance to successfully match the template |
max_number_of_detected_objects |
int32 | 1 | 20 | 10 | Maximum number of detected objects |
quality |
string | - | - | High | Quality: [Low, Medium, High] |
Description of run-time parameters¶
Each run-time parameter is represented by a row on the Web GUI’s SilhouetteMatch page. The name in the Web GUI is given in brackets behind the parameter name and the parameters are listed in the order they appear in the Web GUI:
max_number_of_detected_objects
(Maximum Object Number)¶
This parameter gives the maximum number of objects to detect in the scene. If more than the given number of objects can be detected in the scene, only the objects matching best to the given sorting strategy are returned.
Via the REST-API, this parameter can be set as follows.
PUT http://<host>/api/v2/pipelines/<0,1,2,3>/nodes/rc_silhouettematch/parameters?max_number_of_detected_objects=<value>PUT http://<host>/api/v1/nodes/rc_silhouettematch/parameters?max_number_of_detected_objects=<value>
quality
(Quality)¶
Object detection can be performed on images with different resolutions:
High
(full image resolution),Medium
(half image resolution) andLow
(quarter image resolution). The lower the resolution, the lower the detection time, but the fewer details of the objects are visible.Via the REST-API, this parameter can be set as follows.
PUT http://<host>/api/v2/pipelines/<0,1,2,3>/nodes/rc_silhouettematch/parameters?quality=<value>PUT http://<host>/api/v1/nodes/rc_silhouettematch/parameters?quality=<value>
match_max_distance
(Maximum Matching Distance)¶
This parameter gives the maximum allowed pixel distance of an image edge pixel from the object edge pixel in the template to be still considered as matching. If the object is not perfectly represented in the template, it might not be detected when this parameter is low. High values, however, might lead to false detections in case of a cluttered scene or the presence of similar objects, and also increase runtime.
Via the REST-API, this parameter can be set as follows.
PUT http://<host>/api/v2/pipelines/<0,1,2,3>/nodes/rc_silhouettematch/parameters?match_max_distance=<value>PUT http://<host>/api/v1/nodes/rc_silhouettematch/parameters?match_max_distance=<value>
match_percentile
(Matching Percentile)¶
This parameter indicates how strict the matching process should be. The matching percentile is the ratio of template pixels that must be within the Maximum Matching Distance to successfully match the template. The higher this number, the more accurate the match must be to be considered as valid.
Via the REST-API, this parameter can be set as follows.
PUT http://<host>/api/v2/pipelines/<0,1,2,3>/nodes/rc_silhouettematch/parameters?match_percentile=<value>PUT http://<host>/api/v1/nodes/rc_silhouettematch/parameters?match_percentile=<value>
edge_sensitivity
(Edge Sensitivity)¶
This parameter influences how many edges are detected in the camera images. The higher this number, the more edges are found in the intensity image. That means, for lower numbers, only the most significant edges are considered for template matching. A large number of edges in the image might increase the detection time.
Via the REST-API, this parameter can be set as follows.
PUT http://<host>/api/v2/pipelines/<0,1,2,3>/nodes/rc_silhouettematch/parameters?edge_sensitivity=<value>PUT http://<host>/api/v1/nodes/rc_silhouettematch/parameters?edge_sensitivity=<value>
check_collisions_with_base_plane
(Check Collisions with Base Plane)¶
If this parameter is set to true, and collision checking is enabled by passing a gripper to the
detect_object
service call, all grasp points will be checked for collisions between the gripper and the calibrated base plane, and only grasp points at which the gripper would not collide with the base plane will be returned.Via the REST-API, this parameter can be set as follows.
PUT http://<host>/api/v2/pipelines/<0,1,2,3>/nodes/rc_silhouettematch/parameters?check_collisions_with_base_plane=<value>PUT http://<host>/api/v1/nodes/rc_silhouettematch/parameters?check_collisions_with_base_plane=<value>
check_collisions_with_matches
(Check Collisions with Matches)¶
If this parameter is set to true, and collision checking is enabled by passing a gripper to the
detect_object
service call, all grasp points will be checked for collisions between the gripper and all other detected objects (not limited tomax_number_of_detected_objects
), and only grasp points at which the gripper would not collide with any other detected object will be returned.Via the REST-API, this parameter can be set as follows.
PUT http://<host>/api/v2/pipelines/<0,1,2,3>/nodes/rc_silhouettematch/parameters?check_collisions_with_matches=<value>PUT http://<host>/api/v1/nodes/rc_silhouettematch/parameters?check_collisions_with_matches=<value>
Status values¶
This module reports the following status values:
Name | Description |
---|---|
data_acquisition_time |
Time in seconds required by the last active service to acquire images |
load_carrier_detection_time |
Processing time of the last load carrier detection in seconds |
detect_service_time |
Processing time of the object detection, including data acquisition and load carrier detection time |
last_timestamp_processed |
The timestamp of the last processed dataset |
Services¶
The user can explore and call the rc_silhouettematch
module’s services,
e.g. for development and testing, using the
REST-API interface or
the rc_cube
Web GUI.
The SilhouetteMatch module offers the following services.
detect_object
¶
Triggers an object detection as described in Detection of objects and returns the pose of all found object instances.
Details
All images used by the service are guaranteed to be newer than the service trigger time.
This service can be called as follows.
PUT http://<host>/api/v2/pipelines/<0,1,2,3>/nodes/rc_silhouettematch/services/detect_object
PUT http://<host>/api/v1/nodes/rc_silhouettematch/services/detect_objectRequired arguments:
object_id
inobject_to_detect
: ID of the template which should be detected.
pose_frame
: see Hand-eye calibration.Potentially required arguments:
robot_pose
: see Hand-eye calibration.Optional arguments:
offset
: offset in meters by which the base-plane calibration will be shifted towards the camera.
load_carrier_id
: ID of the load carrier which contains the items to be detected.
collision_detection
: see Collision checking within other modules.The definition for the request arguments with corresponding datatypes is:
{ "args": { "collision_detection": { "gripper_id": "string", "pre_grasp_offset": { "x": "float64", "y": "float64", "z": "float64" } }, "load_carrier_id": "string", "object_to_detect": { "object_id": "string", "region_of_interest_2d_id": "string" }, "offset": "float64", "pose_frame": "string", "robot_pose": { "orientation": { "w": "float64", "x": "float64", "y": "float64", "z": "float64" }, "position": { "x": "float64", "y": "float64", "z": "float64" } } } }The maximum number of returned instances can be controlled with the
max_number_of_detected_objects
parameter.
object_id
: ID of the detected template.
instances
: list of detected object instances, ordered according to the chosen sorting strategy.
grasps
: list of grasps on the detected objects, ordered according to the chosen sorting strategy. Theinstance_uuid
gives the reference to the detected object ininstances
this grasp belongs to.
load_carriers
: list of detected load carriers.
timestamp
: timestamp of the image set the detection ran on.
return_code
: holds possible warnings or error codes and messages.The definition for the response with corresponding datatypes is:
{ "name": "detect_object", "response": { "grasps": [ { "id": "string", "instance_uuid": "string", "pose": { "orientation": { "w": "float64", "x": "float64", "y": "float64", "z": "float64" }, "position": { "x": "float64", "y": "float64", "z": "float64" } }, "pose_frame": "string", "timestamp": { "nsec": "int32", "sec": "int32" }, "uuid": "string" } ], "instances": [ { "grasp_uuids": [ "string" ], "id": "string", "object_id": "string", "pose": { "orientation": { "w": "float64", "x": "float64", "y": "float64", "z": "float64" }, "position": { "x": "float64", "y": "float64", "z": "float64" } }, "pose_frame": "string", "timestamp": { "nsec": "int32", "sec": "int32" }, "uuid": "string" } ], "load_carriers": [ { "id": "string", "inner_dimensions": { "x": "float64", "y": "float64", "z": "float64" }, "outer_dimensions": { "x": "float64", "y": "float64", "z": "float64" }, "overfilled": "bool", "pose": { "orientation": { "w": "float64", "x": "float64", "y": "float64", "z": "float64" }, "position": { "x": "float64", "y": "float64", "z": "float64" } }, "pose_frame": "string", "rim_ledge": { "x": "float64", "y": "float64" }, "rim_step_height": "float64", "rim_thickness": { "x": "float64", "y": "float64" }, "type": "string" } ], "object_id": "string", "return_code": { "message": "string", "value": "int16" }, "timestamp": { "nsec": "int32", "sec": "int32" } } }
calibrate_base_plane
¶
Triggers the calibration of the base plane, as described in Base-plane calibration.
Details
A successful base-plane calibration is stored persistently on the rc_cube and returned by this service. The base-plane calibration is persistent over firmware updates and rollbacks.
All images used by the service are guaranteed to be newer than the service trigger time.
This service can be called as follows.
PUT http://<host>/api/v2/pipelines/<0,1,2,3>/nodes/rc_silhouettematch/services/calibrate_base_plane
PUT http://<host>/api/v1/nodes/rc_silhouettematch/services/calibrate_base_planeRequired arguments:
plane_estimation_method
: method to use for base-plane calibration. Valid values areSTEREO
,APRILTAG
,MANUAL
.
pose_frame
: see Hand-eye calibration.Potentially required arguments:
plane
ifplane_estimation_method
isMANUAL
: plane that will be set as base-plane calibration.
robot_pose
: see Hand-eye calibration.
region_of_interest_2d_id
: ID of the region of interest for base-plane calibration.Optional arguments:
offset
: offset in meters by which the estimated plane will be shifted towards the camera.
plane_preference
instereo
: whether the plane closest to or farthest from the camera should be used as base plane. This option can be set only ifplane_estimation_method
isSTEREO
. Valid values areCLOSEST
andFARTHEST
. If not set, the default isFARTHEST
.The definition for the request arguments with corresponding datatypes is:
{ "args": { "offset": "float64", "plane": { "distance": "float64", "normal": { "x": "float64", "y": "float64", "z": "float64" } }, "plane_estimation_method": "string", "pose_frame": "string", "region_of_interest_2d_id": "string", "robot_pose": { "orientation": { "w": "float64", "x": "float64", "y": "float64", "z": "float64" }, "position": { "x": "float64", "y": "float64", "z": "float64" } }, "stereo": { "plane_preference": "string" } } }
plane
: calibrated base plane.
timestamp
: timestamp of the image set the calibration ran on.
return_code
: holds possible warnings or error codes and messages.The definition for the response with corresponding datatypes is:
{ "name": "calibrate_base_plane", "response": { "plane": { "distance": "float64", "normal": { "x": "float64", "y": "float64", "z": "float64" }, "pose_frame": "string" }, "return_code": { "message": "string", "value": "int16" }, "timestamp": { "nsec": "int32", "sec": "int32" } } }
get_base_plane_calibration
¶
Returns the configured base-plane calibration.
Details
This service can be called as follows.
PUT http://<host>/api/v2/pipelines/<0,1,2,3>/nodes/rc_silhouettematch/services/get_base_plane_calibration
PUT http://<host>/api/v1/nodes/rc_silhouettematch/services/get_base_plane_calibrationRequired arguments:
pose_frame
: see Hand-eye calibration.Potentially required arguments:
robot_pose
: see Hand-eye calibration.The definition for the request arguments with corresponding datatypes is:
{ "args": { "pose_frame": "string", "robot_pose": { "orientation": { "w": "float64", "x": "float64", "y": "float64", "z": "float64" }, "position": { "x": "float64", "y": "float64", "z": "float64" } } } }The definition for the response with corresponding datatypes is:
{ "name": "get_base_plane_calibration", "response": { "plane": { "distance": "float64", "normal": { "x": "float64", "y": "float64", "z": "float64" }, "pose_frame": "string" }, "return_code": { "message": "string", "value": "int16" } } }
delete_base_plane_calibration
¶
Deletes the configured base-plane calibration.
Details
This service can be called as follows.
PUT http://<host>/api/v2/pipelines/<0,1,2,3>/nodes/rc_silhouettematch/services/delete_base_plane_calibration
PUT http://<host>/api/v1/nodes/rc_silhouettematch/services/delete_base_plane_calibrationThis service has no arguments.The definition for the response with corresponding datatypes is:
{ "name": "delete_base_plane_calibration", "response": { "return_code": { "message": "string", "value": "int16" } } }
set_preferred_orientation
¶
Persistently stores the preferred orientation of the gripper to compute the reachability of the grasps, which is used for filtering and, optionally, sorting the grasps returned by the
detect_object
service (see Setting the preferred orientation of the TCP).Details
This service can be called as follows.
PUT http://<host>/api/v2/pipelines/<0,1,2,3>/nodes/rc_silhouettematch/services/set_preferred_orientation
PUT http://<host>/api/v1/nodes/rc_silhouettematch/services/set_preferred_orientationThe definition for the request arguments with corresponding datatypes is:
{ "args": { "orientation": { "w": "float64", "x": "float64", "y": "float64", "z": "float64" }, "pose_frame": "string" } }The definition for the response with corresponding datatypes is:
{ "name": "set_preferred_orientation", "response": { "return_code": { "message": "string", "value": "int16" } } }
get_preferred_orientation
¶
Returns the preferred orientation of the gripper to compute the reachability of the grasps, which is used for filtering and, optionally, sorting the grasps returned by the
detect_object
service (see Setting the preferred orientation of the TCP).Details
This service can be called as follows.
PUT http://<host>/api/v2/pipelines/<0,1,2,3>/nodes/rc_silhouettematch/services/get_preferred_orientation
PUT http://<host>/api/v1/nodes/rc_silhouettematch/services/get_preferred_orientationThis service has no arguments.The definition for the response with corresponding datatypes is:
{ "name": "get_preferred_orientation", "response": { "orientation": { "w": "float64", "x": "float64", "y": "float64", "z": "float64" }, "pose_frame": "string", "return_code": { "message": "string", "value": "int16" } } }
set_sorting_strategies
¶
Persistently stores the sorting strategy for sorting the grasps and detected objects returned by the
detect_object
service (see Detection of objects).Details
This service can be called as follows.
PUT http://<host>/api/v2/pipelines/<0,1,2,3>/nodes/rc_silhouettematch/services/set_sorting_strategies
PUT http://<host>/api/v1/nodes/rc_silhouettematch/services/set_sorting_strategiesOnly one strategy may have a
weight
greater than 0. If allweight
values are set to 0, the module will use the default sorting strategy.If the weight for
direction
is set, thevector
must contain the direction vector andpose_frame
must be eithercamera
orexternal
.The definition for the request arguments with corresponding datatypes is:
{ "args": { "direction": { "pose_frame": "string", "vector": { "x": "float64", "y": "float64", "z": "float64" }, "weight": "float64" }, "preferred_orientation": { "weight": "float64" } } }The definition for the response with corresponding datatypes is:
{ "name": "set_sorting_strategies", "response": { "return_code": { "message": "string", "value": "int16" } } }
get_sorting_strategies
¶
Returns the sorting strategy for sorting the grasps and detected objects returned by the
detect_object
service (see Detection of objects).Details
This service can be called as follows.
PUT http://<host>/api/v2/pipelines/<0,1,2,3>/nodes/rc_silhouettematch/services/get_sorting_strategies
PUT http://<host>/api/v1/nodes/rc_silhouettematch/services/get_sorting_strategiesThis service has no arguments.All
weight
values are 0 when the module uses the default sorting strategy.The definition for the response with corresponding datatypes is:
{ "name": "get_sorting_strategies", "response": { "direction": { "pose_frame": "string", "vector": { "x": "float64", "y": "float64", "z": "float64" }, "weight": "float64" }, "preferred_orientation": { "weight": "float64" }, "return_code": { "message": "string", "value": "int16" } } }
reset_defaults
¶
Resets all parameters of the module to its default values, as listed in above table. The reset does not apply to templates, base-plane calibration, preferred orientation and sorting strategies.
Details
This service can be called as follows.
PUT http://<host>/api/v2/pipelines/<0,1,2,3>/nodes/rc_silhouettematch/services/reset_defaults
PUT http://<host>/api/v1/nodes/rc_silhouettematch/services/reset_defaultsThis service has no arguments.The definition for the response with corresponding datatypes is:
{ "name": "reset_defaults", "response": { "return_code": { "message": "string", "value": "int16" } } }
set_region_of_interest_2d
(deprecated)¶
Persistently stores a 2D region of interest on the rc_cube.
Details
This service can be called as follows.
This service is not available in API version 2. Use set_region_of_interest_2d inrc_roi_db
instead.PUT http://<host>/api/v1/nodes/rc_silhouettematch/services/set_region_of_interest_2d
get_regions_of_interest_2d
(deprecated)¶
Returns the configured 2D regions of interest with the requested
region_of_interest_2d_ids
.Details
This service can be called as follows.
This service is not available in API version 2. Use get_regions_of_interest_2d inrc_roi_db
instead.PUT http://<host>/api/v1/nodes/rc_silhouettematch/services/get_regions_of_interest_2d
delete_regions_of_interest_2d
(deprecated)¶
Deletes the configured 2D regions of interest with the requested
region_of_interest_2d_ids
.Details
This service can be called as follows.
This service is not available in API version 2. Use delete_regions_of_interest_2d inrc_roi_db
instead.PUT http://<host>/api/v1/nodes/rc_silhouettematch/services/delete_regions_of_interest_2d
Internal services¶
The following services for configuring grasps can change in future without notice. Setting, retrieving and deleting grasps is recommend to be done via the Web GUI.
Warning
Configuring grasps is global for all templates on the rc_cube and affects all camera pipelines.
set_grasp
¶
Persistently stores a grasp for the given object template on the rc_cube. All configured grasps are persistent over firmware updates and rollbacks.
Details
This service can be called as follows.
PUT http://<host>/api/v2/pipelines/<0,1,2,3>/nodes/rc_silhouettematch/services/set_grasp
PUT http://<host>/api/v1/nodes/rc_silhouettematch/services/set_graspDetails for the definition of the
grasp
type are given in Setting of grasp points.The definition for the request arguments with corresponding datatypes is:
{ "args": { "grasp": { "id": "string", "pose": { "orientation": { "w": "float64", "x": "float64", "y": "float64", "z": "float64" }, "position": { "x": "float64", "y": "float64", "z": "float64" } }, "template_id": "string" } } }The definition for the response with corresponding datatypes is:
{ "name": "set_grasp", "response": { "return_code": { "message": "string", "value": "int16" } } }
set_all_grasps
¶
Replaces the list of grasps for the given object template on the rc_cube.
Details
This service can be called as follows.
PUT http://<host>/api/v2/pipelines/<0,1,2,3>/nodes/rc_silhouettematch/services/set_all_grasps
PUT http://<host>/api/v1/nodes/rc_silhouettematch/services/set_all_graspsDetails for the definition of the
grasp
type are given in Setting of grasp points.The definition for the request arguments with corresponding datatypes is:
{ "args": { "grasps": [ { "id": "string", "pose": { "orientation": { "w": "float64", "x": "float64", "y": "float64", "z": "float64" }, "position": { "x": "float64", "y": "float64", "z": "float64" } }, "template_id": "string" } ], "template_id": "string" } }The definition for the response with corresponding datatypes is:
{ "name": "set_all_grasps", "response": { "return_code": { "message": "string", "value": "int16" } } }
get_grasps
¶
Returns all configured grasps which have the requested
grasp_ids
and belong to the requestedtemplate_ids
.Details
This service can be called as follows.
PUT http://<host>/api/v2/pipelines/<0,1,2,3>/nodes/rc_silhouettematch/services/get_grasps
PUT http://<host>/api/v1/nodes/rc_silhouettematch/services/get_graspsIf no
grasp_ids
are provided, all grasps belonging to the requestedtemplate_ids
are returned. If notemplate_ids
are provided, all grasps with the requestedgrasp_ids
are returned. If neither IDs are provided, all configured grasps are returned.The definition for the request arguments with corresponding datatypes is:
{ "args": { "grasp_ids": [ "string" ], "template_ids": [ "string" ] } }The definition for the response with corresponding datatypes is:
{ "name": "get_grasps", "response": { "grasps": [ { "id": "string", "pose": { "orientation": { "w": "float64", "x": "float64", "y": "float64", "z": "float64" }, "position": { "x": "float64", "y": "float64", "z": "float64" } }, "template_id": "string" } ], "return_code": { "message": "string", "value": "int16" } } }
delete_grasps
¶
Deletes all grasps with the requested
grasp_ids
that belong to the requestedtemplate_ids
.Details
This service can be called as follows.
PUT http://<host>/api/v2/pipelines/<0,1,2,3>/nodes/rc_silhouettematch/services/delete_grasps
PUT http://<host>/api/v1/nodes/rc_silhouettematch/services/delete_graspsIf no
grasp_ids
are provided, all grasps belonging to the requestedtemplate_ids
are deleted. Thetemplate_ids
list must not be empty.The definition for the request arguments with corresponding datatypes is:
{ "args": { "grasp_ids": [ "string" ], "template_ids": [ "string" ] } }The definition for the response with corresponding datatypes is:
{ "name": "delete_grasps", "response": { "return_code": { "message": "string", "value": "int16" } } }
get_symmetric_grasps
¶
Returns all grasps that are symmetric to the given grasp.
Details
This service can be called as follows.
PUT http://<host>/api/v2/pipelines/<0,1,2,3>/nodes/rc_silhouettematch/services/get_symmetric_grasps
PUT http://<host>/api/v1/nodes/rc_silhouettematch/services/get_symmetric_graspsThe definition for the request arguments with corresponding datatypes is:
{ "args": { "grasp": { "id": "string", "pose": { "orientation": { "w": "float64", "x": "float64", "y": "float64", "z": "float64" }, "position": { "x": "float64", "y": "float64", "z": "float64" } }, "template_id": "string" } } }The first grasp in the returned list is the one that was passed with the service call. If the object template does not have an exact symmetry, only the grasp passed with the service call will be returned. If the object template has a continuous symmetry (e.g. a cylindrical object), only 12 equally spaced sample grasps will be returned.
Details for the definition of the
grasp
type are given in Setting of grasp points.The definition for the response with corresponding datatypes is:
{ "name": "get_symmetric_grasps", "response": { "grasps": [ { "id": "string", "pose": { "orientation": { "w": "float64", "x": "float64", "y": "float64", "z": "float64" }, "position": { "x": "float64", "y": "float64", "z": "float64" } }, "template_id": "string" } ], "return_code": { "message": "string", "value": "int16" } } }
Return codes¶
Each service response contains a return_code
,
which consists of a value
plus an optional message
.
A successful service returns with a return_code
value of 0
.
Negative return_code
values indicate that the service failed.
Positive return_code
values indicate that the service succeeded with additional information.
Code | Description |
---|---|
0 | Success |
-1 | An invalid argument was provided |
-3 | An internal timeout occurred, e.g. during object detection |
-4 | Data acquisition took longer than allowed |
-7 | Data could not be read or written to persistent storage |
-8 | Module is not in a state in which this service can be called. E.g. detect_object cannot be called if there is no base-plane calibration. |
-10 | New element could not be added as the maximum storage capacity of regions of interest or templates has been exceeded |
-100 | An internal error occurred |
-101 | Detection of the base plane failed |
-102 | The hand-eye calibration changed since the last base-plane calibration |
-104 | Offset between the base plane normal and the camera’s line of sight exceeds 10 degrees |
10 | The maximum storage capacity of regions of interest or templates has been reached |
11 | An existing element was overwritten |
100 | The requested load carrier was not detected in the scene |
101 | None of the detected grasps is reachable |
102 | The detected load carrier is empty |
103 | All detected grasps are in collision |
107 | The base plane was not transformed to the current camera pose, e.g. because no robot pose was provided during base-plane calibration |
108 | The template is deprecated. |
151 | The object template has a continuous symmetry |
999 | Additional hints for application development |
Template API¶
For template upload, download, listing and removal, special REST-API endpoints are provided. Templates can also be uploaded, downloaded and removed via the Web GUI. The templates include the grasp points, if grasp points have been configured. Up to 50 templates can be stored persistently on the rc_cube.
-
GET
/templates/rc_silhouettematch
¶ Get list of all rc_silhouettematch templates.
Template request
GET /api/v2/templates/rc_silhouettematch HTTP/1.1
Template response
HTTP/1.1 200 OK Content-Type: application/json [ { "id": "string" } ]
Response Headers: - Content-Type – application/json
Status Codes: - 200 OK – successful operation (returns array of Template)
- 404 Not Found – node not found
Referenced Data Models:
-
GET
/templates/rc_silhouettematch/{id}
¶ Get a rc_silhouettematch template. If the requested content-type is application/octet-stream, the template is returned as file.
Template request
GET /api/v2/templates/rc_silhouettematch/<id> HTTP/1.1
Template response
HTTP/1.1 200 OK Content-Type: application/json { "id": "string" }
Parameters: - id (string) – id of the template (required)
Response Headers: - Content-Type – application/json application/octet-stream
Status Codes: - 200 OK – successful operation (returns Template)
- 404 Not Found – node or template not found
Referenced Data Models:
-
PUT
/templates/rc_silhouettematch/{id}
¶ Create or update a rc_silhouettematch template.
Template request
PUT /api/v2/templates/rc_silhouettematch/<id> HTTP/1.1 Accept: multipart/form-data application/json
Template response
HTTP/1.1 200 OK Content-Type: application/json { "id": "string" }
Parameters: - id (string) – id of the template (required)
Form Parameters: - file – template file (required)
Request Headers: - Accept – multipart/form-data application/json
Response Headers: - Content-Type – application/json
Status Codes: - 200 OK – successful operation (returns Template)
- 400 Bad Request – Template is not valid or max number of templates reached
- 403 Forbidden – forbidden, e.g. because there is no valid license for this module.
- 404 Not Found – node or template not found
- 413 Request Entity Too Large – Template too large
Referenced Data Models:
-
DELETE
/templates/rc_silhouettematch/{id}
¶ Remove a rc_silhouettematch template.
Template request
DELETE /api/v2/templates/rc_silhouettematch/<id> HTTP/1.1 Accept: application/json
Parameters: - id (string) – id of the template (required)
Request Headers: - Accept – application/json
Response Headers: - Content-Type – application/json
Status Codes: - 200 OK – successful operation
- 403 Forbidden – forbidden, e.g. because there is no valid license for this module.
- 404 Not Found – node or template not found