Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend SkinDynLib (fixes #149) #151

Merged
merged 30 commits into from
Jun 8, 2015
Merged

Extend SkinDynLib (fixes #149) #151

merged 30 commits into from
Jun 8, 2015

Conversation

alecive
Copy link
Member

@alecive alecive commented May 22, 2015

Currently, there is no standard high-level API for the skin on the iCub. What I'm referring to, is a set of classes that ease and standardize the process of handling single taxels / skin parts / file management. To this end, I propose and extension of the skinDynLib library with some tools I implemented in https://github.com/alecive/periPersonalSpace and might be useful for other users.

1. New Classes

1.1. CLASS 1 : Taxel - the basic element

Basic Members

Member Description
ID ID of the taxel
Position taxel position as read from calib file
Normal taxel normal direction as read from calib file
FoR Frame of Reference: 4x4 matrix with Pos as translational component; z-axis coincident with Nrm; x-axis and y-axis are chosen arbitrarily on the plane normal to Nrm
WRFposition 3D taxel position in the Root Rereference frame
px 2D taxel position in the image plane of one of the eyes

Methods

Various constructors, toString(), print(), copy operator, etc), but no method to assign the aforementioned members (see below).

1.2. CLASS 2 : skinPart

It is a collection of taxels (it is way too similar to the SkinPart enum (cf. http://wiki.icub.org/brain/namespaceiCub_1_1skinDynLib.html#ad9eb09d94574e8020c27676ca5e9bdfc ) already used in the library, but I don't know how to call it better [any help?]).

Basic Members

Member Description
string name name of the skinpart (see below)
vector<Taxel*> taxels List of taxels that belong to the skinPart.
string spatial_mapping Type of mapping performed during the constriction of the skinPart. It can be either taxel (i.e. 1:1 mapping) or patch (i.e. a mapping where each taxel is represented by the central taxel of the triangular patch it belongs - if the skinPart has triangular patches
vector<int> taxel2Repr Indexing variable used in the case of reducing the resolution - e.g. taking only triangle centers. The index into the vector is the taxel ID, the value stored is its representative (i.e. the ID of the taxel in the center of the triangle)
map<unsigned int, list<unsigned int> > repr2TaxelList Mapping in the opposite direction. Indexed by representative taxel IDs, it stores lists of the taxels being represented - e.g. all taxels of a triangle

Methods

1.3. CLASS 3 : iCubSkin

It is a collection of skinParts , useful to have everything in one place : it lets the skin to be populated with the same interface used for the skinmanager.

Basic Members

Member Description
vector<skinPart> sp List of skinPart(s) that belong to the skinPart.

Methods

  • Various constructors, toString(), print(), copy operator, etc
  • bool configureSkinFromFile(const std::string &_from="skinManAll.ini", const std::string &_context="skinGui"); : it reads the same file read by the skinManager, and creates skinParts accordingly.

2. What changes

2.1. New classes to play with

The new classes greatly simplify the process of managing position files. E.g., this snippet will create a iCubSkin class with 7 skinPart(s), each of them properly populated.

#include <iCub/skinDynLib/iCubSkin.h>
...
int verbosity = 1;
iCub::skinDynLib::iCubSkin iCS;
// iCub::skinDynLib::iCubSkin iCS("skinManForearms.ini","skinGui");
iCS.print(verbosity);                // it accepts various level of verbosity

2.2. New configuration files that break compatibility with the past (but are already taken care of)

From now on, the position files in https://github.com/robotology/icub-main/tree/master/app/skinGui/conf/positions will change from this:

-0.031 -0.075  0.008 -0.976  0.065  0.146
-0.031 -0.079  0.005 -0.739  0.078  0.105
-0.031 -0.075  0.004 -0.600  0.054  0.068
...
-0.030 -0.071  0.010 -0.979  0.135  0.098
-0.030 -0.086  0.014 -0.975  0.068  0.185

to a more .ini like convention, i.e. this:

name                l_hand
spatial_sampling    taxel
taxel2Repr          (-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)
[calibration]
-0.031 -0.075  0.008 -0.976  0.065  0.146
-0.031 -0.079  0.005 -0.739  0.078  0.105
-0.031 -0.075  0.004 -0.600  0.054  0.068
...
-0.030 -0.071  0.010 -0.979  0.135  0.098
-0.030 -0.086  0.014 -0.975  0.068  0.185

2.3. SkinDynLib is now compliant with the new naming convention

In agreement with @traversaro , we decided to modify the array called SkinParts_s and available in https://github.com/robotology/icub-main/blob/master/src/libraries/skinDynLib/include/iCub/skinDynLib/common.h to what described in #124 (the Link Name field) and #57 . By doing so, we explicitly relate a skinPart to its link, and we remove redundancies throughout the codebase.
So, I moved from this:

const std::string SkinPart_s[] = {
    "unknown_skin_part", 
    "skin_left_hand", "skin_left_forearm", "skin_left_upper_arm", 
    "skin_right_hand", "skin_right_forearm", "skin_right_upper_arm", 
    "skin_front_torso", "skin_left_leg_upper",  "skin_left_leg_lower", "skin_left_foot",
    "skin_right_leg_upper",  "skin_right_leg_lower", "skin_right_foot",
    "all_skin_parts", "skin_part_size"
};

to this:

const std::string SkinPart_s[] = {
    "unknown", 
    "l_hand", "l_forearm", "l_upper_arm", 
    "r_hand", "r_forearm", "r_upper_arm", 
    "chest",
    "l_upper_leg", "l_lower_leg", "l_foot",
    "r_upper_leg", "r_lower_leg", "r_foot",
    "all_skin_parts", "skin_part_size"
};

3. Important note

Everything has been tested and works fine, but I still miss the testing of the skinManageron a real iCub (no one is available currently). After that, everything can be merged gracefully 😄

alecive added 29 commits May 18, 2015 13:26
…ft here. Further, moved Pos and Nrm members of the Taxel class to Position and Normal
… with the name of the member in the skinPart class
… changed members that start with capital letters to lowercase letters
@alecive alecive mentioned this pull request May 25, 2015
@alecive
Copy link
Member Author

alecive commented Jun 8, 2015

Merging after chat with @lornat75

alecive added a commit that referenced this pull request Jun 8, 2015
@alecive alecive merged commit 4ded9d0 into robotology:master Jun 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants