Test lower_body in main

This commit is contained in:
2026-06-18 22:32:30 +02:00
parent 842f384bb8
commit 23798ab582
6 changed files with 52 additions and 11 deletions
BIN
View File
Binary file not shown.
@@ -17,7 +17,7 @@ class CollectionInterface{
};
#endif
inline collection operator+(collection c1, collection c2){
collection res;
@@ -29,3 +29,5 @@ inline collection operator+(collection c1, collection c2){
}
return res;
}
#endif
+3 -2
View File
@@ -1,4 +1,5 @@
#include "gamba.hpp"
#include "collection_interface.hpp"
#ifndef LOWER_BODY_H
#define LOWER_BODY_H
@@ -10,7 +11,7 @@ struct gamba_data{
};
class Lower_Body : CollectionInterface{
class Lower_Body : public CollectionInterface{
protected:
Gamba* sx;
Gamba* dx;
@@ -23,7 +24,7 @@ protected:
float alpha = 1;
public:
Lower_Body(std::vector<gamba_data> data);
Lower_Body(rb::Vector3 pos, std::vector<gamba_data> data);
~Lower_Body();
void setVisibility(bool c);
+33 -6
View File
@@ -1,10 +1,11 @@
#include "../headers/lower_body.hpp"
Lower_Body::Lower_Body(std::vector<gamba_data> data){
Lower_Body::Lower_Body(rb::Vector3 pos,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));
sx = new Gamba({pos[0],pos[1],pos[2]+150},data[0].dataPos,data[0].cosciaData,data[0].cavigliaData);
dx = new Gamba({pos[0],pos[1],pos[2]+150},data[1].dataPos,data[1].cosciaData,data[1].cavigliaData);
t = new Torso({pos[0],pos[1]+100,pos[2]},_Float16(3.0));
PieceInterface* psx = sx->getJointPiece();
PieceInterface* pdx = dx->getJointPiece();
@@ -16,8 +17,34 @@ Lower_Body::Lower_Body(std::vector<gamba_data> data){
collection Lower_Body::create(ReferencePlane plane){
collection coll;
coll = coll + sx->create(plane);
coll = coll + dx->create(plane);
switch (plane)
{
case ReferencePlane::XZ: case ReferencePlane::XZN:
coll = coll + sx->create(plane);
coll = coll + dx->create(plane);
break;
case ReferencePlane::YZ:
coll = coll + dx->create(plane);
coll = coll + sx->create(plane);
break;
default:
break;
}
return coll;
}
Lower_Body::~Lower_Body(){
delete sx;
delete dx;
delete t;
delete jdx;
delete jsx;
}
void Lower_Body::setVisibility(bool c){
}
+1
View File
@@ -8,3 +8,4 @@
#include "joints/headers/rigid_joint.hpp"
#include "joints/headers/pivot_joint.hpp"
#include "collections/headers/gamba.hpp"
#include "collections/headers/lower_body.hpp"
+10
View File
@@ -71,6 +71,16 @@ int main() {
//provo ad aggiungere una collection
Gamba g = Gamba({0,0,0},&pos,"coscia_filt.csv","coscia_filt.csv");
std::vector<gamba_data> data;
gamba_data d;
d.dataPos = &pos;
d.cavigliaData = "coscia_filt.csv";
d.cosciaData = "coscia_filt.csv";
data.push_back(d);
data.push_back(d);
Lower_Body b = Lower_Body(rb::Vector3{0,0,0},data);
printf("Ho costruito tutto!\n");
}
catch(char* e){