<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD Journal Archiving and Interchange DTD v2.3 20070202//EN" "archivearticle.dtd">
<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" article-type="data-paper">
<front>
<journal-meta>
<journal-id journal-id-type="publisher-id">Front. Robot. AI</journal-id>
<journal-title>Frontiers in Robotics and AI</journal-title>
<abbrev-journal-title abbrev-type="pubmed">Front. Robot. AI</abbrev-journal-title>
<issn pub-type="epub">2296-9144</issn>
<publisher>
<publisher-name>Frontiers Media S.A.</publisher-name>
</publisher>
</journal-meta>
<article-meta>
<article-id pub-id-type="doi">10.3389/frobt.2017.00059</article-id>
<article-categories>
<subj-group subj-group-type="heading">
<subject>Robotics and AI</subject>
<subj-group>
<subject>Code</subject>
</subj-group>
</subj-group>
</article-categories>
<title-group>
<article-title>Real-time Pipeline for Object Modeling and Grasping Pose Selection <italic>via</italic> Superquadric Functions</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author" corresp="yes">
<name><surname>Vezzani</surname> <given-names>Giulia</given-names></name>
<xref ref-type="aff" rid="aff1"><sup>1</sup></xref>
<xref ref-type="aff" rid="aff2"><sup>2</sup></xref>
<xref ref-type="corresp" rid="cor1">&#x0002A;</xref>
<uri xlink:href="http://frontiersin.org/people/u/386790"/>
</contrib>
<contrib contrib-type="author">
<name><surname>Natale</surname> <given-names>Lorenzo</given-names></name>
<xref ref-type="aff" rid="aff1"><sup>1</sup></xref>
<uri xlink:href="http://frontiersin.org/people/u/36032"/>
</contrib>
</contrib-group>
<aff id="aff1"><sup>1</sup><institution>iCub Facility, Istituto Italiano di Tecnologia</institution>, <addr-line>Genova</addr-line>, <country>Italy</country></aff>
<aff id="aff2"><sup>2</sup><institution>University of Genova</institution>, <addr-line>Genova</addr-line>, <country>Italy</country></aff>
<author-notes>
<fn fn-type="edited-by"><p>Edited by: Maxime Petit, Imperial College London, United Kingdom</p></fn>
<fn fn-type="edited-by"><p>Reviewed by: Tobias Fischer, Imperial College London, United Kingdom; Uriel Martinez-Hernandez, University of Leeds, United Kingdom; Ingo Keller, Heriot-Watt University, United Kingdom</p></fn>
<corresp content-type="corresp" id="cor1">&#x0002A;Correspondence: Giulia Vezzani, <email>giulia.vezzani&#x00040;iit.it</email></corresp>
<fn fn-type="other" id="fn001"><p>Specialty section: This article was submitted to Humanoid Robotics, a section of the journal Frontiers in Robotics and AI</p></fn>
</author-notes>
<pub-date pub-type="epub">
<day>15</day>
<month>11</month>
<year>2017</year>
</pub-date>
<pub-date pub-type="collection">
<year>2017</year>
</pub-date>
<volume>4</volume>
<elocation-id>59</elocation-id>
<history>
<date date-type="received">
<day>28</day>
<month>07</month>
<year>2017</year>
</date>
<date date-type="accepted">
<day>30</day>
<month>10</month>
<year>2017</year>
</date>
</history>
<permissions>
<copyright-statement>Copyright &#x000A9; 2017 Vezzani and Natale.</copyright-statement>
<copyright-year>2017</copyright-year>
<copyright-holder>Vezzani and Natale</copyright-holder>
<license xlink:href="http://creativecommons.org/licenses/by/4.0/"><p>This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY). The use, distribution or reproduction in other forums is permitted, provided the original author(s) or licensor are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is permitted which does not comply with these terms.</p></license>
</permissions>
<abstract>
<p>This work provides a novel real-time pipeline for modeling and grasping of unknown objects with a humanoid robot. Such a problem is of great interest for the robotic community, since conventional approaches fail when the shape, dimension, or pose of the objects are missing. Our approach reconstructs in real-time a model for the object under consideration and represents the robot hand both with proper and mathematically usable models, i.e., <italic>superquadric functions</italic>. The volume graspable by the hand is represented by an ellipsoid and is defined <italic>a priori</italic>, because the shape of the hand is known in advance. The superquadric representing the object is obtained in real-time from partial vision information instead, e.g., one stereo view of the object under consideration, and provides an approximated 3D full model. The optimization problem we formulate for the grasping pose computation is solved online by using the Ipopt software package and, thus, does not require off-line computation or learning. Even though our approach is for a generic humanoid robot, we developed a complete software architecture for executing this approach on the iCub humanoid robot. Together with that, we also provide a tutorial on how to use this framework. We believe that our work, together with the available code, is of a strong utility for the iCub community for three main reasons: object modeling and grasping are relevant problems for the robotic community, our code can be easily applied on every iCub, and the modular structure of our framework easily allows extensions and communications with external code.</p>
</abstract>
<kwd-group>
<kwd>grasping</kwd>
<kwd>object modeling</kwd>
<kwd>real-time optimization</kwd>
<kwd>C&#x0002B;&#x0002B;</kwd>
<kwd>superquadric functions</kwd>
</kwd-group>
<counts>
<fig-count count="3"/>
<table-count count="0"/>
<equation-count count="0"/>
<ref-count count="13"/>
<page-count count="7"/>
<word-count count="4283"/>
</counts>
</article-meta>
</front>
<body>
<sec id="S1" sec-type="introduction">
<label>1</label> <title>Introduction</title>
<p>Industrial robotics shows how high performance in manipulation can be achieved if a very accurate knowledge of the environment and the objects is provided. On the contrary, grasping of unknown objects or whose pose is uncertain is still an open problem. In this work, we present a novel framework for modeling and grasping unknown objects with the iCub humanoid robot.</p>
<p>The iCub humanoid robot is provided with two 7DOF arms, 5 fingers human-like hands, whose fingertips are covered by tactile sensors and two cameras, as described in Metta et al. (<xref ref-type="bibr" rid="B5">2010</xref>). Therefore, it turns out to be a suitable platform for investigating objects perception and grasping problem: the stereo vision system and the tactile sensors can be exploited together to get proper information for modeling and grasping unknown objects. The method and the code, we propose in this work, consist of reconstructing an object model through the stereo vision system of the robot and using this information to compute a suitable grasping pose. Once the robot reaches the desired grasping pose on the object surface, the tactile response of the fingertips is used to achieve a stable grasp for lifting the object.</p>
<p>The iCub community put a great effort into the development of a sharable and reusable code. With this work, we want to contribute in this direction, detailing the code we designed for implementing our grasping approach for a possible user interested in executing our technique on the robot.</p>
</sec>
<sec id="S2">
<label>2</label> <title>Modeling and Grasping <italic>Via</italic> Superquadric Models</title>
<p>The superquadric modeling and grasping framework we make use of is based on the idea that low-dimensional, compact, mathematical representation of objects can provide computational and theoretical advantages in hard problems tackled in robotics, such as trajectory planning for exploration, grasping and approaching toward objects. This takes inspiration from theories conceived during the 90s and 2000s (Jaklic et al., <xref ref-type="bibr" rid="B3">2013</xref>) where superquadric functions were proposed as a mathematical and low-dimensional model for representing objects.</p>
<p>In Vezzani et al. (<xref ref-type="bibr" rid="B12">2017</xref>), we proposed a novel approach that solves the grasping problem by modeling the object and the volume graspable by the hand with superquadric functions. The latter is represented by an ellipsoid and is defined <italic>a priori</italic>, because the shape of the hand is known in advance. The superquadric representing the object is obtained in real-time from partial vision information instead, e.g., one stereo view of the object under consideration, and provides an approximated 3D full model. Both the modeling and the grasping problem are cast into an optimization framework and solved in real-time with the software package Ipopt (W&#x000E4;chter and Biegler, <xref ref-type="bibr" rid="B13">2006</xref>).</p>
<p>In this article, we do not go into the mathematical details (extensively reported in Vezzani et al. (<xref ref-type="bibr" rid="B12">2017</xref>)) whereas we focus on the description of the code designed for using the approach on the iCub, since we believe it to be useful for any user interested in object modeling and grasping tasks. A brief mathematical description of the methodologies is reported in the <italic><uri xlink:href="http://README.md">README.md</uri></italic> files of the Github repositories.<xref ref-type="fn" rid="fn1"><sup>1</sup></xref></p>
</sec>
<sec id="S3">
<label>3</label> <title>Code Structure</title>
<p>We designed two modules, namely, <italic>superquadric-model</italic> and <italic>superquadric-grasp</italic>, which implement, respectively, the modeling and the grasping approached described in Vezzani et al. (<xref ref-type="bibr" rid="B12">2017</xref>).</p>
<p>Our leading idea is to develop a <italic>self-contained</italic> code that provides <italic>query services</italic> to the user. In this respect, our code handles only the information strictly necessary for the superquadric modeling and grasping approach and minimizes the dependencies from external modules. The user is asked to write a wrapper code that communicates with the two modules and makes them properly interact. In this respect, we provide a tutorial code,<xref ref-type="fn" rid="fn2"><sup>2</sup></xref> implementing a possible use case of our modules, that can be adapted by the user to fit in his own pipeline (see Section <xref ref-type="sec" rid="S3-3">3.3</xref>).</p>
<p>In the next paragraphs, we first describe the implementation of the <italic>superquadric-model</italic> and <italic>superquadric-grasp</italic> modules, which is based on the <italic>Yarp</italic> middleware (Metta et al., <xref ref-type="bibr" rid="B4">2006</xref>). Then, we outline a possible use case implementing a complete pipeline for object modeling and grasping.</p>
<sec id="S3-1">
<label>3.1</label> <title>Superquadric-Model</title>
<p>The <italic>superquadric-model</italic> module computes the superquadric function best representing the object of interest given a partial 3D point cloud of the object.</p>
<p>The module, whose structure is outlined in Figure <xref ref-type="fig" rid="F1">1</xref>, consists of the <italic>SuperqModule</italic> class, derived from the YARP <italic>RFModule</italic> class. The SuperqModule launches following two separate YARP <italic>Rate Threads</italic>:
<list list-type="bullet">
<list-item><p>the <italic>SuperqComputation</italic> class, which manages the superquadric computation;</p></list-item>
<list-item><p>the <italic>SuperqVisualization</italic> class, which can be enabled to show the estimated superquadric or the object 3D points overlapped on the camera image.</p></list-item>
</list></p>
<fig id="F1" position="float">
<label>Figure 1</label>
<caption><p>Superquadric-model code structure. The class SuperqModule, derived from the YARP RFModule class, launches two threads, respectively for superquadric computation and visualization. The class provides some thrift services to the user for interacting with the module. More detail on the <italic>user box</italic> is provided in Section <xref ref-type="sec" rid="S3-3">3.3</xref> and in Figure <xref ref-type="fig" rid="F2">2</xref>.</p></caption>
<graphic xlink:href="frobt-04-00059-g001.tif"/>
</fig>
<p>The SuperqModule also provides some <italic>Thrift IDL services</italic><xref ref-type="fn" rid="fn3"><sup>3</sup></xref> suitable for getting information on the internal state of the module and setting the thread parameters on the fly. <italic>Thrift</italic> is a software framework for scalable cross-language development, which allows to build services working efficiently with different programming languages.</p>
<p>While there are two threads to decouple the functionalities of computation and visualization, the threads share some variables (in particular the computed superquadric) to increase their speed.</p>
<sec id="S3-1-1">
<label>3.1.1</label> <title>SuperqComputation</title>
<p>The <italic>SuperqComputation</italic> thread includes the following steps:
<list list-type="bullet">
<list-item><p>Once the object point cloud is provided (see Section <xref ref-type="sec" rid="S3-3">3.3</xref> for a detailed description of how extract the object point cloud), the superquadric is estimated by using Ipopt (W&#x000E4;chter and Biegler, <xref ref-type="bibr" rid="B13">2006</xref>), a C&#x0002B;&#x0002B; software package for large-scale nonlinear optimization. The user can formulate its own optimization problem with the Ipopt C&#x0002B;&#x0002B; interface<xref ref-type="fn" rid="fn4"><sup>4</sup></xref> and, then, solve it through the Ipopt solver.</p></list-item>
<list-item><p>A median filter with an adaptive window of width <italic>m</italic> can be enabled to stabilize the estimated superquadric over the time. Even if the object is not supposed to move during a grasping task, it may happen that the user, or anyone interacting with the robot, moves the object in a different location. In this case, the superquadric modeler should be able to track the object and the estimated superquadric should not be affected by previous estimations in different poses. For this reason, the window width of the median filter changes according to the object velocity. If the object location changes (i.e., its velocity increases), the window width becomes smaller. On the contrary, if the object is not moved, the window width can be increased. In this way, when the object pose is constant, its superquadric estimation is more stable and accurate, while it is not affected by past estimations if the object pose changes. The median filter and the object velocity estimation are achieved by using, respectively, the <italic>iCub MedianFilter Class</italic> and the <italic>iCub AWLinEstimator Class</italic>.</p></list-item>
<list-item><p>If prior information is available on the object shape (e.g., given by a classifier or a vision recognition system), the module can use it to speed up the superquadric estimation. Particularly, if the object is labeled as <italic>cylinder, box</italic> or <italic>sphere</italic>, specific constraints can be used for improving the accuracy and reducing the execution time of the optimization problem.</p></list-item>
</list></p>
<p>The user can communicate with the <italic>SuperqComputation</italic> thread, through the <italic>SuperqModule</italic>, in the two different modes:
<list list-type="bullet">
<list-item><p>In <bold>streaming mode</bold>&#x02014;the 3D point cloud of the object should be sent to the module through a YARP <italic>Buffered port</italic> as a YARP <italic>Property</italic>. The user can access the current estimated superquadric through a dedicated YARP <italic>Buffered port</italic> as a YARP <italic>Property</italic>, where the main components of the superquadric are grouped as: <italic>dimensions, exponents, center</italic>, and <italic>orientation</italic>.</p></list-item>
<list-item><p>In <bold>one-shot mode</bold>&#x02014;the user can ask the module to compute the object superquadric by sending a single point cloud through a YARP <italic>RpcClient Port</italic> and getting a YARP <italic>Property</italic> including the estimated superquadric parameters as reply. In case the user asks for the superquadric filtered by the median filter, he should send a set of point clouds of the object in the same pose.</p></list-item>
</list></p>
<p>The superquadric computation, together with the superquadric filtering process, takes 0.1&#x02009;s in average on Intel<sup>&#x000AE;</sup>Core&#x02122; i7-4710MQ Processor &#x00040;2.50&#x02009;GHz. This values is compatible with our real-time requirements.</p>
</sec>
<sec id="S3-1-2">
<label>3.1.2</label> <title>SuperqVisualization</title>
<p>The visualization thread overlaps the estimated superquadric or the 3D points used by the optimizer on the camera image, for real-time visual inspection by the user (see Figure <xref ref-type="fig" rid="F3">3</xref> (4)). The average visualization time is equal to 0.01&#x02009;s and can be enable or disabled by the user while the <italic>SuperqModule</italic> is running.</p>
</sec>
</sec>
<sec id="S3-2">
<label>3.2</label> <title>Superquadric-Grasping</title>
<p>The <italic>superquadric-grasp</italic> module implements the approach proposed in Vezzani et al. (<xref ref-type="bibr" rid="B12">2017</xref>) for the computation of grasping poses by using a superquadric modeling the object.</p>
<p>The <italic>superquadric-grasp</italic> module consists of the <italic>GraspModule class</italic>, derived from the YARP <italic>RFModule class</italic>. The <italic>GraspModule</italic> splits pose computation and visualization and grasp execution in three different classes:
<list list-type="bullet">
<list-item><p><italic>GraspComputation class</italic>, computing the pose for grasping the object;</p></list-item>
<list-item><p><italic>GraspVisualization class</italic>, showing the object model and the main information about the computed poses;</p></list-item>
<list-item><p><italic>GraspExecution class</italic>, which allows executing the grasping task once the pose is computed and one of the robot hand is selected.</p></list-item>
</list></p>
<p>As for the <italic>superquadric-model</italic> module, the <italic>superquadric-grasp</italic> implementation provides several <italic>Thrfit IDL services</italic> to the user to interact with the module and for getting information on the state of the module. The <italic>superquadric-grasp</italic> module structure is similar to the <italic>superquadric-model</italic> one, shown in Figure <xref ref-type="fig" rid="F1">1</xref>.</p>
<sec id="S3-2-1">
<label>3.2.1</label> <title>GraspComputation</title>
<p>This class handles the pose candidates&#x02019; computation:
<list list-type="bullet">
<list-item><p>Given the superquadric modeling the object, received as a YARP <italic>Property</italic> (see <xref ref-type="sec" rid="S3-1-1">3.1.1</xref>), the grasping poses for one or both the hands (according to the user query) are computed together with a suitable trajectory by using the method proposed in Vezzani et al. (<xref ref-type="bibr" rid="B12">2017</xref>). The optimization problem is formulated and solved through the Ipopt C&#x0002B;&#x0002B; interface.</p></list-item>
<list-item><p>The user can exploit some prior information for adapting the grasp computation to the desired scenario. In particular, the user can provide the module the height of the support on which the object is located (i.e., a table) to prevent the robot hand from hitting it. In addition, the constraints about the final hand pose can be modified according to the experimental scenario. For instance, the user can define the robot workspace by simply varying the variable upper and lower bounds of the optimization problem from the configuration files.</p></list-item>
</list></p>
<p>The pose computation process takes 2.0&#x02009;s in average, which is consistent with the time requirements of a grasp task execution.</p>
</sec>
<sec id="S3-2-2">
<label>3.2.2</label> <title>GraspExecution</title>
<p>The <italic>GraspExecution class</italic> controls the arm movements to accomplish the grasping task. In particular:
<list list-type="bullet">
<list-item><p>The approaching step, i.e., the pose reaching through the trajectory waypoints, is executed through the YARP <italic>Cartesian Interface</italic> (Pattacini et al., <xref ref-type="bibr" rid="B9">2010</xref>);</p></list-item>
<list-item><p>Once the final pose is reached, the grasp is executed by using a precision grasp method described in Regoli et al. (<xref ref-type="bibr" rid="B10">2016</xref>) and available in the <italic>Tactile Control library</italic>.<xref ref-type="fn" rid="fn5"><sup>5</sup></xref> The hand fingers close until the tactile sensors on the fingertips detect contact. Then, each finger is controlled to find a stable grasp for the object. Alternatively, the grasp can be performed by simply closing the fingers until a minimum pressure of the fingertips is measured. However, such an approach does not guarantee stability while lifting the object.</p></list-item>
</list></p>
</sec>
<sec id="S3-2-3">
<label>3.2.3</label> <title>GraspVisualization</title>
<p>The visualization thread overlaps the computed poses and the received object superquadric on the camera image, for real-time visual inspection by the user (see Figure <xref ref-type="fig" rid="F3">3</xref> (5)). Some additional information, such as the volume graspable by the hand and the trajectory waypoints can be shown at the same time.</p>
</sec>
<sec id="S3-2-4">
<label>3.2.4</label> <title>Communication with the Module</title>
<p>Unlike the <italic>superquadric-model</italic> framework, the user can communicate with the <italic>GraspModule</italic> only in <bold>one-shot mode</bold>. In particular, the user can query the module to:
<list list-type="bullet">
<list-item><p>Compute the grasping poses and approaching trajectory, providing to the module the estimated superquadric of the object as a <italic>Yarp Property</italic> (as described in 3.1.1) and selecting one or both the hands. The solutions are given back to the user as a <italic>Yarp Property</italic>.</p></list-item>
<list-item><p>Ask the robot to reach the final pose and grasp the object by selecting one robot hand. In the current code implementation, the robot performs a simple lifting test to check the stability of the grasp.</p></list-item>
</list></p>
<p>The additional <italic>thrift services</italic> allows setting on the fly parameters for grasp computation, visualization, and execution.</p>
</sec>
</sec>
<sec id="S3-3">
<label>3.3</label> <title>How to Use the Superquadric Framework</title>
<p>To use our grasping approach, the user is supposed to design a wrapper code to combine together the outcomes of the <italic>superquadric-model</italic> and <italic>superquadric-grasp</italic> modules. In addition, the implementation of a complete modeling and grasping pipeline requires the use of external modules for point cloud computation. We provide a tutorial code, which takes advantage of modules developed by the iCub community to achieve the modeling and grasping task. Hereafter, we report the main steps of the complete pipeline. The entire commented code is available on Github,<xref ref-type="fn" rid="fn6"><sup>6</sup></xref> together with a detail description on how to run the code in the <italic><uri xlink:href="http://README.md">README.md</uri></italic> file.
<list list-type="order">
<list-item><p>The object is labeled with a name through a recognition system.<xref ref-type="fn" rid="fn7"><sup>7</sup></xref> The object label, together with information on its 2D bounding box, are stored by the <italic>Object Property Collector</italic><xref ref-type="fn" rid="fn8"><sup>8</sup></xref> (Moulin-Frier et al., <xref ref-type="bibr" rid="B6">2017</xref>). The wrapper code is given the object name by the user (through a <italic>RpcPort</italic>) and uses it for asking the object property collector for the relative 2D bounding box.</p></list-item>
<list-item><p>The 2D blob of the object is computed by the <italic>lbpExtract module</italic>, once it is provided with the bounding box information. This uses Local Binary Pattern (LBP) (Ojala et al., <xref ref-type="bibr" rid="B7">1996</xref>) to analyze the texture of what is in the robot view (a table in our experimental scenario). This texture is used for getting a general blob information both as an image, containing general white blobs of where the objects are, and as a <italic>Yarp Bottle</italic> containing lists of bounding box points. Then, the general blob information allow using grabCut algorithm (Rother et al., <xref ref-type="bibr" rid="B11">2004</xref>) to properly segment all the objects on the table.</p></list-item>
<list-item><p>Given the 2D blob, the wrapper code reconstructs the 3D point cloud by querying the <italic>Structure from Motion module</italic> (Fanello et al., <xref ref-type="bibr" rid="B1">2014</xref>). This module uses a complete Structure From Motion (SFM) pipeline for the computation of the extrinsics parameters between two different views. These parameters are then used to rectify the images and to compute a depth map.</p></list-item>
<list-item><p>Then, the wrapper code asks the <italic>superquadric-model</italic> to estimate the superquadric modeling the object by sending the acquired point cloud to the module.</p>
<p><preformat><monospace>Bottle cmd, superq_bottle;</monospace></preformat></p>
<p><preformat><monospace><italic>//Fill the Bottle for querying superquadric-model</italic>.</monospace></preformat></p>
<p><preformat><monospace>cmd.addString(&#x0201C;get_superq&#x0201D;);</monospace></preformat></p>
<p><preformat><monospace>Bottle &#x00026;bottle_point&#x02009;&#x0003D;&#x02009;cmd.addList();</monospace></preformat></p>
<p><preformat><monospace>for (size_t i&#x02009;&#x0003D;&#x02009;0; i&#x02009;&#x0003C;&#x02009;points.size(); i&#x0002B;&#x0002B;)</monospace></preformat></p>
<p><preformat><monospace>{</monospace></preformat></p>
<p><preformat><monospace>Bottle &#x00026;in&#x02009;&#x0003D;&#x02009;bottle_point.addList();</monospace></preformat></p>
<p><preformat><monospace>in.addDouble(points[i][0]);</monospace></preformat></p>
<p><preformat><monospace>in.addDouble(points[i][1]);</monospace></preformat></p>
<p><preformat><monospace>in.addDouble(points[i][2]);</monospace></preformat></p>
<p><preformat><monospace>}</monospace></preformat></p>
<p><preformat><monospace>superqRpc.write(cmd, superq_bottle);</monospace></preformat></p>
<p><preformat><monospace><italic>//Then, extract the estimated superquadric from the Bottle superq_bottle</italic>.</monospace></preformat></p>
</list-item>
<list-item><p>Once the superquadric is estimated, the user code asks the <italic>superquadric-grasp</italic> module to compute pose candidates for grasping the object.</p>
<p><preformat><monospace>Bottle cmd, reply;</monospace></preformat></p>
<p><preformat><monospace><italic>//Fill the Bottle for querying superquadric-grasp</italic>.</monospace></preformat></p>
<p><preformat><monospace>cmd.addString(&#x0201C;get_grasping_pose&#x0201D;);</monospace></preformat></p>
<p><preformat><monospace><italic>//hand_for_computation can be &#x0201C;right&#x0201C;, &#x0201C;left&#x0201D; or &#x0201C;both&#x0201D;</italic></monospace></preformat></p>
<p><preformat><monospace>cmd.addString(hand_for_computation);</monospace></preformat></p>
<p><preformat><monospace>graspRpc.write(cmd, reply);</monospace></preformat></p>
<p><preformat><monospace><italic>//Then, extract the grasping pose candidate from the Bottle reply</italic>.</monospace></preformat></p>
</list-item>
<list-item><p>Finally, the user can ask the <italic>superquadric-grasp</italic> to perform the grasping task.</p>
<p><preformat><monospace>Bottle cmd, reply;</monospace></preformat></p>
<p><preformat><monospace><italic>//Fill the Bottle for moving the arm</italic>.</monospace></preformat></p>
<p><preformat><monospace>cmd.addString(&#x0201C;move&#x0201D;);</monospace></preformat></p>
<p><preformat><monospace>cmd.addString(hand_for_moving);</monospace></preformat></p>
<p><preformat><monospace>graspRpc.write(cmd, reply);</monospace></preformat></p>
<p><preformat><monospace><italic>//The grasp is executed</italic>.</monospace></preformat></p>
</list-item>
</list></p>
<p>Figure <xref ref-type="fig" rid="F2">2</xref> outlines the structure of the entire pipeline, following the steps described in this section. In Figure <xref ref-type="fig" rid="F3">3</xref>, we show some typical outcomes of all the steps described above. In addition, in the <italic><uri xlink:href="http://README.md">README.md</uri></italic> files of the superquadric-model and superquadric-grasp repository, we provide two videos of the execution of the modeling and the grasping pipeline.<xref ref-type="fn" rid="fn9"><sup>9</sup></xref></p>
<fig id="F2" position="float">
<label>Figure 2</label>
<caption><p>Modules communication for the implementation of the modeling and grasping pipeline. The wrapper code manages the interaction between external modules and the <italic>superquadric-model</italic> and <italic>superquadric-grasp</italic> frameworks. Pipeline steps enumerated as in Section <xref ref-type="sec" rid="S3">3</xref>: (1) The wrapper code asks the object property collector for the bounding box information of the object. (2) Given that, lbpExtract module provides the 2D blob of the object. (3) The wrapper code sends the 2D blob of the object to the Structure From Motion module for getting the relative 3D point cloud. (4) The 3D point cloud is then sent to the <italic>superquadric-model</italic> for computing the superquadric modeling the object. (5) The wrapper code sends the estimated superquadric to the <italic>superquadric-grasp</italic> module, which computes suitable poses. (6) Finally, the <italic>superquadric-grasp</italic> is asked to perform the grasping task.</p></caption>
<graphic xlink:href="frobt-04-00059-g002.tif"/>
</fig>
<fig id="F3" position="float">
<label>Figure 3</label>
<caption><p>Outcomes of the modeling and grasping pipeline. (1) The object is stored by the object property collector with the label <italic>object</italic>. (2) LbpExtract provides the 2D blob of the object. (3) The 3D point cloud is extracted from the disparity map, by querying the Structure From Motion module. (4) The superquadric modeling the object is reconstructed. (5) The grasping pose and approaching trajectory for the right hand are computed. (6) The robot grasps the object. (Steps (1), (2), (4), and (5) are represented by screenshots from the visualizers.).</p></caption>
<graphic xlink:href="frobt-04-00059-g003.tif"/>
</fig>
</sec>
</sec>
<sec id="S4">
<label>4</label> <title>Known Issues</title>
<p>In this section, we report the limitations of our approach, together with possible solutions for facing them.
<list list-type="bullet">
<list-item><p>Our approach is currently an open-loop approach. Once the object model and the grasping pose are computed, the robot reaches for the final pose without checking if the object pose changes. However, we could monitor the object pose, by estimating only the pose of the reconstructed superquadric - leaving its shape unchanged - with new point clouds while the robot is moving and until the object is in the robot field of view. This is a viable solution since our modeling approach is compatible with real-time requirements (as shown in Section <xref ref-type="sec" rid="S3-1">3.1</xref>).</p></list-item>
<list-item><p>A further limitation caused by the open-loop nature of our approach is the missing compensation of errors between the robot stereo vision and system. To properly run the grasping pipeline, the user is required to properly calibrate the vision and the robot kinematics. In case errors between the two are still a problem for grasping the object, empirical offsets can be added for compensating for the errors. More information are provided in the <italic><uri xlink:href="http://README.md">README.md</uri></italic> of the superquadric-grasp repository.</p></list-item>
<list-item><p>A quite strong limitation of our approach is that it cannot automatically distinguish between good and wrong poses. For this reason, the user need to supervise the entire process and ask for a new model and pose in case the current outcome is not suitable for grasping the objects. In particular, this problem arises when the object cannot be represented with a single superquadric for its geometric shape. As future work, we aim at extend our approach for modeling more complex objects with multiple superquadrics.</p></list-item>
</list></p>
</sec>
<sec id="S5">
<label>5</label> <title>Conclusion</title>
<p>In this work, we detail the implementation of the modeling and grasping approach pipeline described in Vezzani et al. (<xref ref-type="bibr" rid="B12">2017</xref>). We developed two modules, namely <italic>superquadric-model</italic> and <italic>superquadric-grasp</italic>, that respectively model objects through superquadric functions and computes suitable grasping poses for the iCub robot. Our leading idea was to develop a self-contained code that provides query services to the user. Our software handles only the information strictly necessary for the modeling and grasping approach and minimizes the dependencies from external modules. The user is supposed to design a wrapper code to combine together the outcomes of the two modules. We provide also an example of a external code in the <italic>superquadric-grasp-example</italic> repository for the implementation of a complete modeling and grasping pipeline.</p>
<p>In the next future, we would like to improve the approach we use for reaching the final grasping pose, which is a current limitation of our approach, as described in Section <xref ref-type="sec" rid="S4">4</xref>. The iCub proprioception is in fact affected by a number of impairments, mainly caused by elastic elements, which introduce errors in the computation of direct kinematics. Also, the iCub is provided with moving cameras for simulating the human oculomotor system. This makes the knowledge of extrinsic parameters and, thus, the object information estimation quite noisy. These sources of error might be crucial for grasping tasks, when a final pose is required to be reached with errors in order of 1&#x02009;cm. We can solve this problem by using the approach described in Fantacci et al. (<xref ref-type="bibr" rid="B2">2017</xref>), which provides a precise estimate of the robot end-effector pose over time and a visual servoing approach without the use of markers. Another extension of the modeling pipeline consists in using the recognition system<xref ref-type="fn" rid="fn10"><sup>10</sup></xref> described in Pasquale et al. (<xref ref-type="bibr" rid="B8">2016</xref>) to classify the objects of interest according to their geometric property for using some prior information on their shape for improving and speeding up the superquadric estimation process, as mentioned in 3.1.1.</p>
</sec>
<sec id="S6" sec-type="author-contributor">
<title>Author Contributions</title>
<p>GV developed the method and the code and described them in the manuscript. LN supervised the code and method development and the manuscript writing.</p>
</sec>
<sec id="S7">
<title>Conflict of Interest Statement</title>
<p>The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest. The reviewer, TF, and handling editor declared their shared affiliation.</p>
</sec>
</body>
<back>
<ref-list>
<title>References</title>
<ref id="B1"><citation citation-type="confproc"><person-group person-group-type="author"><name><surname>Fanello</surname> <given-names>S. R.</given-names></name> <name><surname>Pattacini</surname> <given-names>U.</given-names></name> <name><surname>Gori</surname> <given-names>I.</given-names></name> <name><surname>Tikhanoff</surname> <given-names>V.</given-names></name> <name><surname>Randazzo</surname> <given-names>M.</given-names></name> <name><surname>Roncone</surname> <given-names>A.</given-names></name> <etal/></person-group> (<year>2014</year>). <article-title>&#x0201C;3D stereo estimation and fully automated learning of eye-hand coordination in humanoid robots,&#x0201D;</article-title> in <conf-name>2014 14th IEEE-RAS International Conference on Humanoid Robots (Humanoids)</conf-name> (<conf-loc>Madrid, Spain</conf-loc>: <conf-sponsor>IEEE</conf-sponsor>), <fpage>1028</fpage>&#x02013;<lpage>1035</lpage>.</citation></ref>
<ref id="B2"><citation citation-type="confproc"><person-group person-group-type="author"><name><surname>Fantacci</surname> <given-names>C.</given-names></name> <name><surname>Pattacini</surname> <given-names>U.</given-names></name> <name><surname>Tikhanoff</surname> <given-names>V.</given-names></name> <name><surname>Natale</surname> <given-names>L.</given-names></name></person-group> (<year>2017</year>). <article-title>&#x0201C;Visual end-effector tracking using a 3D model-aided particle filter for humanoid robot platforms,&#x0201D;</article-title> in <conf-name>IEEE Conference on Intelligent Robots and Systems (IROS)</conf-name> (<conf-loc>Vancouver, Canada</conf-loc>: <conf-sponsor>IEEE</conf-sponsor>).</citation></ref>
<ref id="B3"><citation citation-type="book"><person-group person-group-type="author"><name><surname>Jaklic</surname> <given-names>A.</given-names></name> <name><surname>Leonardis</surname> <given-names>A.</given-names></name> <name><surname>Solina</surname> <given-names>F.</given-names></name></person-group> (<year>2013</year>). <source>Segmentation and Recovery of Superquadrics</source>, Vol. <volume>20</volume>. <publisher-name>Springer Science &#x00026; Business Media</publisher-name>.</citation></ref>
<ref id="B4"><citation citation-type="journal"><person-group person-group-type="author"><name><surname>Metta</surname> <given-names>G.</given-names></name> <name><surname>Fitzpatrick</surname> <given-names>P.</given-names></name> <name><surname>Natale</surname> <given-names>L.</given-names></name></person-group> (<year>2006</year>). <article-title>YARP: yet another robot platform</article-title>. <source>Int. J. Adv. Robot. Syst.</source> <volume>3</volume>, <fpage>8</fpage>.<pub-id pub-id-type="doi">10.5772/5761</pub-id></citation></ref>
<ref id="B5"><citation citation-type="journal"><person-group person-group-type="author"><name><surname>Metta</surname> <given-names>G.</given-names></name> <name><surname>Natale</surname> <given-names>L.</given-names></name> <name><surname>Nori</surname> <given-names>F.</given-names></name> <name><surname>Sandini</surname> <given-names>G.</given-names></name> <name><surname>Vernon</surname> <given-names>D.</given-names></name> <name><surname>Fadiga</surname> <given-names>L.</given-names></name> <etal/></person-group> (<year>2010</year>). <article-title>The iCub humanoid robot: an open-systems platform for research in cognitive development</article-title>. <source>Neural Netw.</source> <volume>23</volume>, <fpage>1125</fpage>&#x02013;<lpage>1134</lpage>.<pub-id pub-id-type="doi">10.1016/j.neunet.2010.08.010</pub-id><pub-id pub-id-type="pmid">20864311</pub-id></citation></ref>
<ref id="B6"><citation citation-type="journal"><person-group person-group-type="author"><name><surname>Moulin-Frier</surname> <given-names>C.</given-names></name> <name><surname>Fischer</surname> <given-names>T.</given-names></name> <name><surname>Petit</surname> <given-names>M.</given-names></name> <name><surname>Pointeau</surname> <given-names>G.</given-names></name> <name><surname>Puigbo</surname> <given-names>J.</given-names></name> <name><surname>Pattacini</surname> <given-names>U.</given-names></name> <etal/></person-group> (<year>2017</year>). <article-title>Dac-h3: a proactive robot cognitive architecture to acquire and express knowledge about the world and the self</article-title>. <source>IEEE Trans. Cogn. Dev. Syst.</source><pub-id pub-id-type="doi">10.1109/TCDS.2017.2754143</pub-id></citation></ref>
<ref id="B7"><citation citation-type="journal"><person-group person-group-type="author"><name><surname>Ojala</surname> <given-names>T.</given-names></name> <name><surname>Pietik&#x000E4;inen</surname> <given-names>M.</given-names></name> <name><surname>Harwood</surname> <given-names>D.</given-names></name></person-group> (<year>1996</year>). <article-title>A comparative study of texture measures with classification based on featured distributions</article-title>. <source>Pattern Recognit.</source> <volume>29</volume>, <fpage>51</fpage>&#x02013;<lpage>59</lpage>.<pub-id pub-id-type="doi">10.1016/0031-3203(95)00067-4</pub-id></citation></ref>
<ref id="B8"><citation citation-type="confproc"><person-group person-group-type="author"><name><surname>Pasquale</surname> <given-names>G.</given-names></name> <name><surname>Ciliberto</surname> <given-names>C.</given-names></name> <name><surname>Rosasco</surname> <given-names>L.</given-names></name> <name><surname>Natale</surname> <given-names>L.</given-names></name></person-group> (<year>2016</year>). <article-title>&#x0201C;Object identification from few examples by improving the invariance of a deep convolutional neural network,&#x0201D;</article-title> in <conf-name>2016 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS)</conf-name> (<conf-loc>Deajeon, South Korea</conf-loc>: <conf-sponsor>IEEE</conf-sponsor>), <fpage>4904</fpage>&#x02013;<lpage>4911</lpage>.</citation></ref>
<ref id="B9"><citation citation-type="confproc"><person-group person-group-type="author"><name><surname>Pattacini</surname> <given-names>U.</given-names></name> <name><surname>Nori</surname> <given-names>F.</given-names></name> <name><surname>Natale</surname> <given-names>L.</given-names></name> <name><surname>Metta</surname> <given-names>G.</given-names></name> <name><surname>Sandini</surname> <given-names>G.</given-names></name></person-group> (<year>2010</year>). <article-title>&#x0201C;An experimental evaluation of a novel minimum-jerk Cartesian controller for humanoid robots,&#x0201D;</article-title> in <conf-name>2010 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS)</conf-name> (<conf-loc>Taipei, Taiwan</conf-loc>: <conf-sponsor>IEEE</conf-sponsor>), <fpage>1668</fpage>&#x02013;<lpage>1674</lpage>.</citation></ref>
<ref id="B10"><citation citation-type="confproc"><person-group person-group-type="author"><name><surname>Regoli</surname> <given-names>M.</given-names></name> <name><surname>Pattacini</surname> <given-names>U.</given-names></name> <name><surname>Metta</surname> <given-names>G.</given-names></name> <name><surname>Natale</surname> <given-names>L.</given-names></name></person-group> (<year>2016</year>). <article-title>&#x0201C;Hierarchical grasp controller using tactile feedback,&#x0201D;</article-title> in <conf-name>IEEE-RAS 16th International Conference on Humanoid Robots (Humanoids)</conf-name> (<conf-loc>Cancun, Mexico</conf-loc>: <conf-sponsor>IEEE</conf-sponsor>), <fpage>387</fpage>&#x02013;<lpage>394</lpage>.</citation></ref>
<ref id="B11"><citation citation-type="journal"><person-group person-group-type="author"><name><surname>Rother</surname> <given-names>C.</given-names></name> <name><surname>Kolmogorov</surname> <given-names>V.</given-names></name> <name><surname>Blake</surname> <given-names>A.</given-names></name></person-group> (<year>2004</year>). <article-title>Grabcut: interactive foreground extraction using iterated graph cuts</article-title>. <source>ACM Trans. Graph.</source> <volume>23</volume>, <fpage>309</fpage>&#x02013;<lpage>314</lpage>.<pub-id pub-id-type="doi">10.1145/1015706.1015720</pub-id></citation></ref>
<ref id="B12"><citation citation-type="confproc"><person-group person-group-type="author"><name><surname>Vezzani</surname> <given-names>G.</given-names></name> <name><surname>Pattacini</surname> <given-names>U.</given-names></name> <name><surname>Natale</surname> <given-names>L.</given-names></name></person-group> (<year>2017</year>). <article-title>&#x0201C;A grasping approach based on superquadric models,&#x0201D;</article-title> in <conf-name>IEEE International Conference on Robotics and Automation (ICRA)</conf-name> (<conf-loc>Singapore</conf-loc>), <fpage>1579</fpage>&#x02013;<lpage>1586</lpage>.</citation></ref>
<ref id="B13"><citation citation-type="journal"><person-group person-group-type="author"><name><surname>W&#x000E4;chter</surname> <given-names>A.</given-names></name> <name><surname>Biegler</surname> <given-names>L.</given-names></name></person-group> (<year>2006</year>). <article-title>On the implementation of an interior-point filter line-search algorithm for large-scale nonlinear programming</article-title>. <source>Math. Program.</source> <volume>106</volume>, <fpage>25</fpage>&#x02013;<lpage>57</lpage>.<pub-id pub-id-type="doi">10.1007/s10107-004-0559-y</pub-id></citation></ref>
</ref-list>
<fn-group>
<fn id="fn1"><p><sup>1</sup><uri xlink:href="https://github.com/robotology/superquadric-model">https://github.com/robotology/superquadric-model</uri>, <uri xlink:href="https://github.com/robotology/superquadric-grasp">https://github.com/robotology/superquadric-grasp</uri>.</p></fn>
<fn id="fn2"><p><sup>2</sup><uri xlink:href="https://github.com/robotology/superquadric-grasp-example">https://github.com/robotology/superquadric-grasp-example</uri>.</p></fn>
<fn id="fn3"><p><sup>3</sup><uri xlink:href="https://thrift.apache.org/docs/idl">https://thrift.apache.org/docs/idl</uri>.</p></fn>
<fn id="fn4"><p><sup>4</sup><uri xlink:href="https://www.coin-or.org/Ipopt/documentation/node23.html">https://www.coin-or.org/Ipopt/documentation/node23.html</uri>.</p></fn>
<fn id="fn5"><p><sup>5</sup><uri xlink:href="https://github.com/robotology/tactile-control">https://github.com/robotology/tactile-control</uri>.</p></fn>
<fn id="fn6"><p><sup>6</sup><uri xlink:href="https://github.com/robotology/superquadric-grasp-example">https://github.com/robotology/superquadric-grasp-example</uri>.</p></fn>
<fn id="fn7"><p><sup>7</sup><uri xlink:href="https://github.com/robotology/iol/tree/master/src/himrepClassifier">https://github.com/robotology/iol/tree/master/src/himrepClassifier</uri>.</p></fn>
<fn id="fn8"><p><sup>8</sup><uri xlink:href="https://github.com/robotology/icub-main/tree/master/src/modules/objectsPropertiesCollector">https://github.com/robotology/icub-main/tree/master/src/modules/objectsPropertiesCollector</uri>.</p></fn>
<fn id="fn9"><p><sup>9</sup>superquadric-model demo: <uri xlink:href="https://www.youtube.com/watch?v&#x0003D;MViX4Ppo4WQ&#x00026;feature&#x0003D;youtube">https://www.youtube.com/watch?v&#x0003D;MViX4Ppo4WQ&#x00026;feature&#x0003D;youtube</uri>. superquadric-grasp demo: <uri xlink:href="https://www.youtube.com/watch?v&#x0003D;eGZO8peAVao">https://www.youtube.com/watch?v&#x0003D;eGZO8peAVao</uri>.</p></fn>
<fn id="fn10"><p><sup>10</sup><uri xlink:href="https://github.com/robotology/onthefly-recognition">https://github.com/robotology/onthefly-recognition</uri>.</p></fn>
</fn-group>
</back>
</article>