Note: As mentioned in the previous tutorial it is strongly recommended to use the web GUI for the configuration of the load carrier and the region of interest..
(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Computing grasps (configuration with rosservice calls)

Description: This tutorial shows how to use the compute_grasps rosservice call of the ItemPick and BoxPick modules. The configuration of the load carrier and the region of interest uses rosservice calls as well.

Keywords: rc_visard, itempick, rosservice

Tutorial Level: INTERMEDIATE

For the definition of the load carrier and region of interest, we will be using the rc_itempick module. The same arguments of the rc_itempick rosservice call requests apply to the rc_boxpick module unless explicitly indicated otherwise.

Goal

Learn how to calculate grasp poses, define load carriers and define regions of interest through rosservice calls for the ItemPick and BoxPick modules.

Before we start

Make sure you have the rc_itempick_client_node or the rc_boxpick_client_node running and connected to your rc_visard. For the installation and setup see the previous tutorial

Defining a load carrier

For a load carrier named tutorial_carrier, where the pose is specified in the frame_id camera (i.e. coordinates relative to the camera image) with the dimensions shown below. A rosservice call would look like this:

$ rosservice call /rc_itempick/set_load_carrier "load_carrier:
  id: 'tutorial_carrier'
  outer_dimensions: {x: 0.6, y: 0.4, z: 0.17}
  inner_dimensions: {x: 0.57, y: 0.365, z: 0.165}" 

When the pose of the load carrier is unspecified, as it is above, it is searched for in the whole image.

Defining the region of interest

A more interactive way of setting the region of interest is described in the managing regions of interest tutorial.

For a region of interest called tutorial_roi with the pose and dimensions specified in the frame_id "camera" the rosservice call looks like this:

$ rosservice call /rc_itempick/set_region_of_interest "region_of_interest:        
  id: 'tutorial_roi'                                                            
  pose:                                                                         
    header:                                                                     
      frame_id: 'camera'                                                        
    pose:                                                                       
      position:                                                                 
        x: 0.0                                                                  
        y: 0.0                                                                  
        z: 0.83                                                                 
      orientation:                                                              
        x: 0.0                                                                  
        y: -0.216                                                                  
        z: 0.0                                                                  
        w: 0.976                                                                  
  primitive:                                                                    
    type: 1                                                                     
    dimensions: [0.85, 0.66, 0.44]"

primitive: type:1 means a box but you could also specify a sphere. In the example setup the camera was 0.83 m above the load carrier. The rotation was -25°, which translates into the orientation above. For computing the quaternions from Euler angles you can use this web converter

As mentioned before this tutorial does not involve using a robot. Therefore the field robot_pose is not set in the service calls shown here.

Detecting the load carrier

After the load carrier has been configured, it is important to check that rc_itempick can detect the load carrier in the scene.

The load_carrier_ids and the region_of_interest_id should be the name as defined earlier. Setting the pose_frame to "camera" defines the coordinate frame of the returned pose. The command looks like this:

$ rosservice call /rc_itempick/detect_load_carriers "pose_frame: 'camera'
region_of_interest_id: 'tutorial_roi'
load_carrier_ids:
- 'tutorial_carrier'" 

Computing grasps inside a load carrier

A region of interest or a load carrier must be given in order to use the compute_grasps service of the Pick modules.

Once the load carrier is configured and detectable in the scene, the pick module can be used to compute grasps only for objects that are inside the bin. To this purpose, the additional argument load_carrier_id is added to the compute grasp service call. To compute grasps using ROS and our predefined load carrier and region of interest, the actual rosservice call (omitting all non-required fields) looks like this:

  • For the ItemPick module:

    $ rosservice call /rc_itempick/compute_grasps "pose_frame: 'camera'
    region_of_interest_id: 'tutorial_roi'
    load_carrier_id: 'tutorial_carrier'
    suction_surface_length: 0.02
    suction_surface_width: 0.02"
  • For the BoxPick module:

    $ rosservice call /rc_boxpick/compute_grasps "pose_frame: 'camera'
    region_of_interest_id: 'tutorial_roi'
    load_carrier_id: 'tutorial_carrier'
    item_models:
    - type: 'RECTANGLE'
      rectangle:
        min_dimensions: {x: 0.05, y: 0.05}
        max_dimensions: {x: 0.1, y: 0.15}
    suction_surface_length: 0.02
    suction_surface_width: 0.02"

    On the BoxPick module, the maximal and minimal dimensions of the box to detect have to be given.

This should give you a list of detected object surfaces. Their coordinates are specified in the given pose_frame, i.e., here in "camera". The default value of objects to detect is five. You can adjust it using the web GUI.

Troubleshooting and FAQ

For troubleshooting purposes look here

Wiki: rc_visard/Tutorials/Computing grasps (configuration with rosservice calls) (last edited 2019-07-05 08:58:06 by CarlosGarcia)