Difference between revisions of "D4C Framework"

From Wiki for iCub and Friends
Jump to: navigation, search
(The Code)
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Theoretical Background =
+
REDIRECT [https://github.com/robotology/d4c D4C on GitHub]
 
 
The Pmp library is based on the idea of employing virtual force field in order to perform a reaching task. It takes inspiration from theories conceived by Oussama Khatib durig 80's (Oussama Khatib, '''Real-time obstacle avoidance for manipulators and mobile robots''', Int. J. Rob. Res., Vol. 5, No. 1. (1986), pp. 90-98) and revised by Vishwanathan Mohan (Mohan. V., Morasso P.,Metta G., Sandini G. '''A biomimetic, force-field based computational model for motion planning and bimanual coordination in humanoid robots''', Autonomous Robots, Volume 27, Issue 3, (2009) pp. 291-301). We have developed a different version of pmp which, instead of using the transposed Jacobian, employs the Cartesian Interface; indeed, it automatically takes into account iCub's joints limits and it makes the generated trajectory smooth. The pmp library allows to describe objects as obstacles or as targets, and to consequently build a virtual force field to reach the target avoiding obstacles. For the target a mass-spring-damper force field is generated
 
 
 
[[Image:MassSpringDump.jpg]]
 
 
 
Each obstacle is modeled as a Gaussian repulsive force field. It is possible to choose between a canonical multivariate Gaussian force field
 
 
 
[[Image:GaussianForceField.jpg]]
 
 
 
and a Gaussian force field without tails
 
 
 
[[Image:GaussianWithoutTails.jpg]]
 
 
 
Since the tuning of the parameters is a critical point, we’re going to implement some further methods in order to avoid local minima.
 
 
 
== MATLAB Models ==
 
 
 
Many tests with the following Simulink model have been performed
 
 
 
[[Image:SimulinkModel.jpg]]
 
 
 
It allows you to modify parameters and to compute easily the virtual trajectory generated from the combination of the virtual force fields associated to target and obstacles. It is also possible to add a Gaussian attractor on the target which will be summed to the mass-spring-damper force field.
 
 
 
[[Image:WithAndWithoutTails.jpg|frame|left|Obstacles modeled as Gaussians with tails in the first image, and without tails in the second]]
 
 
 
<br style="clear: both" />
 
As it is possible to notice from the figure, local minima can be reached. These situations can be avoided with the method explained in
 
*Randazzo M., Sgorbissa A. and Zaccaria R. '''µNav: Navigation without localization''', .
 
 
 
[[Image:LocalMinima.jpg|frame|left|In the first case the trajectory stops in a local minima, in the second case the trajectory bypass the obstacles correctly]]
 
 
 
<br style="clear: both" />
 
It is possible to download the two MATLAB models (the one without methods for local minima, and the other one with methods for local minima) from [[media:PmpModels.zip | here]].
 
 
 
= The Cartesian I/F Implementation =
 
 
 
The pmp library exploits the [http://eris.liralab.it/iCub/main/dox/html/icub_cartesian_interface.html Cartesian Interface], and it is built as follow
 
 
 
[[Image:Architecture.jpg|center]]
 
 
 
There is a server, with the aim to instantiate, modify or delete objects, generate force fields and compute the trajectory, which is transmitted to the Cartesian Interface. Then there is a client which is automatically connected to the server and that can send a request in order to have information on objects, or can ask to add or delete objects.
 
 
 
Notably, the pmp server is capable of sending proper information to the [http://eris.liralab.it/iCub/main/dox/html/group__icub__gui.html iCubGui] in order to display a pictorial representation of the set of targets, obstacles and generated trajectories as depicted below.
 
 
 
[[Image:iCubGuiPmp.jpg|center]]
 
 
 
== The Code ==
 
In order to use the Pmp Library it is required to add the Cartesian Interface to the ''CMakeLists.txt'' file. It is possible to do it by following the [http://eris.liralab.it/iCub/main/dox/html/icub_cartesian_interface.html Cartesian Interface Tutorial]. It is also required to include in the ''CMakeLists.txt'' the following line:
 
 
 
target_link_libraries(${PROJECTNAME} ${YARP_LIBRARIES} pmp)
 
 
 
In order to open a pmp_server:
 
 
 
...
 
#include <iCub/pmp/pmp_server.h>
 
...
 
PmpServer server;
 
Property options;
 
options.put("verbosity",0); //print log messages
 
options.put("period",20); //period of the RateThread
 
options.put("device","cartesiancontrollerclient");
 
options.put("name","pmp_server");
 
options.put("robot","icub");
 
options.put("part","right_arm");       
 
server.open(options);
 
 
 
In order to open a pmp_client:
 
 
 
...
 
#include <iCub/pmp/pmp_client.h>
 
...
 
PmpClient client;
 
Property options;
 
options.put("verbosity",0);
 
options.put("remote","/pmp_server");
 
options.put("local","/pmp_client");
 
client.open(options);
 
 
 
In order to add an obstacle:
 
 
 
Value centerOb; centerOb.fromString(("(0.2 0.2 0.2)");
 
Value radiusOb; radiusOb.fromString("(0.05 0.1 0.05)");
 
Property obstacleOpt;
 
obstacleOpt.put("type","obstacle_gaussian");
 
obstacleOpt.put("active","on");
 
obstacleOpt.put("G",5.0);
 
obstacleOpt.put("name","obstacle");
 
obstacleOpt.put("center",centerOb);
 
obstacleOpt.put("radius",radiusOb);
 
int obstacle; client.addItem(obstacleOpt,obstacle);
 
 
 
In order to add a target:
 
 
 
Value centerTg; centerTg.fromString(("(0.4 0.4 0.4)");
 
Value radiusTg; radiusTg.fromString("(0.05 0.05 0.05)");
 
Property targetOpt;
 
targetOpt.put("type","target_msd");
 
targetOpt.put("active","on");
 
targetOpt.put("K",1.5);
 
targetOpt.put("D",3.0);
 
targetOpt.put("name","target");
 
targetOpt.put("center",centerTg);
 
targetOpt.put("radius",radiusTg);
 
int target; client.addItem(targetOpt,target);
 
 
 
In order to make the trajectory start from a specific point with a given initial velocity it is possible to use the method
 
 
 
client.setPointState(x,o,xdot,odot);
 
 
 
where 'x' represents the position and 'o' the orientation, so as 'xdot' and 'odot' the corresponding velocities.
 
The user might want to enable the force field generation without enabling robot movements:
 
 
 
client.enableField();
 
 
 
In order to enable also robot movements:
 
 
client.enableControl();
 
 
 
For online documentation of all the methods composing the Pmp Library, please refer to the [http://eris.liralab.it/iCub/main/dox/html/group__pmp.html Doxygen Documentation]
 
 
 
== Tutorials ==
 
 
 
Under $ICUB_ROOT/main/src/modules/pmpServer and $ICUB_ROOT/main/src/examples/pmpExample user may find further info on how to open a pmp_server and a pmp_client, and how to write the related ''CMakeLists.txt''
 
 
 
= Dissemination =
 
 
 
Gori I., Pattacini U., Nori F., Metta G. & Sandini G., [[media:DForC.pdf | DForC: a Real-Time Method for Reaching, Tracking and Obstacle Avoidance in Humanoid Robots]], IEEE-RAS International Conference on Humanoid Robots, Osaka, Japan, November 29 - December 1, 2012.
 
 
 
== Videos ==
 
 
 
* [http://eris.liralab.it/misc/icubvideos/pmp.wmv Experiment 0]: a video of iCub avoiding an obstacle placed on a table while reaching for the target.
 
* [http://www.youtube.com/watch?v=npBugYmf59U EFAA 1st Year Review Demo]: the library at work within the [http://efaa.upf.edu/ EFAA] EU project.
 

Latest revision as of 17:10, 30 May 2015

REDIRECT D4C on GitHub