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

improved SkinGUI for fingertip #930

Merged
merged 3 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/tools/iCubSkinGui/plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ set(QtICubSkinGuiPlugin_SRCS Fingertip2Left.cpp
Fingertip2Right.cpp
Fingertip3Left.cpp
Fingertip3Right.cpp
Fingertip4Left.cpp
Fingertip4Right.cpp
Fingertip.cpp
FingertipMID.cpp
PalmLeft.cpp
fakePalm.cpp
PalmRight.cpp
qticubskinguiplugin.cpp
qticubskinguiplugin_plugin.cpp
Expand All @@ -30,7 +34,10 @@ set(QtICubSkinGuiPlugin_HDRS qticubskinguiplugin.h
include/Fingertip2Right.h
include/Fingertip3Left.h
include/Fingertip3Right.h
include/Fingertip4Left.h
include/Fingertip4Right.h
include/Fingertip.h
include/fakePalm.h
simeonedussoni marked this conversation as resolved.
Show resolved Hide resolved
include/PalmLeft.h
include/PalmRight.h
include/Quad16.h
Expand Down
10 changes: 10 additions & 0 deletions src/tools/iCubSkinGui/plugin/Fingertip4Left.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-

/*
* Copyright (C) 2009 RobotCub Consortium
* Author: Marco Maggiali marco.maggiali@iit.it
* CopyPolicy: Released under the terms of the GNU GPL v2.0.
*
*/

#include "include/Fingertip4Left.h"
10 changes: 10 additions & 0 deletions src/tools/iCubSkinGui/plugin/Fingertip4Right.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-

/*
* Copyright (C) 2009 RobotCub Consortium
* Author: Marco Maggiali marco.maggiali@iit.it
* CopyPolicy: Released under the terms of the GNU GPL v2.0.
*
*/

#include "include/Fingertip4Right.h"
10 changes: 10 additions & 0 deletions src/tools/iCubSkinGui/plugin/FingertipMID.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-

/*
* Copyright (C) 2009 RobotCub Consortium
* Author: Marco Maggiali marco.maggiali@iit.it
* CopyPolicy: Released under the terms of the GNU GPL v2.0.
*
*/

#include "include/FingertipMID.h"
31 changes: 30 additions & 1 deletion src/tools/iCubSkinGui/plugin/SkinMeshThreadPort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,21 @@ SkinMeshThreadPort::SkinMeshThreadPort(Searchable& config,int period) : Periodic
for (int t=0; t<sensorSetConfig.size(); ++t)
{
yarp::os::Bottle sensorConfig(sensorSetConfig.get(t).toString());

std::string type(sensorConfig.get(0).asString());

if (type=="triangle" ||
type=="fingertip" ||
type=="fingertip2L" ||
type=="fingertip2R" ||
type=="fingertip3L" ||
type=="fingertip3R" ||
type=="fingertip4L" ||
type=="fingertip4R" ||
type=="fingertipMID" ||
type=="triangle_10pad" ||
type=="quad16" ||
type=="palmR" ||
type=="fakePalm" ||
type=="palmL" ||
type == "cer_sh_pdl" ||
type == "cer_sh_pdr" ||
Expand Down Expand Up @@ -142,6 +147,26 @@ SkinMeshThreadPort::SkinMeshThreadPort(Searchable& config,int period) : Periodic
{
sensor[id]=new Fingertip2R(xc,yc,th,gain,layoutNum,lrMirror);
}
else if (type=="fingertip3L")
{
sensor[id]=new Fingertip3L(xc,yc,th,gain,layoutNum,lrMirror);
}
else if (type=="fingertip3R")
{
sensor[id]=new Fingertip3R(xc,yc,th,gain,layoutNum,lrMirror);
}
else if (type=="fingertip4L")
{
sensor[id]=new Fingertip4L(xc,yc,th,gain,layoutNum,lrMirror);
}
else if (type=="fingertip4R")
{
sensor[id]=new Fingertip4R(xc,yc,th,gain,layoutNum,lrMirror);
}
if (type=="fingertipMID")
{
sensor[id]=new FingertipMID(xc,yc,th,gain,layoutNum,lrMirror);
}
else if (type=="quad16")
{
sensor[id]=new Quad16(xc,yc,th,gain,layoutNum,lrMirror);
Expand All @@ -154,6 +179,10 @@ SkinMeshThreadPort::SkinMeshThreadPort(Searchable& config,int period) : Periodic
{
sensor[id]=new PalmR(xc,yc,th,gain,layoutNum,lrMirror);
}
else if (type=="fakePalm")
{
sensor[id]=new fakePalm(xc,yc,th,gain,layoutNum,lrMirror);
}
else if (type=="palmL")
{
sensor[id]=new PalmL(xc,yc,th,gain,layoutNum,lrMirror);
Expand Down
10 changes: 10 additions & 0 deletions src/tools/iCubSkinGui/plugin/fakePalm.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-

/*
* Copyright (C) 2009 RobotCub Consortium
* Author: Marco Maggiali marco.maggiali@iit.it
* CopyPolicy: Released under the terms of the GNU GPL v2.0.
*
*/

#include "include/fakePalm.h"
117 changes: 117 additions & 0 deletions src/tools/iCubSkinGui/plugin/include/Fingertip4Left.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-

/*
* Copyright (C) 2009 RobotCub Consortium
* Author: Marco Maggiali marco.maggiali@iit.it
* CopyPolicy: Released under the terms of the GNU GPL v2.0.
*
*/

#include "include/TouchSensor.h"

#ifndef __ALE_FINGERTIP4_L_H__
#define __ALE_FINGERTIP4_L_H__

class Fingertip4L : public TouchSensor
{
public:
Fingertip4L(double cx,double cy,double th,double gain=1.0,int layoutNum=0,int lrMirror=0)
{
dGain=gain;
ilrMirror=lrMirror;
ilayoutNum=layoutNum;
nVerts=7;
nTaxels=12;

/* dX[0]= 41.0; dY[0]=10.0;
dX[1]= 15.0; dY[1]=10.0;
dX[2]= 15.0; dY[2]=35.0;
dX[3]= 41.0; dY[3]=35.0;
dX[4]= 30.0; dY[4]=64.0;
dX[5]= 11.0; dY[5]=58.0;
dX[6]= 0.0; dY[6]=82.0;
dX[7]=-11.0; dY[7]=58.0;
dX[8]=-30.0; dY[8]=64.0;
dX[9]=-41.0; dY[9]=35.0;
dX[10]=-15.0; dY[10]=35.0;
dX[11]=-15.0; dY[11]=10.0;
*/
dY[0]=-25.0; dX[0]= 20.0;
dY[1]=-25.0; dX[1]= 0.0;
dY[2]=-25.0; dX[2]= -20.0;
dY[3]=-39.0; dX[3]= -35.0;
dY[4]=-39.0; dX[4]= 35.0;
dY[5]=-53.0; dX[5]= -20.0;
dY[6]=-53.0; dX[6]= 0.0;
dY[7]=-53.0; dX[7]= 20.0;
dY[8]= -2.0; dX[8]= 22.0;
dY[9]= 10.0; dX[9]= 5.0;
dY[10]= 28.0; dX[10]= -4.;
dY[11]= 30.0; dX[11]= 32.0;

dXv[0]=53.0; dYv[0]= 0.0;
dXv[1]=53.0; dYv[1]=45.0;
dXv[2]=dX[4]+10.0; dYv[2]=dY[4]+10.0;
dXv[3]=0.0; dYv[3]=dY[6]+12.0;
dXv[4]=-dXv[2]; dYv[4]=dYv[2];
dXv[5]=-dXv[1]; dYv[5]=dYv[1];
dXv[6]=-dXv[0]; dYv[6]=dYv[0];

const double scale=2.7/15.3;
for (int i=0; i<nTaxels; ++i)
{
dX[i]*=scale;
dY[i]*=scale;
}
for (int i=0; i<nVerts; ++i)
{
dXv[i]*=scale;
dYv[i]*=scale;
}

m_RadiusOrig=1.5;

const double DEG2RAD=M_PI/180.0;
const double CST=cos(DEG2RAD*th);
const double SNT=sin(DEG2RAD*th);

for (int i=0; i<nTaxels; ++i)
{
double x=dX[i];
double y=dY[i];
if (lrMirror==1) x=-x;

dX[i]=cx+CST*x-SNT*y;
dY[i]=cy+SNT*x+CST*y;
}

for (int i=0; i<nVerts; ++i)
{
double x=dXv[i];
double y=dYv[i];
if (lrMirror==1) x=-x;

// dXv[i]=cx+CST*x-SNT*y;
// dYv[i]=cy+SNT*x+CST*y;
dXv[i]=0;
dYv[i]=0;
}

// in static definition
//dXmin=dYmin= HUGE;
//dXmax=dYmax=-HUGE;

/*for (int i=0; i<nVerts; ++i)
{
if (dXv[i]<dXmin) dXmin=dXv[i];
if (dXv[i]>dXmax) dXmax=dXv[i];
if (dYv[i]<dYmin) dYmin=dYv[i];
if (dYv[i]>dYmax) dYmax=dYv[i];
}*/

dXc=cx;
dYc=cy;
}
};

#endif
104 changes: 104 additions & 0 deletions src/tools/iCubSkinGui/plugin/include/Fingertip4Right.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-

/*
* Copyright (C) 2009 RobotCub Consortium
* Author: Marco Maggiali marco.maggiali@iit.it
* CopyPolicy: Released under the terms of the GNU GPL v2.0.
*
*/

#include "include/TouchSensor.h"

#ifndef __ALE_FINGERTIP4_R_H__
#define __ALE_FINGERTIP4_R_H__

class Fingertip4R : public TouchSensor
{
public:
Fingertip4R(double cx,double cy,double th,double gain=1.0,int layoutNum=0,int lrMirror=0)
{
dGain=gain;
ilrMirror=lrMirror;
ilayoutNum=layoutNum;
nVerts=7;
nTaxels=12;

dY[4]=-25.0; dX[4]= -20.0;
dY[5]=-25.0; dX[5]= 0.0;
dY[6]=-25.0; dX[6]= 20.0;
dY[8]=-39.0; dX[8]= 35.0;
dY[7]=-39.0; dX[7]= -35.0;
dY[9]=-53.0; dX[9]= 20.0;
dY[10]=-53.0; dX[10]= 0.0;
dY[11]=-53.0; dX[11]= -20.0;
dY[3]= -2.0; dX[3]= -22.0;
dY[2]= 10.0; dX[2]= -5.0;
dY[1]= 28.0; dX[1]= 4.0;
dY[0]= 30.0; dX[0]= -32.0;

lrMirror=0; //forcing mirror

dXv[0]=53.0; dYv[0]= 0.0;
dXv[1]=53.0; dYv[1]=45.0;
dXv[2]=dX[3]+10.0; dYv[2]=dY[3]+10.0;
dXv[3]=0.0; dYv[3]=dY[5]+12.0;
dXv[4]=-dXv[2]; dYv[4]=dYv[2];
dXv[5]=-dXv[1]; dYv[5]=dYv[1];
dXv[6]=-dXv[0]; dYv[6]=dYv[0];

const double scale=2.7/15.3;
for (int i=0; i<nTaxels; ++i)
{
dX[i]*=scale;
dY[i]*=scale;
}
for (int i=0; i<nVerts; ++i)
{
dXv[i]*=scale;
dYv[i]*=scale;
}

m_RadiusOrig=1.5;

const double DEG2RAD=M_PI/180.0;
const double CST=cos(DEG2RAD*th);
const double SNT=sin(DEG2RAD*th);

for (int i=0; i<nTaxels; ++i)
{
double x=dX[i];
double y=dY[i];
if (lrMirror==1) x=-x;

dX[i]=cx+CST*x-SNT*y;
dY[i]=cy+SNT*x+CST*y;
}

for (int i=0; i<nVerts; ++i)
{
double x=dXv[i];
double y=dYv[i];
if (lrMirror==1) x=-x;

dXv[i]=0;
dYv[i]=0;
}

// in static definition
//dXmin=dYmin= HUGE;
//dXmax=dYmax=-HUGE;

for (int i=0; i<nVerts; ++i)
{
if (dXv[i]<dXmin) dXmin=dXv[i];
if (dXv[i]>dXmax) dXmax=dXv[i];
if (dYv[i]<dYmin) dYmin=dYv[i];
if (dYv[i]>dYmax) dYmax=dYv[i];
}

dXc=cx;
dYc=cy;
}
};

#endif
Loading
Loading