Aggiunte e modifiche per lower_body
This commit is contained in:
@@ -37,7 +37,7 @@ Per spostare l'intera scena si tiene premuto il tasto centrale del mouse.
|
|||||||
- Aggiunta selettore sulla posizione dei dati
|
- Aggiunta selettore sulla posizione dei dati
|
||||||
- Refactoring classe sensore e state per gestire posizione dati da gui
|
- Refactoring classe sensore e state per gestire posizione dati da gui
|
||||||
|
|
||||||
# Per compliare:
|
# Per compilare:
|
||||||
|
|
||||||
cmake --build
|
cmake --build
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -18,3 +18,14 @@ class CollectionInterface{
|
|||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
inline collection operator+(collection c1, collection c2){
|
||||||
|
collection res;
|
||||||
|
for (PieceInterface* i : c1.pieces){
|
||||||
|
res.pieces.push_back(i);
|
||||||
|
}
|
||||||
|
for (JointInterface* i : c1.joints){
|
||||||
|
res.joints.push_back(i);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ class Gamba : public CollectionInterface {
|
|||||||
public:
|
public:
|
||||||
Gamba(rb::Vector3 pos, unsigned int* dataPos, std::string cosciaData, std::string cavigliaData);
|
Gamba(rb::Vector3 pos, unsigned int* dataPos, std::string cosciaData, std::string cavigliaData);
|
||||||
collection create(ReferencePlane plane) override;
|
collection create(ReferencePlane plane) override;
|
||||||
|
PieceInterface* getJointPiece();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -4,23 +4,30 @@
|
|||||||
#define LOWER_BODY_H
|
#define LOWER_BODY_H
|
||||||
|
|
||||||
struct gamba_data{
|
struct gamba_data{
|
||||||
rb::Vector3 pos;
|
|
||||||
unsigned int* dataPos;
|
unsigned int* dataPos;
|
||||||
std::string cosciaData;
|
std::string cosciaData;
|
||||||
std::string cavigliaData;
|
std::string cavigliaData;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class lower_body
|
class Lower_Body : CollectionInterface{
|
||||||
{
|
|
||||||
protected:
|
protected:
|
||||||
Gamba sx;
|
Gamba* sx;
|
||||||
Gamba dx;
|
Gamba* dx;
|
||||||
Torso t;
|
Torso* t;
|
||||||
|
|
||||||
|
PivotJoint* jsx;
|
||||||
|
PivotJoint* jdx;
|
||||||
|
|
||||||
|
bool visible = true;
|
||||||
|
float alpha = 1;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
lower_body(std::vector<gamba_data> data);
|
Lower_Body(std::vector<gamba_data> data);
|
||||||
~lower_body();
|
~Lower_Body();
|
||||||
|
|
||||||
|
void setVisibility(bool c);
|
||||||
|
collection create(ReferencePlane plane) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -44,3 +44,7 @@ collection Gamba::create(ReferencePlane plane){
|
|||||||
|
|
||||||
return coll;
|
return coll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PieceInterface* Gamba::getJointPiece(){
|
||||||
|
return sensori[0];
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#include "../headers/lower_body.hpp"
|
||||||
|
|
||||||
|
Lower_Body::Lower_Body(std::vector<gamba_data> data){
|
||||||
|
if (data.size() != 2) throw "Lower_Body_Error: data vector size must be 2";
|
||||||
|
sx = new Gamba({0,0,150},data[0].dataPos,data[0].cosciaData,data[0].cavigliaData);
|
||||||
|
dx = new Gamba({0,0,150},data[1].dataPos,data[1].cosciaData,data[1].cavigliaData);
|
||||||
|
t = new Torso({0,100,0},_Float16(3.0));
|
||||||
|
|
||||||
|
PieceInterface* psx = sx->getJointPiece();
|
||||||
|
PieceInterface* pdx = dx->getJointPiece();
|
||||||
|
|
||||||
|
jsx = new PivotJoint(t, {psx}, rb::Vector3{0,-100,50});
|
||||||
|
jdx = new PivotJoint(t, {pdx}, rb::Vector3{0,100,50});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
collection Lower_Body::create(ReferencePlane plane){
|
||||||
|
collection coll;
|
||||||
|
coll = coll + sx->create(plane);
|
||||||
|
coll = coll + dx->create(plane);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -34,7 +34,6 @@ class Sensore : public PieceInterface{
|
|||||||
void initCSV(std::vector<std::vector<float>> data);
|
void initCSV(std::vector<std::vector<float>> data);
|
||||||
void setIntervall(int min, int max);
|
void setIntervall(int min, int max);
|
||||||
void setPos(int &pos);
|
void setPos(int &pos);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Reference in New Issue
Block a user