diff --git a/build/bin/mainV6 b/build/bin/mainV6 new file mode 100755 index 0000000..1f71b2c Binary files /dev/null and b/build/bin/mainV6 differ diff --git a/src/collections/headers/collection_interface.hpp b/src/collections/headers/collection_interface.hpp index 4aa5ada..2a11279 100644 --- a/src/collections/headers/collection_interface.hpp +++ b/src/collections/headers/collection_interface.hpp @@ -17,7 +17,7 @@ class CollectionInterface{ }; -#endif + inline collection operator+(collection c1, collection c2){ collection res; @@ -28,4 +28,6 @@ inline collection operator+(collection c1, collection c2){ res.joints.push_back(i); } return res; -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/src/collections/headers/lower_body.hpp b/src/collections/headers/lower_body.hpp index 9fb5b8e..72cbcf4 100644 --- a/src/collections/headers/lower_body.hpp +++ b/src/collections/headers/lower_body.hpp @@ -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 data); + Lower_Body(rb::Vector3 pos, std::vector data); ~Lower_Body(); void setVisibility(bool c); diff --git a/src/collections/methods/lower_body.cpp b/src/collections/methods/lower_body.cpp index 266cd86..70e1719 100644 --- a/src/collections/methods/lower_body.cpp +++ b/src/collections/methods/lower_body.cpp @@ -1,10 +1,11 @@ #include "../headers/lower_body.hpp" -Lower_Body::Lower_Body(std::vector data){ +Lower_Body::Lower_Body(rb::Vector3 pos,std::vector 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 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){ + } \ No newline at end of file diff --git a/src/include.hpp b/src/include.hpp index fddee8c..a2485f5 100644 --- a/src/include.hpp +++ b/src/include.hpp @@ -7,4 +7,5 @@ #include "pieces/headers/torso.hpp" #include "joints/headers/rigid_joint.hpp" #include "joints/headers/pivot_joint.hpp" -#include "collections/headers/gamba.hpp" \ No newline at end of file +#include "collections/headers/gamba.hpp" +#include "collections/headers/lower_body.hpp" \ No newline at end of file diff --git a/src/testMain.cpp b/src/testMain.cpp index 8e3c98f..923d4b6 100755 --- a/src/testMain.cpp +++ b/src/testMain.cpp @@ -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 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){