second good build. Joints
This commit is contained in:
@@ -1 +1,19 @@
|
||||
#include "AbsConstraint.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
AbsConstraint::AbsConstraint()
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
|
||||
AbsConstraint::AbsConstraint(const char* str) : Constraint(str)
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
|
||||
void AbsConstraint::initialize()
|
||||
{
|
||||
axis = 0;
|
||||
iqXminusOnePlusAxis = 0;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@ namespace MbD {
|
||||
class AbsConstraint : public Constraint
|
||||
{
|
||||
//axis iqXminusOnePlusAxis
|
||||
public:
|
||||
AbsConstraint();
|
||||
AbsConstraint(const char* str);
|
||||
void initialize();
|
||||
int axis;
|
||||
int iqXminusOnePlusAxis;
|
||||
};
|
||||
|
||||
@@ -8,8 +8,9 @@ namespace MbD {
|
||||
{
|
||||
public:
|
||||
Array(){}
|
||||
Array(int i) : std::vector<T>(i) {}
|
||||
Array(std::initializer_list<T> list) : std::vector<T>{ list } {}
|
||||
Array(size_t count) : std::vector<T>(count) {}
|
||||
Array(size_t count, const T& value) : std::vector<T>(count, value) {}
|
||||
Array(std::initializer_list<T> list) : std::vector<T>{ list } {}
|
||||
void copy(std::shared_ptr<Array<T>> x);
|
||||
};
|
||||
template<typename T>
|
||||
|
||||
@@ -1 +1,15 @@
|
||||
#include "CartesianFrame.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
CartesianFrame::CartesianFrame()
|
||||
{
|
||||
}
|
||||
|
||||
CartesianFrame::CartesianFrame(const char* str) : Item(str)
|
||||
{
|
||||
}
|
||||
|
||||
void CartesianFrame::initialize()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
namespace MbD {
|
||||
class CartesianFrame : public Item
|
||||
{
|
||||
public:
|
||||
CartesianFrame();
|
||||
CartesianFrame(const char* str);
|
||||
void initialize();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1,31 @@
|
||||
#include "Constraint.h"
|
||||
//#include "Item.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
Constraint::Constraint()
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
|
||||
Constraint::Constraint(const char* str) : Item(str)
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
|
||||
void Constraint::initialize()
|
||||
{
|
||||
iG = -1;
|
||||
aG = 0.0;
|
||||
lam = 0.0;
|
||||
}
|
||||
|
||||
void Constraint::setOwner(Item* x)
|
||||
{
|
||||
owner = x;
|
||||
}
|
||||
|
||||
Item* Constraint::getOwner()
|
||||
{
|
||||
return owner;
|
||||
}
|
||||
|
||||
@@ -4,25 +4,20 @@
|
||||
#include "Item.h"
|
||||
|
||||
namespace MbD {
|
||||
class Constraint : public Item
|
||||
{
|
||||
public:
|
||||
Constraint() : Item() {
|
||||
iG = -1;
|
||||
aG = 0.0;
|
||||
lam = 0.0;
|
||||
}
|
||||
void setOwner(std::shared_ptr<Item> x) {
|
||||
owner = x;
|
||||
}
|
||||
std::shared_ptr<Item> getOwner() {
|
||||
return owner.lock();
|
||||
}
|
||||
//iG aG lam mu lamDeriv owner
|
||||
int iG;
|
||||
double aG; //Constraint function
|
||||
double lam; //Lambda is Lagrange Multiplier
|
||||
std::weak_ptr<Item> owner; //A Joint or PartFrame owns the constraint
|
||||
};
|
||||
class Constraint : public Item
|
||||
{
|
||||
//iG aG lam mu lamDeriv owner
|
||||
public:
|
||||
Constraint();
|
||||
Constraint(const char* str);
|
||||
void initialize();
|
||||
void setOwner(Item* x);
|
||||
Item* getOwner();
|
||||
|
||||
int iG;
|
||||
double aG; //Constraint function
|
||||
double lam; //Lambda is Lagrange Multiplier
|
||||
Item* owner; //A Joint or PartFrame owns the constraint
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
24
MbDCode/Constraint.h.bak
Normal file
24
MbDCode/Constraint.h.bak
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
|
||||
#include "Item.h"
|
||||
//#include "PartFrame.h"
|
||||
|
||||
namespace MbD {
|
||||
class Constraint : public Item
|
||||
{
|
||||
//iG aG lam mu lamDeriv owner
|
||||
public:
|
||||
Constraint();
|
||||
Constraint(const char* str);
|
||||
void initialize();
|
||||
void setOwner(Item* x);
|
||||
Item* getOwner();
|
||||
|
||||
int iG;
|
||||
double aG; //Constraint function
|
||||
double lam; //Lambda is Lagrange Multiplier
|
||||
Item* owner; //A Joint or PartFrame owns the constraint
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1 +1,15 @@
|
||||
#include "CylindricalJoint.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
CylindricalJoint::CylindricalJoint() {
|
||||
initialize();
|
||||
}
|
||||
|
||||
CylindricalJoint::CylindricalJoint(const char* str) : Joint(str) {
|
||||
initialize();
|
||||
}
|
||||
|
||||
void CylindricalJoint::initialize()
|
||||
{
|
||||
}
|
||||
|
||||
1
MbDCode/CylindricalJoint.cpp.bak
Normal file
1
MbDCode/CylindricalJoint.cpp.bak
Normal file
@@ -0,0 +1 @@
|
||||
#include "CylindricalJoint.h"
|
||||
@@ -4,6 +4,11 @@
|
||||
namespace MbD {
|
||||
class CylindricalJoint : public Joint
|
||||
{
|
||||
//frmI frmJ constraints friction
|
||||
public:
|
||||
CylindricalJoint();
|
||||
CylindricalJoint(const char* str);
|
||||
void initialize();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
10
MbDCode/CylindricalJoint.h.bak
Normal file
10
MbDCode/CylindricalJoint.h.bak
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "Joint.h"
|
||||
|
||||
namespace MbD {
|
||||
class CylindricalJoint : public Joint
|
||||
{
|
||||
public:
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,7 +2,15 @@
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
EndFramec::EndFramec()
|
||||
EndFramec::EndFramec() {
|
||||
initialize();
|
||||
}
|
||||
|
||||
EndFramec::EndFramec(const char* str) : CartesianFrame(str) {
|
||||
initialize();
|
||||
}
|
||||
|
||||
void EndFramec::initialize()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
12
MbDCode/EndFramec.cpp.bak
Normal file
12
MbDCode/EndFramec.cpp.bak
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "EndFramec.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
EndFramec::EndFramec()
|
||||
{
|
||||
}
|
||||
|
||||
void EndFramec::setMarkerFrame(std::shared_ptr<MarkerFrame> markerFrm)
|
||||
{
|
||||
markerFrame = markerFrm;
|
||||
}
|
||||
@@ -12,6 +12,8 @@ namespace MbD {
|
||||
//markerFrame rOeO aAOe
|
||||
public:
|
||||
EndFramec();
|
||||
EndFramec(const char* str);
|
||||
void initialize();
|
||||
void setMarkerFrame(MarkerFrame* markerFrm);
|
||||
|
||||
MarkerFrame* markerFrame;
|
||||
|
||||
22
MbDCode/EndFramec.h.bak
Normal file
22
MbDCode/EndFramec.h.bak
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#include "CartesianFrame.h"
|
||||
#include "MarkerFrame.h"
|
||||
#include "FullColumn.h"
|
||||
#include "FullMatrix.h"
|
||||
|
||||
namespace MbD {
|
||||
class MarkerFrame;
|
||||
|
||||
class EndFramec : public CartesianFrame
|
||||
{
|
||||
//markerFrame rOeO aAOe
|
||||
public:
|
||||
EndFramec();
|
||||
void setMarkerFrame(std::shared_ptr<MarkerFrame> markerFrm);
|
||||
|
||||
std::weak_ptr<MarkerFrame> markerFrame;
|
||||
FullColDptr rOeO = std::make_shared<FullColumn<double>>(3);
|
||||
FullMatDptr aAOe = std::make_shared<FullMatrix<double>>(3, 3);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
EndFrameqc::EndFrameqc() : EndFramec()
|
||||
EndFrameqc::EndFrameqc() {
|
||||
initialize();
|
||||
}
|
||||
|
||||
EndFrameqc::EndFrameqc(const char* str) : EndFramec(str) {
|
||||
initialize();
|
||||
}
|
||||
|
||||
void EndFrameqc::initialize()
|
||||
{
|
||||
}
|
||||
|
||||
7
MbDCode/EndFrameqc.cpp.bak
Normal file
7
MbDCode/EndFrameqc.cpp.bak
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "EndFrameqc.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
EndFrameqc::EndFrameqc() : EndFramec()
|
||||
{
|
||||
}
|
||||
@@ -11,6 +11,8 @@ namespace MbD {
|
||||
//prOeOpE pprOeOpEpE pAOepE ppAOepEpE
|
||||
public:
|
||||
EndFrameqc();
|
||||
EndFrameqc(const char* str);
|
||||
void initialize();
|
||||
FullMatDptr prOeOpE = std::make_shared<FullMatrix<double>>(3, 4);
|
||||
//std::shared_ptr<FullMatrix<std::shared_ptr<FullColumn<double>>>> pprOeOpEpE = std::make_shared<FullMatrix<std::shared_ptr<FullColumn<double>>>>(3, 4);
|
||||
std::shared_ptr<FullColumn<std::shared_ptr<FullMatrix<double>>>> pAOepE = std::make_shared<FullColumn<std::shared_ptr<FullMatrix<double>>>>(4);
|
||||
|
||||
23
MbDCode/EndFrameqc.h.bak
Normal file
23
MbDCode/EndFrameqc.h.bak
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
#include "EndFramec.h"
|
||||
#include "FullColumn.h"
|
||||
#include "FullMatrix.h"
|
||||
|
||||
namespace MbD {
|
||||
class EndFramec;
|
||||
|
||||
class EndFrameqc : public EndFramec
|
||||
{
|
||||
//prOeOpE pprOeOpEpE pAOepE ppAOepEpE
|
||||
public:
|
||||
EndFrameqc();
|
||||
FullMatDptr prOeOpE = std::make_shared<FullMatrix<double>>(3, 4);
|
||||
//std::shared_ptr<FullMatrix<std::shared_ptr<FullColumn<double>>>> pprOeOpEpE = std::make_shared<FullMatrix<std::shared_ptr<FullColumn<double>>>>(3, 4);
|
||||
std::shared_ptr<FullColumn<std::shared_ptr<FullMatrix<double>>>> pAOepE = std::make_shared<FullColumn<std::shared_ptr<FullMatrix<double>>>>(4);
|
||||
//std::shared_ptr<FullMatrix<std::shared_ptr<FullMatrix<double>>>> ppAOepEpE = std::make_shared<FullMatrix<std::shared_ptr<FullMatrix<double>>>>(4, 4);
|
||||
//FullMatrix<FullColumn<double>>* pprOeOpEpE1 = new FullMatrix<FullColumn<double>>(3, 4);
|
||||
//FullColumn<FullMatrix<double>>* pAOepE1 = new FullColumn<FullMatrix<double>>(4);
|
||||
//FullMatrix<FullMatrix<double>>* ppAOepEpE1 = new FullMatrix<FullMatrix<double>>(4, 4);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
#pragma once
|
||||
#include "EndFrameqc.h"
|
||||
|
||||
namespace MbD {
|
||||
class EndFrameqct : public EndFrameqc
|
||||
{
|
||||
//time rmemBlks prmemptBlks pprmemptptBlks phiThePsiBlks pPhiThePsiptBlks ppPhiThePsiptptBlks
|
||||
//rmem prmempt pprmemptpt aAme pAmept ppAmeptpt prOeOpt pprOeOpEpt pprOeOptpt pAOept ppAOepEpt ppAOeptpt
|
||||
public:
|
||||
double time;
|
||||
FullColDptr rmem, prmempt, pprmemptpt;
|
||||
FullMatDptr aAme, pAmept, ppAmeptpt;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
1
MbDCode/EulerArray.cpp
Normal file
1
MbDCode/EulerArray.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "EulerArray.h"
|
||||
9
MbDCode/EulerArray.h
Normal file
9
MbDCode/EulerArray.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include "FullColumn.h"
|
||||
|
||||
namespace MbD {
|
||||
class EulerArray : public FullColumn<double>
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1 +1,16 @@
|
||||
#include "EulerConstraint.h"
|
||||
#include "Item.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
EulerConstraint::EulerConstraint()
|
||||
{
|
||||
}
|
||||
|
||||
MbD::EulerConstraint::EulerConstraint(const char* str) : Constraint(str)
|
||||
{
|
||||
}
|
||||
|
||||
void MbD::EulerConstraint::initialize()
|
||||
{
|
||||
}
|
||||
|
||||
12
MbDCode/EulerConstraint.cpp.bak
Normal file
12
MbDCode/EulerConstraint.cpp.bak
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "EulerConstraint.h"
|
||||
#include "Constraint.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
EulerConstraint::EulerConstraint()
|
||||
{
|
||||
}
|
||||
|
||||
EulerConstraint::EulerConstraint(Item* item) : Constraint::Constraint(item)
|
||||
{
|
||||
}
|
||||
@@ -6,14 +6,15 @@
|
||||
#include "FullRow.h"
|
||||
|
||||
namespace MbD {
|
||||
|
||||
class EulerConstraint : public Constraint
|
||||
{
|
||||
public:
|
||||
EulerConstraint() : Constraint() {
|
||||
}
|
||||
//pGpE iqE
|
||||
FullRow<double> pGpE = FullRow<double>(4); //partial derivative of G wrt pE
|
||||
public:
|
||||
EulerConstraint();
|
||||
EulerConstraint(const char* str);
|
||||
void initialize();
|
||||
|
||||
FullRowDptr pGpE = std::make_shared<FullRow<double>>(4); //partial derivative of G wrt pE
|
||||
int iqE = -1;
|
||||
};
|
||||
}
|
||||
|
||||
20
MbDCode/EulerConstraint.h.bak
Normal file
20
MbDCode/EulerConstraint.h.bak
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "Constraint.h"
|
||||
#include "FullRow.h"
|
||||
|
||||
namespace MbD {
|
||||
class EulerConstraint : public Constraint
|
||||
{
|
||||
//pGpE iqE
|
||||
public:
|
||||
EulerConstraint();
|
||||
EulerConstraint(Item* item);
|
||||
|
||||
FullRowDptr pGpE = std::make_shared<FullRow<double>>(4); //partial derivative of G wrt pE
|
||||
int iqE = -1;
|
||||
};
|
||||
}
|
||||
|
||||
95
MbDCode/EulerParameters.cpp
Normal file
95
MbDCode/EulerParameters.cpp
Normal file
@@ -0,0 +1,95 @@
|
||||
#include <memory>
|
||||
|
||||
#include "EulerParameters.h"
|
||||
#include "FullColumn.h"
|
||||
#include "FullMatrix.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
//typedef std::shared_ptr<FullMatrix<std::shared_ptr<FullColumn<double>>>> FMatFColDptr;
|
||||
|
||||
std::shared_ptr<FullMatrix<std::shared_ptr<FullColumn<double>>>> EulerParameters::ppApEpEtimesColumn(FullColDptr col)
|
||||
{
|
||||
double a2c1 = 2 * col->at(0);
|
||||
double a2c2 = 2 * col->at(1);
|
||||
double a2c3 = 2 * col->at(2);
|
||||
double m2c1 = 0 - a2c1;
|
||||
double m2c2 = 0 - a2c2;
|
||||
double m2c3 = 0 - a2c3;
|
||||
auto col11 = std::make_shared<FullColumn<double>>(ListD{ a2c1, m2c2, m2c3 });
|
||||
auto col12 = std::make_shared<FullColumn<double>>(ListD{ a2c2, a2c1, 0 });
|
||||
auto col13 = std::make_shared<FullColumn<double>>(ListD{ a2c3, 0, a2c1 });
|
||||
auto col14 = std::make_shared<FullColumn<double>>(ListD{ 0, m2c3, a2c2 });
|
||||
auto col22 = std::make_shared<FullColumn<double>>(ListD{ m2c1, a2c2, m2c3 });
|
||||
auto col23 = std::make_shared<FullColumn<double>>(ListD{ 0, a2c3, a2c2 });
|
||||
auto col24 = std::make_shared<FullColumn<double>>(ListD{ a2c3, 0, m2c1 });
|
||||
auto col33 = std::make_shared<FullColumn<double>>(ListD{ m2c1, m2c2, a2c3 });
|
||||
auto col34 = std::make_shared<FullColumn<double>>(ListD{ m2c2, a2c1, 0 });
|
||||
auto col44 = std::make_shared<FullColumn<double>>(ListD{ a2c1, a2c2, a2c3 });
|
||||
auto answer = std::make_shared<FullMatrix<std::shared_ptr<FullColumn<double>>>>(4, 4);
|
||||
auto row1 = answer->at(0);
|
||||
row1->at(0) = col11;
|
||||
row1->at(1) = col12;
|
||||
row1->at(2) = col13;
|
||||
row1->at(3) = col14;
|
||||
auto row2 = answer->at(0);
|
||||
row2->at(0) = col12;
|
||||
row2->at(1) = col22;
|
||||
row2->at(2) = col23;
|
||||
row2->at(3) = col24;
|
||||
auto row3 = answer->at(0);
|
||||
row3->at(0) = col13;
|
||||
row3->at(1) = col23;
|
||||
row3->at(2) = col33;
|
||||
row3->at(3) = col34;
|
||||
auto row4 = answer->at(0);
|
||||
row4->at(0) = col14;
|
||||
row4->at(1) = col24;
|
||||
row4->at(2) = col34;
|
||||
row4->at(3) = col44;
|
||||
return answer;
|
||||
}
|
||||
|
||||
std::shared_ptr<FullMatrix<std::shared_ptr<FullMatrix<double>>>> EulerParameters::ppApEpEtimesMatrix(FullMatDptr mat)
|
||||
{
|
||||
FullRowDptr a2m1 = mat->at(0)->times(2.0);
|
||||
FullRowDptr a2m2 = mat->at(1)->times(2.0);
|
||||
FullRowDptr a2m3 = mat->at(2)->times(2.0);
|
||||
FullRowDptr m2m1 = a2m1->negated();
|
||||
FullRowDptr m2m2 = a2m2->negated();
|
||||
FullRowDptr m2m3 = a2m3->negated();
|
||||
auto aaaa = std::make_shared<std::vector<double>>(3, 0.0);
|
||||
FullRowDptr zero = std::make_shared<FullRow<double>>(3, 0.0);
|
||||
auto mat11 = std::make_shared<FullMatrix<double>>(ListFRD{ a2m1, m2m2, m2m3 });
|
||||
auto mat12 = std::make_shared<FullMatrix<double>>(ListFRD{ a2m2, a2m1, zero });
|
||||
auto mat13 = std::make_shared<FullMatrix<double>>(ListFRD{ a2m3, zero, a2m1 });
|
||||
auto mat14 = std::make_shared<FullMatrix<double>>(ListFRD{ zero, m2m3, a2m2 });
|
||||
auto mat22 = std::make_shared<FullMatrix<double>>(ListFRD{ m2m1, a2m2, m2m3 });
|
||||
auto mat23 = std::make_shared<FullMatrix<double>>(ListFRD{ zero, a2m3, a2m2 });
|
||||
auto mat24 = std::make_shared<FullMatrix<double>>(ListFRD{ a2m3, zero, m2m1 });
|
||||
auto mat33 = std::make_shared<FullMatrix<double>>(ListFRD{ m2m1, m2m2, a2m3 });
|
||||
auto mat34 = std::make_shared<FullMatrix<double>>(ListFRD{ m2m2, a2m1, zero });
|
||||
auto mat44 = std::make_shared<FullMatrix<double>>(ListFRD{ a2m1, a2m2, a2m3 });
|
||||
auto answer = std::make_shared<FullMatrix<std::shared_ptr<FullMatrix<double>>>>(4, 4);
|
||||
auto row1 = answer->at(0);
|
||||
row1->at(0) = mat11;
|
||||
row1->at(1) = mat12;
|
||||
row1->at(2) = mat13;
|
||||
row1->at(3) = mat14;
|
||||
auto row2 = answer->at(0);
|
||||
row2->at(0) = mat12;
|
||||
row2->at(1) = mat22;
|
||||
row2->at(2) = mat23;
|
||||
row2->at(3) = mat24;
|
||||
auto row3 = answer->at(0);
|
||||
row3->at(0) = mat13;
|
||||
row3->at(1) = mat23;
|
||||
row3->at(2) = mat33;
|
||||
row3->at(3) = mat34;
|
||||
auto row4 = answer->at(0);
|
||||
row4->at(0) = mat14;
|
||||
row4->at(1) = mat24;
|
||||
row4->at(2) = mat34;
|
||||
row4->at(3) = mat44;
|
||||
return answer;
|
||||
}
|
||||
18
MbDCode/EulerParameters.h
Normal file
18
MbDCode/EulerParameters.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include "EulerArray.h"
|
||||
#include "FullColumn.h"
|
||||
#include "FullMatrix.h"
|
||||
|
||||
namespace MbD {
|
||||
class EulerParameters : public EulerArray
|
||||
{
|
||||
//aA aB aC pApE
|
||||
public:
|
||||
static std::shared_ptr<FullMatrix<std::shared_ptr<FullColumn<double>>>> ppApEpEtimesColumn(FullColDptr col);
|
||||
static std::shared_ptr<FullMatrix<std::shared_ptr<FullMatrix<double>>>> ppApEpEtimesMatrix(FullMatDptr col);
|
||||
|
||||
};
|
||||
|
||||
//typedef std::shared_ptr<FullMatrix<std::shared_ptr<FullColumn<double>>>> FMatFColDptr;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@ namespace MbD {
|
||||
class FullColumn : public Vector<T>
|
||||
{
|
||||
public:
|
||||
FullColumn(int i) : Vector<T>(i) {}
|
||||
FullColumn(size_t count) : Vector<T>(count) {}
|
||||
FullColumn(size_t count, const T& value) : Vector<T>(count, value) {}
|
||||
FullColumn(std::initializer_list<T> list) : Vector<T>{ list } {}
|
||||
std::string toString()
|
||||
{
|
||||
|
||||
@@ -19,6 +19,12 @@ namespace MbD {
|
||||
this->push_back(row);
|
||||
}
|
||||
}
|
||||
FullMatrix(std::initializer_list<std::shared_ptr<FullRow<T>>> listOfRows) {
|
||||
for (auto row : listOfRows)
|
||||
{
|
||||
this->push_back(row);
|
||||
}
|
||||
}
|
||||
FullMatrix(std::initializer_list<std::initializer_list<T>> list2D) {
|
||||
for (auto rowList : list2D)
|
||||
{
|
||||
@@ -29,8 +35,10 @@ namespace MbD {
|
||||
};
|
||||
|
||||
typedef std::initializer_list<std::initializer_list<double>> ListListD;
|
||||
typedef std::initializer_list<FullRowDptr> ListFRD;
|
||||
typedef std::shared_ptr<FullMatrix<double>> FullMatDptr;
|
||||
//typedef std::shared_ptr<FullMatrix<std::shared_ptr<FullColumn<double>>>> FullMatFCptr;
|
||||
//typedef std::shared_ptr<FullMatrix<std::shared_ptr<FullMatrix<double>>>> FullMatFMptr;
|
||||
//typedef std::shared_ptr<FullMatrix<std::shared_ptr<FullColumn<double>>>> FMatFColDptr;
|
||||
typedef std::shared_ptr<FullMatrix<std::shared_ptr<FullMatrix<double>>>> FMatFMatDptr;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,29 @@ namespace MbD {
|
||||
{
|
||||
public:
|
||||
FullRow() {}
|
||||
FullRow(int i) : Vector<T>(i) {}
|
||||
FullRow(size_t count) : Vector<T>(count) {}
|
||||
FullRow(size_t count, const T& value) : Vector<T>(count, value) {}
|
||||
FullRow(std::initializer_list<T> list) : Vector<T>{ list } {}
|
||||
std::shared_ptr<FullRow<T>> times(double a);
|
||||
std::shared_ptr<FullRow<T>> negated();
|
||||
|
||||
};
|
||||
typedef std::shared_ptr<FullRow<double>> FullRowDptr;
|
||||
|
||||
template<typename T>
|
||||
inline std::shared_ptr<FullRow<T>> FullRow<T>::times(double a)
|
||||
{
|
||||
size_t n = this->size();
|
||||
auto answer = std::make_shared<FullRow>(n);
|
||||
for (int i = 0; i < n; i++) {
|
||||
answer->at(i) = this->at(i) * a;
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
template<typename T>
|
||||
inline std::shared_ptr<FullRow<T>> FullRow<T>::negated()
|
||||
{
|
||||
return this->times(-1.0);
|
||||
}
|
||||
}
|
||||
|
||||
typedef std::shared_ptr<MbD::FullRow<double>> FullRowDptr;
|
||||
|
||||
1
MbDCode/IndependentVariable.cpp
Normal file
1
MbDCode/IndependentVariable.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "IndependentVariable.h"
|
||||
9
MbDCode/IndependentVariable.h
Normal file
9
MbDCode/IndependentVariable.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include "Variable.h"
|
||||
namespace MbD {
|
||||
class IndependentVariable :
|
||||
public Variable
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,21 +1,13 @@
|
||||
#include "Item.h"
|
||||
|
||||
void MbD::Item::setName(std::string& str)
|
||||
using namespace MbD;
|
||||
|
||||
void Item::setName(std::string& str)
|
||||
{
|
||||
name = str;
|
||||
}
|
||||
|
||||
const std::string& MbD::Item::getName() const
|
||||
const std::string& Item::getName() const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
//
|
||||
//void MbD::Item::setMyInt(int val)
|
||||
//{
|
||||
// myInt = val;
|
||||
//}
|
||||
//
|
||||
//int MbD::Item::getMyInt()
|
||||
//{
|
||||
// return myInt;
|
||||
//}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
namespace MbD {
|
||||
class Item
|
||||
{
|
||||
//name
|
||||
public:
|
||||
Item() {}
|
||||
Item(const char* str) : name(str) {}
|
||||
void setName(std::string& str);
|
||||
const std::string& getName() const;
|
||||
private:
|
||||
|
||||
16
MbDCode/Item.h.bak
Normal file
16
MbDCode/Item.h.bak
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
namespace MbD {
|
||||
class Item
|
||||
{
|
||||
public:
|
||||
Item() {}
|
||||
Item(std::string str) : name(str) {}
|
||||
void setName(std::string& str);
|
||||
const std::string& getName() const;
|
||||
private:
|
||||
std::string name;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,30 @@
|
||||
#include "Joint.h"
|
||||
|
||||
MbD::Joint::Joint()
|
||||
{
|
||||
using namespace MbD;
|
||||
|
||||
Joint::Joint() {
|
||||
initialize();
|
||||
}
|
||||
|
||||
Joint::Joint(const char* str) : Item(str) {
|
||||
initialize();
|
||||
}
|
||||
|
||||
void Joint::initialize()
|
||||
{
|
||||
constraints = std::make_unique<std::vector<std::shared_ptr<Constraint>>>();
|
||||
}
|
||||
|
||||
void Joint::connectsItoJ(std::shared_ptr<EndFramec> frmi, std::shared_ptr<EndFramec> frmj)
|
||||
{
|
||||
frmI = frmi;
|
||||
frmJ = frmj;
|
||||
}
|
||||
|
||||
void Joint::initializeLocally()
|
||||
{
|
||||
}
|
||||
|
||||
void Joint::initializeGlobally()
|
||||
{
|
||||
}
|
||||
|
||||
22
MbDCode/Joint.cpp.bak
Normal file
22
MbDCode/Joint.cpp.bak
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "Joint.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
Joint::Joint()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Joint::connectsItoJ(std::shared_ptr<EndFramec> frmi, std::shared_ptr<EndFramec> frmj)
|
||||
{
|
||||
frmI = frmi;
|
||||
frmJ = frmj;
|
||||
}
|
||||
|
||||
void Joint::initializeLocally()
|
||||
{
|
||||
}
|
||||
|
||||
void Joint::initializeGlobally()
|
||||
{
|
||||
}
|
||||
@@ -15,9 +15,15 @@ namespace MbD {
|
||||
//frmI frmJ constraints friction
|
||||
public:
|
||||
Joint();
|
||||
Joint(const char* str);
|
||||
void initialize();
|
||||
virtual void connectsItoJ(std::shared_ptr<EndFramec> frmI, std::shared_ptr<EndFramec> frmJ);
|
||||
void initializeLocally();
|
||||
void initializeGlobally();
|
||||
|
||||
std::shared_ptr<EndFramec> frmI;
|
||||
std::shared_ptr<EndFramec> frmJ;
|
||||
std::vector<std::shared_ptr<Constraint>> constraints;
|
||||
std::unique_ptr<std::vector<std::shared_ptr<Constraint>>> constraints;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
28
MbDCode/Joint.h.bak
Normal file
28
MbDCode/Joint.h.bak
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "Item.h"
|
||||
#include "EndFramec.h"
|
||||
#include "Constraint.h"
|
||||
|
||||
namespace MbD {
|
||||
class EndFramec;
|
||||
class Constraint;
|
||||
|
||||
class Joint : public Item
|
||||
{
|
||||
//frmI frmJ constraints friction
|
||||
public:
|
||||
Joint();
|
||||
virtual void connectsItoJ(std::shared_ptr<EndFramec> frmI, std::shared_ptr<EndFramec> frmJ);
|
||||
void initializeLocally();
|
||||
void initializeGlobally();
|
||||
|
||||
std::shared_ptr<EndFramec> frmI;
|
||||
std::shared_ptr<EndFramec> frmJ;
|
||||
std::unique_ptr<std::vector<std::shared_ptr<Constraint>>> constraints;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include "PartFrame.h"
|
||||
#include "MarkerFrame.h"
|
||||
#include "EndFramec.h"
|
||||
#include "EndFrameqc.h"
|
||||
@@ -5,11 +6,19 @@
|
||||
using namespace MbD;
|
||||
|
||||
MarkerFrame::MarkerFrame()
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
|
||||
MbD::MarkerFrame::MarkerFrame(const char* str) : CartesianFrame(str) {
|
||||
initialize();
|
||||
}
|
||||
|
||||
void MbD::MarkerFrame::initialize()
|
||||
{
|
||||
partFrame = nullptr;
|
||||
auto endFrm = std::make_shared<EndFrameqc>();
|
||||
std::string str = "EndFrame1";
|
||||
endFrm->setName(str);
|
||||
endFrames = std::make_unique<std::vector<std::shared_ptr<EndFramec>>>();
|
||||
auto endFrm = std::make_shared<EndFrameqc>("EndFrame1");
|
||||
this->addEndFrame(endFrm);
|
||||
}
|
||||
|
||||
@@ -18,6 +27,10 @@ void MarkerFrame::setPartFrame(PartFrame* partFrm)
|
||||
partFrame = partFrm;
|
||||
}
|
||||
|
||||
PartFrame* MarkerFrame::getPartFrame() {
|
||||
return partFrame;
|
||||
}
|
||||
|
||||
void MarkerFrame::setrpmp(FullColDptr x)
|
||||
{
|
||||
rpmp->copy(x);
|
||||
@@ -30,5 +43,5 @@ void MarkerFrame::setaApm(FullMatDptr x)
|
||||
void MarkerFrame::addEndFrame(std::shared_ptr<EndFramec> endFrm)
|
||||
{
|
||||
endFrm->setMarkerFrame(this);
|
||||
endFrames.push_back(endFrm);
|
||||
endFrames->push_back(endFrm);
|
||||
}
|
||||
|
||||
37
MbDCode/MarkerFrame.cpp.bak
Normal file
37
MbDCode/MarkerFrame.cpp.bak
Normal file
@@ -0,0 +1,37 @@
|
||||
#include "PartFrame.h"
|
||||
#include "MarkerFrame.h"
|
||||
#include "EndFramec.h"
|
||||
#include "EndFrameqc.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
MarkerFrame::MarkerFrame()
|
||||
{
|
||||
auto endFrm = std::make_shared<EndFrameqc>();
|
||||
std::string str = "EndFrame1";
|
||||
endFrm->setName(str);
|
||||
this->addEndFrame(endFrm);
|
||||
}
|
||||
|
||||
void MarkerFrame::setPartFrame(std::shared_ptr<PartFrame> partFrm)
|
||||
{
|
||||
partFrame = partFrm;
|
||||
}
|
||||
|
||||
std::shared_ptr<PartFrame> MarkerFrame::getPartFrame() {
|
||||
return partFrame.lock();
|
||||
}
|
||||
|
||||
void MarkerFrame::setrpmp(FullColDptr x)
|
||||
{
|
||||
rpmp->copy(x);
|
||||
}
|
||||
|
||||
void MarkerFrame::setaApm(FullMatDptr x)
|
||||
{
|
||||
aApm->copy(x);
|
||||
}
|
||||
void MarkerFrame::addEndFrame(std::shared_ptr<EndFramec> endFrm)
|
||||
{
|
||||
endFrames->push_back(endFrm);
|
||||
}
|
||||
@@ -8,28 +8,31 @@
|
||||
#include "EndFramec.h"
|
||||
|
||||
namespace MbD {
|
||||
class PartFrame;
|
||||
class EndFramec;
|
||||
class PartFrame;
|
||||
class EndFramec;
|
||||
|
||||
class MarkerFrame : public CartesianFrame
|
||||
{
|
||||
//partFrame rpmp aApm rOmO aAOm prOmOpE pAOmpE pprOmOpEpE ppAOmpEpE endFrames
|
||||
public:
|
||||
MarkerFrame();
|
||||
void setPartFrame(PartFrame* partFrm);
|
||||
void setrpmp(FullColDptr x);
|
||||
void setaApm(FullMatDptr x);
|
||||
void addEndFrame(std::shared_ptr<EndFramec> x);
|
||||
class MarkerFrame : public CartesianFrame
|
||||
{
|
||||
//partFrame rpmp aApm rOmO aAOm prOmOpE pAOmpE pprOmOpEpE ppAOmpEpE endFrames
|
||||
public:
|
||||
MarkerFrame();
|
||||
MarkerFrame(const char* str);
|
||||
void initialize();
|
||||
void setPartFrame(PartFrame* partFrm);
|
||||
PartFrame* getPartFrame();
|
||||
void setrpmp(FullColDptr x);
|
||||
void setaApm(FullMatDptr x);
|
||||
void addEndFrame(std::shared_ptr<EndFramec> x);
|
||||
|
||||
PartFrame* partFrame;
|
||||
FullColDptr rpmp = std::make_shared<FullColumn<double>>(3);
|
||||
FullMatDptr aApm = std::make_shared<FullMatrix<double>>(3, 3);
|
||||
FullColDptr rOmO = std::make_shared<FullColumn<double>>(3);
|
||||
FullMatDptr aAOm = std::make_shared<FullMatrix<double>>(3, 3);
|
||||
FullMatDptr prOmOpE = std::make_shared<FullMatrix<double>>(3, 4);
|
||||
FullColumn<FullMatrix<double>>* pAOmpE = new FullColumn<FullMatrix<double>>(4);
|
||||
std::vector<std::shared_ptr<EndFramec>> endFrames;
|
||||
PartFrame* partFrame;
|
||||
FullColDptr rpmp = std::make_shared<FullColumn<double>>(3);
|
||||
FullMatDptr aApm = std::make_shared<FullMatrix<double>>(3, 3);
|
||||
FullColDptr rOmO = std::make_shared<FullColumn<double>>(3);
|
||||
FullMatDptr aAOm = std::make_shared<FullMatrix<double>>(3, 3);
|
||||
FullMatDptr prOmOpE = std::make_shared<FullMatrix<double>>(3, 4);
|
||||
FullColumn<FullMatrix<double>>* pAOmpE = new FullColumn<FullMatrix<double>>(4);
|
||||
std::unique_ptr<std::vector<std::shared_ptr<EndFramec>>> endFrames;
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
36
MbDCode/MarkerFrame.h.bak
Normal file
36
MbDCode/MarkerFrame.h.bak
Normal file
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
|
||||
#include "CartesianFrame.h"
|
||||
#include "PartFrame.h"
|
||||
#include "FullColumn.h"
|
||||
#include "FullMatrix.h"
|
||||
#include "EndFramec.h"
|
||||
|
||||
namespace MbD {
|
||||
class PartFrame;
|
||||
class EndFramec;
|
||||
|
||||
class MarkerFrame : public CartesianFrame
|
||||
{
|
||||
//partFrame rpmp aApm rOmO aAOm prOmOpE pAOmpE pprOmOpEpE ppAOmpEpE endFrames
|
||||
public:
|
||||
MarkerFrame();
|
||||
void setPartFrame(std::shared_ptr<PartFrame> partFrm);
|
||||
std::shared_ptr<PartFrame> getPartFrame();
|
||||
void setrpmp(FullColDptr x);
|
||||
void setaApm(FullMatDptr x);
|
||||
void addEndFrame(std::shared_ptr<EndFramec> x);
|
||||
|
||||
std::weak_ptr<PartFrame> partFrame;
|
||||
FullColDptr rpmp = std::make_shared<FullColumn<double>>(3);
|
||||
FullMatDptr aApm = std::make_shared<FullMatrix<double>>(3, 3);
|
||||
FullColDptr rOmO = std::make_shared<FullColumn<double>>(3);
|
||||
FullMatDptr aAOm = std::make_shared<FullMatrix<double>>(3, 3);
|
||||
FullMatDptr prOmOpE = std::make_shared<FullMatrix<double>>(3, 4);
|
||||
FullColumn<FullMatrix<double>>* pAOmpE = new FullColumn<FullMatrix<double>>(4);
|
||||
std::unique_ptr<std::vector<std::shared_ptr<EndFramec>>> endFrames;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
#include <iostream>
|
||||
/*********************************************************************
|
||||
* @file MbDCode.cpp
|
||||
*
|
||||
* @brief Program to assemble a piston crank system.
|
||||
*********************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include "System.h"
|
||||
#include "FullColumn.h"
|
||||
#include "FullMatrix.h"
|
||||
@@ -7,6 +13,7 @@
|
||||
#include "CylindricalJoint.h"
|
||||
#include "RevoluteJoint.h"
|
||||
#include "ZRotation.h"
|
||||
#include "EndFrameqc.h"
|
||||
#include "MbDCode.h"
|
||||
|
||||
using namespace MbD;
|
||||
@@ -14,10 +21,10 @@ using namespace MbD;
|
||||
int main()
|
||||
{
|
||||
std::cout << "Hello World!\n";
|
||||
System& TheSystem = System::getInstance();
|
||||
std::string str = "TheSystem";
|
||||
TheSystem.setName(str);
|
||||
//System& TheSystem = System::getInstance();
|
||||
System& TheSystem = System::getInstance("TheSystem");
|
||||
std::cout << "TheSystem.getName() " << TheSystem.getName() << std::endl;
|
||||
std::string str;
|
||||
FullColDptr qX, qE;
|
||||
FullColDptr rpmp;
|
||||
FullMatDptr aApm;
|
||||
@@ -26,9 +33,7 @@ int main()
|
||||
fullRow = std::make_shared<FullRow<double>>(4);
|
||||
fullRow->copy(row);
|
||||
//
|
||||
auto assembly1 = std::make_shared<Part>();
|
||||
str = "Assembly1";
|
||||
assembly1->setName(str);
|
||||
auto assembly1 = std::make_shared<Part>("Assembly1");
|
||||
std::cout << "assembly1->getName() " << assembly1->getName() << std::endl;
|
||||
qX = std::make_shared<FullColumn<double>>(ListD{ 0, 0, 0 });
|
||||
qE = std::make_shared<FullColumn<double>>(ListD{ 0, 0, 0, 1 });
|
||||
@@ -38,9 +43,8 @@ int main()
|
||||
std::cout << "assembly1->getqE() " << assembly1->getqE()->toString() << std::endl;
|
||||
TheSystem.addPart(assembly1);
|
||||
{
|
||||
auto marker1 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker1";
|
||||
marker1->setName(str);
|
||||
auto partFrame = assembly1->partFrame;
|
||||
auto marker1 = std::make_shared<MarkerFrame>("Marker1");
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 });
|
||||
marker1->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
@@ -49,11 +53,9 @@ int main()
|
||||
{ 0, -1, 0 }
|
||||
});
|
||||
marker1->setaApm(aApm);
|
||||
assembly1->partFrame->addMarkerFrame(marker1);
|
||||
partFrame->addMarkerFrame(marker1);
|
||||
//
|
||||
auto marker2 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker2";
|
||||
marker2->setName(str);
|
||||
auto marker2 = std::make_shared<MarkerFrame>("Marker2");
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ 0.0, 0.0, 0.0 });
|
||||
marker2->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
@@ -62,21 +64,18 @@ int main()
|
||||
{ 0, 0, 1 }
|
||||
});
|
||||
marker2->setaApm(aApm);
|
||||
assembly1->partFrame->addMarkerFrame(marker2);
|
||||
partFrame->addMarkerFrame(marker2);
|
||||
}
|
||||
//
|
||||
auto part1 = std::make_shared<Part>();
|
||||
str = "Part1";
|
||||
part1->setName(str);
|
||||
auto part1 = std::make_shared<Part>("Part1");
|
||||
qX = std::make_shared<FullColumn<double>>(ListD{ 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 });
|
||||
qE = std::make_shared<FullColumn<double>>(ListD{ 0.0, 0.0, 1.4248456266393e-10, 1.0 });
|
||||
part1->setqX(qX);
|
||||
part1->setqE(qE);
|
||||
TheSystem.parts.push_back(part1);
|
||||
TheSystem.parts->push_back(part1);
|
||||
{
|
||||
auto marker1 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker1";
|
||||
marker1->setName(str);
|
||||
auto partFrame = part1->partFrame;
|
||||
auto marker1 = std::make_shared<MarkerFrame>("Marker1");
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ -0.38423368514246, -2.6661567755108e-17, 0.048029210642807 });
|
||||
marker1->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
@@ -85,11 +84,9 @@ int main()
|
||||
{ 0, 0, 1 }
|
||||
});
|
||||
marker1->setaApm(aApm);
|
||||
part1->partFrame->addMarkerFrame(marker1);
|
||||
partFrame->addMarkerFrame(marker1);
|
||||
//
|
||||
auto marker2 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker2";
|
||||
marker2->setName(str);
|
||||
auto marker2 = std::make_shared<MarkerFrame>("Marker2");
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ 0.38423368514246, -2.6661567755108e-17, 0.048029210642807 });
|
||||
marker2->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
@@ -98,21 +95,18 @@ int main()
|
||||
{ 0, 0, 1 }
|
||||
});
|
||||
marker2->setaApm(aApm);
|
||||
part1->partFrame->addMarkerFrame(marker2);
|
||||
partFrame->addMarkerFrame(marker2);
|
||||
}
|
||||
//
|
||||
auto part2 = std::make_shared<Part>();
|
||||
str = "Part2";
|
||||
part2->setName(str);
|
||||
auto part2 = std::make_shared<Part>("Part2");
|
||||
qX = std::make_shared<FullColumn<double>>(ListD{ 0.38423366582893, 0.49215308269277, 0.048029210642807 });
|
||||
qE = std::make_shared<FullColumn<double>>(ListD{ 0.0, 0.0, 0.89871701272344, 0.4385290538168 });
|
||||
part2->setqX(qX);
|
||||
part2->setqE(qE);
|
||||
TheSystem.parts.push_back(part2);
|
||||
TheSystem.parts->push_back(part2);
|
||||
{
|
||||
auto marker1 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker1";
|
||||
marker1->setName(str);
|
||||
auto partFrame = part2->partFrame;
|
||||
auto marker1 = std::make_shared<MarkerFrame>("Marker1");
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ -0.6243797383565, 1.1997705489799e-16, -0.048029210642807 });
|
||||
marker1->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
@@ -121,11 +115,9 @@ int main()
|
||||
{0.0, 0.0, 1.0}
|
||||
});
|
||||
marker1->setaApm(aApm);
|
||||
part2->partFrame->addMarkerFrame(marker1);
|
||||
partFrame->addMarkerFrame(marker1);
|
||||
//
|
||||
auto marker2 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker2";
|
||||
marker2->setName(str);
|
||||
auto marker2 = std::make_shared<MarkerFrame>("Marker2");
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ 0.6243797383565, -2.1329254204087e-16, -0.048029210642807 });
|
||||
marker2->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
@@ -134,21 +126,18 @@ int main()
|
||||
{-2.2204460492503e-16, -4.1633363423443e-17, 1.0}
|
||||
});
|
||||
marker2->setaApm(aApm);
|
||||
part2->partFrame->addMarkerFrame(marker2);
|
||||
partFrame->addMarkerFrame(marker2);
|
||||
}
|
||||
//
|
||||
auto part3 = std::make_shared<Part>();
|
||||
str = "Part3";
|
||||
part3->setName(str);
|
||||
auto part3 = std::make_shared<Part>("Part3");
|
||||
qX = std::make_shared<FullColumn<double>>(ListD{ -1.284772285311e-18, 1.4645982581368, -4.788228906425e-17 });
|
||||
qE = std::make_shared<FullColumn<double>>(ListD{ 0.70710678118655, 0.70710678118655, 0.0, 0.0 });
|
||||
part3->setqX(qX);
|
||||
part3->setqE(qE);
|
||||
TheSystem.parts.push_back(part3);
|
||||
TheSystem.parts->push_back(part3);
|
||||
{
|
||||
auto marker1 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker1";
|
||||
marker1->setName(str);
|
||||
auto partFrame = part3->partFrame;
|
||||
auto marker1 = std::make_shared<MarkerFrame>("Marker1");
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ -0.48029210642807, 7.6201599718927e-18, -2.816737703896e-17 });
|
||||
marker1->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
@@ -157,11 +146,9 @@ int main()
|
||||
{-1.0785207688569e-32, 2.2204460492503e-16, -1.0}
|
||||
});
|
||||
marker1->setaApm(aApm);
|
||||
part3->partFrame->addMarkerFrame(marker1);
|
||||
partFrame->addMarkerFrame(marker1);
|
||||
//
|
||||
auto marker2 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker2";
|
||||
marker2->setName(str);
|
||||
auto marker2 = std::make_shared<MarkerFrame>("Marker2");
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ 0.48029210642807, 1.7618247880058e-17, 2.5155758471256e-17 });
|
||||
marker2->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
@@ -170,12 +157,28 @@ int main()
|
||||
{-6.9388939039072e-18, 1.0, -7.4837411882581e-50}
|
||||
});
|
||||
marker2->setaApm(aApm);
|
||||
part3->partFrame->addMarkerFrame(marker2);
|
||||
partFrame->addMarkerFrame(marker2);
|
||||
}
|
||||
//
|
||||
auto cylJoint4 = std::shared_ptr<CylindricalJoint>();
|
||||
auto revJoint3 = std::shared_ptr<RevoluteJoint>();
|
||||
auto revJoint2 = std::shared_ptr<RevoluteJoint>();
|
||||
auto revJoint1 = std::shared_ptr<RevoluteJoint>();
|
||||
auto rotMotion1 = std::shared_ptr<ZRotation>();
|
||||
auto cylJoint4 = std::make_shared<CylindricalJoint>("CylJoint4");
|
||||
cylJoint4->connectsItoJ(part3->partFrame->endFrame("Marker2"), assembly1->partFrame->endFrame("Marker1"));
|
||||
TheSystem.jointsMotions->push_back(cylJoint4);
|
||||
|
||||
auto revJoint3 = std::make_shared<RevoluteJoint>("RevJoint3");
|
||||
revJoint3->connectsItoJ(part2->partFrame->endFrame("Marker2"), part3->partFrame->endFrame("Marker1"));
|
||||
TheSystem.jointsMotions->push_back(revJoint3);
|
||||
|
||||
auto revJoint2 = std::make_shared<RevoluteJoint>("RevJoint2");
|
||||
revJoint2->connectsItoJ(part1->partFrame->endFrame("Marker2"), part2->partFrame->endFrame("Marker1"));
|
||||
TheSystem.jointsMotions->push_back(revJoint2);
|
||||
|
||||
auto revJoint1 = std::make_shared<RevoluteJoint>("RevJoint1");
|
||||
revJoint1->connectsItoJ(assembly1->partFrame->endFrame("Marker2"), part1->partFrame->endFrame("Marker1"));
|
||||
TheSystem.jointsMotions->push_back(revJoint1);
|
||||
|
||||
auto rotMotion1 = std::make_shared<ZRotation>("RotMotion1");
|
||||
rotMotion1->connectsItoJ(assembly1->partFrame->endFrame("Marker2"), part1->partFrame->endFrame("Marker1"));
|
||||
TheSystem.jointsMotions->push_back(rotMotion1);
|
||||
//
|
||||
TheSystem.runKINEMATICS();
|
||||
}
|
||||
240
MbDCode/MbDCode.cpp.bak
Normal file
240
MbDCode/MbDCode.cpp.bak
Normal file
@@ -0,0 +1,240 @@
|
||||
/*********************************************************************
|
||||
* @file MbDCode.cpp
|
||||
*
|
||||
* @brief Program to assemble a piston crank system.
|
||||
*********************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include "System.h"
|
||||
#include "FullColumn.h"
|
||||
#include "FullMatrix.h"
|
||||
#include "Part.h"
|
||||
#include "Joint.h"
|
||||
#include "CylindricalJoint.h"
|
||||
#include "RevoluteJoint.h"
|
||||
#include "ZRotation.h"
|
||||
#include "EndFrameqc.h"
|
||||
#include "MbDCode.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "Hello World!\n";
|
||||
//System& TheSystem = System::getInstance();
|
||||
System& TheSystem = System::getInstance("TheSystem");
|
||||
std::cout << "TheSystem.getName() " << TheSystem.getName() << std::endl;
|
||||
std::string str;
|
||||
FullColDptr qX, qE;
|
||||
FullColDptr rpmp;
|
||||
FullMatDptr aApm;
|
||||
FullRowDptr fullRow;
|
||||
auto row = std::make_shared<FullRow<double>>(ListD{ 0.0, 0.0, 0.0, 1.0 });
|
||||
fullRow = std::make_shared<FullRow<double>>(4);
|
||||
fullRow->copy(row);
|
||||
//
|
||||
auto assembly1 = std::make_shared<Part>();
|
||||
str = "Assembly1";
|
||||
assembly1->setName(str);
|
||||
std::cout << "assembly1->getName() " << assembly1->getName() << std::endl;
|
||||
qX = std::make_shared<FullColumn<double>>(ListD{ 0, 0, 0 });
|
||||
qE = std::make_shared<FullColumn<double>>(ListD{ 0, 0, 0, 1 });
|
||||
assembly1->setqX(qX);
|
||||
assembly1->setqE(qE);
|
||||
std::cout << "assembly1->getqX() " << assembly1->getqX()->toString() << std::endl;
|
||||
std::cout << "assembly1->getqE() " << assembly1->getqE()->toString() << std::endl;
|
||||
TheSystem.addPart(assembly1);
|
||||
{
|
||||
auto partFrame = assembly1->partFrame;
|
||||
auto marker1 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker1";
|
||||
marker1->setName(str);
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 });
|
||||
marker1->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
{ 1, 0, 0 },
|
||||
{ 0, 0, 1 },
|
||||
{ 0, -1, 0 }
|
||||
});
|
||||
marker1->setaApm(aApm);
|
||||
auto endFrame1 = std::make_shared<EndFrameqc>();
|
||||
endFrame1->setMarkerFrame(marker1);
|
||||
marker1->addEndFrame(endFrame1);
|
||||
marker1->setPartFrame(partFrame);
|
||||
partFrame->addMarkerFrame(marker1);
|
||||
//
|
||||
auto marker2 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker2";
|
||||
marker2->setName(str);
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ 0.0, 0.0, 0.0 });
|
||||
marker2->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
{ 1, 0, 0 },
|
||||
{ 0, 1, 0 },
|
||||
{ 0, 0, 1 }
|
||||
});
|
||||
marker2->setaApm(aApm);
|
||||
auto endFrame2 = std::make_shared<EndFrameqc>();
|
||||
endFrame2->setMarkerFrame(marker2);
|
||||
marker2->addEndFrame(endFrame2);
|
||||
marker2->setPartFrame(partFrame);
|
||||
partFrame->addMarkerFrame(marker2);
|
||||
}
|
||||
//
|
||||
auto part1 = std::make_shared<Part>();
|
||||
str = "Part1";
|
||||
part1->setName(str);
|
||||
qX = std::make_shared<FullColumn<double>>(ListD{ 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 });
|
||||
qE = std::make_shared<FullColumn<double>>(ListD{ 0.0, 0.0, 1.4248456266393e-10, 1.0 });
|
||||
part1->setqX(qX);
|
||||
part1->setqE(qE);
|
||||
TheSystem.parts->push_back(part1);
|
||||
{
|
||||
auto partFrame = part1->partFrame;
|
||||
auto marker1 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker1";
|
||||
marker1->setName(str);
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ -0.38423368514246, -2.6661567755108e-17, 0.048029210642807 });
|
||||
marker1->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
{ 1, 0, 0 },
|
||||
{ 0, 1, 0 },
|
||||
{ 0, 0, 1 }
|
||||
});
|
||||
marker1->setaApm(aApm);
|
||||
auto endFrame1 = std::make_shared<EndFrameqc>();
|
||||
endFrame1->setMarkerFrame(marker1);
|
||||
marker1->addEndFrame(endFrame1);
|
||||
marker1->setPartFrame(partFrame);
|
||||
partFrame->addMarkerFrame(marker1);
|
||||
//
|
||||
auto marker2 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker2";
|
||||
marker2->setName(str);
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ 0.38423368514246, -2.6661567755108e-17, 0.048029210642807 });
|
||||
marker2->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
{ 1, 0, 0 },
|
||||
{ 0, 1, 0 },
|
||||
{ 0, 0, 1 }
|
||||
});
|
||||
marker2->setaApm(aApm);
|
||||
auto endFrame2 = std::make_shared<EndFrameqc>();
|
||||
endFrame2->setMarkerFrame(marker2);
|
||||
marker2->addEndFrame(endFrame2);
|
||||
marker2->setPartFrame(partFrame);
|
||||
partFrame->addMarkerFrame(marker2);
|
||||
}
|
||||
//
|
||||
auto part2 = std::make_shared<Part>();
|
||||
str = "Part2";
|
||||
part2->setName(str);
|
||||
qX = std::make_shared<FullColumn<double>>(ListD{ 0.38423366582893, 0.49215308269277, 0.048029210642807 });
|
||||
qE = std::make_shared<FullColumn<double>>(ListD{ 0.0, 0.0, 0.89871701272344, 0.4385290538168 });
|
||||
part2->setqX(qX);
|
||||
part2->setqE(qE);
|
||||
TheSystem.parts->push_back(part2);
|
||||
{
|
||||
auto partFrame = part2->partFrame;
|
||||
auto marker1 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker1";
|
||||
marker1->setName(str);
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ -0.6243797383565, 1.1997705489799e-16, -0.048029210642807 });
|
||||
marker1->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
{1.0, 2.7755575615629e-16, 0.0},
|
||||
{-2.7755575615629e-16, 1.0, 0.0},
|
||||
{0.0, 0.0, 1.0}
|
||||
});
|
||||
marker1->setaApm(aApm);
|
||||
auto endFrame1 = std::make_shared<EndFrameqc>();
|
||||
endFrame1->setMarkerFrame(marker1);
|
||||
marker1->addEndFrame(endFrame1);
|
||||
marker1->setPartFrame(partFrame);
|
||||
partFrame->addMarkerFrame(marker1);
|
||||
//
|
||||
auto marker2 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker2";
|
||||
marker2->setName(str);
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ 0.6243797383565, -2.1329254204087e-16, -0.048029210642807 });
|
||||
marker2->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
{1.0, 2.4980018054066e-16, 2.2204460492503e-16},
|
||||
{-2.4980018054066e-16, 1.0, 4.1633363423443e-17},
|
||||
{-2.2204460492503e-16, -4.1633363423443e-17, 1.0}
|
||||
});
|
||||
marker2->setaApm(aApm);
|
||||
auto endFrame2 = std::make_shared<EndFrameqc>();
|
||||
endFrame2->setMarkerFrame(marker2);
|
||||
marker2->addEndFrame(endFrame2);
|
||||
marker2->setPartFrame(partFrame);
|
||||
partFrame->addMarkerFrame(marker2);
|
||||
}
|
||||
//
|
||||
auto part3 = std::make_shared<Part>();
|
||||
str = "Part3";
|
||||
part3->setName(str);
|
||||
qX = std::make_shared<FullColumn<double>>(ListD{ -1.284772285311e-18, 1.4645982581368, -4.788228906425e-17 });
|
||||
qE = std::make_shared<FullColumn<double>>(ListD{ 0.70710678118655, 0.70710678118655, 0.0, 0.0 });
|
||||
part3->setqX(qX);
|
||||
part3->setqE(qE);
|
||||
TheSystem.parts->push_back(part3);
|
||||
{
|
||||
auto partFrame = part3->partFrame;
|
||||
auto marker1 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker1";
|
||||
marker1->setName(str);
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ -0.48029210642807, 7.6201599718927e-18, -2.816737703896e-17 });
|
||||
marker1->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
{9.2444637330587e-33, 1.0, 2.2204460492503e-16},
|
||||
{1.0, -9.2444637330587e-33, -1.0785207688569e-32},
|
||||
{-1.0785207688569e-32, 2.2204460492503e-16, -1.0}
|
||||
});
|
||||
marker1->setaApm(aApm);
|
||||
auto endFrame1 = std::make_shared<EndFrameqc>();
|
||||
endFrame1->setMarkerFrame(marker1);
|
||||
marker1->addEndFrame(endFrame1);
|
||||
marker1->setPartFrame(partFrame);
|
||||
partFrame->addMarkerFrame(marker1);
|
||||
//
|
||||
auto marker2 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker2";
|
||||
marker2->setName(str);
|
||||
rpmp = std::make_shared<FullColumn<double>>(ListD{ 0.48029210642807, 1.7618247880058e-17, 2.5155758471256e-17 });
|
||||
marker2->setrpmp(rpmp);
|
||||
aApm = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
{6.9388939039072e-18, -6.4146353042213e-50, 1.0},
|
||||
{1.0, -6.9388939039072e-18, 6.9388939039072e-18},
|
||||
{-6.9388939039072e-18, 1.0, -7.4837411882581e-50}
|
||||
});
|
||||
marker2->setaApm(aApm);
|
||||
auto endFrame2 = std::make_shared<EndFrameqc>();
|
||||
endFrame2->setMarkerFrame(marker2);
|
||||
marker2->addEndFrame(endFrame2);
|
||||
marker2->setPartFrame(partFrame);
|
||||
partFrame->addMarkerFrame(marker2);
|
||||
}
|
||||
//
|
||||
auto cylJoint4 = std::make_shared<CylindricalJoint>();
|
||||
cylJoint4->connectsItoJ(part3->partFrame->endFrame("Marker2"), assembly1->partFrame->endFrame("Marker1"));
|
||||
TheSystem.jointsMotions->push_back(cylJoint4);
|
||||
|
||||
auto revJoint3 = std::make_shared<RevoluteJoint>();
|
||||
revJoint3->connectsItoJ(part2->partFrame->endFrame("Marker2"), part3->partFrame->endFrame("Marker1"));
|
||||
TheSystem.jointsMotions->push_back(revJoint3);
|
||||
|
||||
auto revJoint2 = std::make_shared<RevoluteJoint>();
|
||||
revJoint2->connectsItoJ(part1->partFrame->endFrame("Marker2"), part2->partFrame->endFrame("Marker1"));
|
||||
TheSystem.jointsMotions->push_back(revJoint2);
|
||||
|
||||
auto revJoint1 = std::make_shared<RevoluteJoint>();
|
||||
revJoint1->connectsItoJ(assembly1->partFrame->endFrame("Marker2"), part1->partFrame->endFrame("Marker1"));
|
||||
TheSystem.jointsMotions->push_back(revJoint1);
|
||||
|
||||
auto rotMotion1 = std::make_shared<ZRotation>();
|
||||
rotMotion1->connectsItoJ(assembly1->partFrame->endFrame("Marker2"), part1->partFrame->endFrame("Marker1"));
|
||||
TheSystem.jointsMotions->push_back(rotMotion1);
|
||||
//
|
||||
TheSystem.runKINEMATICS();
|
||||
}
|
||||
@@ -136,10 +136,13 @@
|
||||
<ClCompile Include="EndFramec.cpp" />
|
||||
<ClCompile Include="EndFrameqc.cpp" />
|
||||
<ClCompile Include="EndFrameqct.cpp" />
|
||||
<ClCompile Include="EulerArray.cpp" />
|
||||
<ClCompile Include="EulerConstraint.cpp" />
|
||||
<ClCompile Include="EulerParameters.cpp" />
|
||||
<ClCompile Include="FullColumn.cpp" />
|
||||
<ClCompile Include="FullMatrix.cpp" />
|
||||
<ClCompile Include="FullRow.cpp" />
|
||||
<ClCompile Include="IndependentVariable.cpp" />
|
||||
<ClCompile Include="Item.cpp" />
|
||||
<ClCompile Include="Joint.cpp" />
|
||||
<ClCompile Include="MarkerFrame.cpp" />
|
||||
@@ -155,8 +158,12 @@
|
||||
<ClCompile Include="SparseMatrix.cpp" />
|
||||
<ClCompile Include="SparseRow.cpp" />
|
||||
<ClCompile Include="SparseVector.cpp" />
|
||||
<ClCompile Include="Symbolic.cpp" />
|
||||
<ClCompile Include="System.cpp" />
|
||||
<ClCompile Include="SystemSolver.cpp" />
|
||||
<ClCompile Include="Temp.cpp" />
|
||||
<ClCompile Include="Time.cpp" />
|
||||
<ClCompile Include="Variable.cpp" />
|
||||
<ClCompile Include="Vector.cpp" />
|
||||
<ClCompile Include="ZRotation.cpp" />
|
||||
</ItemGroup>
|
||||
@@ -170,10 +177,13 @@
|
||||
<ClInclude Include="EndFramec.h" />
|
||||
<ClInclude Include="EndFrameqc.h" />
|
||||
<ClInclude Include="EndFrameqct.h" />
|
||||
<ClInclude Include="EulerArray.h" />
|
||||
<ClInclude Include="EulerConstraint.h" />
|
||||
<ClInclude Include="EulerParameters.h" />
|
||||
<ClInclude Include="FullColumn.h" />
|
||||
<ClInclude Include="FullMatrix.h" />
|
||||
<ClInclude Include="FullRow.h" />
|
||||
<ClInclude Include="IndependentVariable.h" />
|
||||
<ClInclude Include="Item.h" />
|
||||
<ClInclude Include="Joint.h" />
|
||||
<ClInclude Include="MarkerFrame.h" />
|
||||
@@ -189,8 +199,12 @@
|
||||
<ClInclude Include="SparseMatrix.h" />
|
||||
<ClInclude Include="SparseRow.h" />
|
||||
<ClInclude Include="SparseVector.h" />
|
||||
<ClInclude Include="Symbolic.h" />
|
||||
<ClInclude Include="System.h" />
|
||||
<ClInclude Include="SystemSolver.h" />
|
||||
<ClInclude Include="Temp.h" />
|
||||
<ClInclude Include="Time.h" />
|
||||
<ClInclude Include="Variable.h" />
|
||||
<ClInclude Include="Vector.h" />
|
||||
<ClInclude Include="ZRotation.h" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -111,6 +111,27 @@
|
||||
<ClCompile Include="ZRotation.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EulerArray.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EulerParameters.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Symbolic.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Variable.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IndependentVariable.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Time.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Temp.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Array.h">
|
||||
@@ -209,5 +230,26 @@
|
||||
<ClInclude Include="ZRotation.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EulerArray.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EulerParameters.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Symbolic.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Variable.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="IndependentVariable.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Time.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Temp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -5,26 +5,44 @@
|
||||
using namespace MbD;
|
||||
|
||||
Part::Part() {
|
||||
initialize();
|
||||
}
|
||||
|
||||
Part::Part(const char* str) : Item(str) {
|
||||
initialize();
|
||||
}
|
||||
|
||||
void Part::initialize()
|
||||
{
|
||||
partFrame = std::make_shared<PartFrame>();
|
||||
partFrame->setPart(this);
|
||||
}
|
||||
|
||||
void Part::setqX(FullColDptr x) {
|
||||
partFrame.get()->setqX(x);
|
||||
partFrame->setqX(x);
|
||||
}
|
||||
|
||||
FullColDptr Part::getqX() {
|
||||
return partFrame.get()->getqX();
|
||||
return partFrame->getqX();
|
||||
}
|
||||
|
||||
void Part::setqE(FullColDptr x) {
|
||||
partFrame.get()->setqE(x);
|
||||
partFrame->setqE(x);
|
||||
}
|
||||
|
||||
FullColDptr Part::getqE() {
|
||||
return partFrame.get()->getqE();
|
||||
return partFrame->getqE();
|
||||
}
|
||||
|
||||
void Part::setSystem(System& sys)
|
||||
{
|
||||
//May be needed in the future
|
||||
}
|
||||
|
||||
void Part::initializeLocally()
|
||||
{
|
||||
}
|
||||
|
||||
void Part::initializeGlobally()
|
||||
{
|
||||
}
|
||||
|
||||
38
MbDCode/Part.cpp.bak
Normal file
38
MbDCode/Part.cpp.bak
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "Part.h"
|
||||
#include "PartFrame.h"
|
||||
#include "FullColumn.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
Part::Part() {
|
||||
partFrame = std::make_shared<PartFrame>(this);
|
||||
}
|
||||
|
||||
void Part::setqX(FullColDptr x) {
|
||||
partFrame.get()->setqX(x);
|
||||
}
|
||||
|
||||
FullColDptr Part::getqX() {
|
||||
return partFrame.get()->getqX();
|
||||
}
|
||||
|
||||
void Part::setqE(FullColDptr x) {
|
||||
partFrame.get()->setqE(x);
|
||||
}
|
||||
|
||||
FullColDptr Part::getqE() {
|
||||
return partFrame.get()->getqE();
|
||||
}
|
||||
|
||||
void Part::setSystem(System& sys)
|
||||
{
|
||||
//May be needed in the future
|
||||
}
|
||||
|
||||
void Part::initializeLocally()
|
||||
{
|
||||
}
|
||||
|
||||
void Part::initializeGlobally()
|
||||
{
|
||||
}
|
||||
@@ -15,11 +15,16 @@ namespace MbD {
|
||||
//ToDo: ipX ipE m aJ partFrame pX pXdot pE pEdot mX mE mEdot pTpE ppTpEpE ppTpEpEdot
|
||||
public:
|
||||
Part();
|
||||
Part(const char* str);
|
||||
void initialize();
|
||||
void setqX(FullColDptr x);
|
||||
FullColDptr getqX();
|
||||
void setqE(FullColDptr x);
|
||||
FullColDptr getqE();
|
||||
void setSystem(System& sys);
|
||||
void initializeLocally();
|
||||
void initializeGlobally();
|
||||
|
||||
std::shared_ptr<PartFrame> partFrame;
|
||||
};
|
||||
}
|
||||
|
||||
29
MbDCode/Part.h.bak
Normal file
29
MbDCode/Part.h.bak
Normal file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
|
||||
#include "Item.h"
|
||||
#include "System.h"
|
||||
#include "PartFrame.h"
|
||||
#include "FullColumn.h"
|
||||
|
||||
namespace MbD {
|
||||
class System;
|
||||
class PartFrame;
|
||||
|
||||
class Part : public Item
|
||||
{
|
||||
//ToDo: ipX ipE m aJ partFrame pX pXdot pE pEdot mX mE mEdot pTpE ppTpEpE ppTpEpEdot
|
||||
public:
|
||||
Part();
|
||||
void setqX(FullColDptr x);
|
||||
FullColDptr getqX();
|
||||
void setqE(FullColDptr x);
|
||||
FullColDptr getqE();
|
||||
void setSystem(System& sys);
|
||||
void initializeLocally();
|
||||
void initializeGlobally();
|
||||
|
||||
std::shared_ptr<PartFrame> partFrame;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "Part.h"
|
||||
#include "PartFrame.h"
|
||||
#include "EulerConstraint.h"
|
||||
#include "AbsConstraint.h"
|
||||
#include "MarkerFrame.h"
|
||||
|
||||
@@ -7,9 +8,16 @@ using namespace MbD;
|
||||
|
||||
PartFrame::PartFrame()
|
||||
{
|
||||
aGeu = std::make_shared<EulerConstraint>();
|
||||
aGabs = std::vector<std::shared_ptr<AbsConstraint>>();
|
||||
markerFrames = std::vector<std::shared_ptr<MarkerFrame>>();
|
||||
aGeu = std::make_shared<EulerConstraint>("EulerCon");
|
||||
aGeu->setOwner(this);
|
||||
aGabs = std::make_unique<std::vector<std::shared_ptr<AbsConstraint>>>();
|
||||
markerFrames = std::make_unique<std::vector<std::shared_ptr<MarkerFrame>>>();
|
||||
}
|
||||
MbD::PartFrame::PartFrame(const char* str) : CartesianFrame(str)
|
||||
{
|
||||
}
|
||||
void MbD::PartFrame::initialize()
|
||||
{
|
||||
}
|
||||
void PartFrame::setqX(FullColDptr x) {
|
||||
qX->copy(x);
|
||||
@@ -23,15 +31,21 @@ void PartFrame::setqE(FullColDptr x) {
|
||||
FullColDptr PartFrame::getqE() {
|
||||
return qE;
|
||||
}
|
||||
void PartFrame::setPart(std::shared_ptr<Part> x) {
|
||||
void PartFrame::setPart(Part* x) {
|
||||
part = x;
|
||||
}
|
||||
std::shared_ptr<Part> PartFrame::getPart() {
|
||||
return part.lock();
|
||||
Part* PartFrame::getPart() {
|
||||
return part;
|
||||
}
|
||||
|
||||
void MbD::PartFrame::addMarkerFrame(std::shared_ptr<MarkerFrame> markerFrame)
|
||||
void PartFrame::addMarkerFrame(std::shared_ptr<MarkerFrame> markerFrame)
|
||||
{
|
||||
markerFrame->setPartFrame(this);
|
||||
markerFrames.push_back(markerFrame);
|
||||
markerFrames->push_back(markerFrame);
|
||||
}
|
||||
|
||||
std::shared_ptr<EndFramec> PartFrame::endFrame(std::string name)
|
||||
{
|
||||
auto match = std::find_if(markerFrames->begin(), markerFrames->end(), [&](auto mkr) {return mkr->getName() == name; });
|
||||
return (*match)->endFrames->at(0);
|
||||
}
|
||||
|
||||
52
MbDCode/PartFrame.cpp.bak
Normal file
52
MbDCode/PartFrame.cpp.bak
Normal file
@@ -0,0 +1,52 @@
|
||||
#include "Part.h"
|
||||
#include "PartFrame.h"
|
||||
#include "EulerConstraint.h"
|
||||
#include "AbsConstraint.h"
|
||||
#include "MarkerFrame.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
PartFrame::PartFrame()
|
||||
{
|
||||
aGeu = std::make_shared<EulerConstraint>("EulerCon");
|
||||
aGeu->setOwner(this);
|
||||
aGabs = std::make_unique<std::vector<std::shared_ptr<AbsConstraint>>>();
|
||||
markerFrames = std::make_unique<std::vector<std::shared_ptr<MarkerFrame>>>();
|
||||
}
|
||||
MbD::PartFrame::PartFrame(const char* str) : CartesianFrame(str)
|
||||
{
|
||||
}
|
||||
void MbD::PartFrame::initialize()
|
||||
{
|
||||
}
|
||||
void PartFrame::setqX(FullColDptr x) {
|
||||
qX->copy(x);
|
||||
}
|
||||
FullColDptr PartFrame::getqX() {
|
||||
return qX;
|
||||
}
|
||||
void PartFrame::setqE(FullColDptr x) {
|
||||
qE->copy(x);
|
||||
}
|
||||
FullColDptr PartFrame::getqE() {
|
||||
return qE;
|
||||
}
|
||||
void PartFrame::setPart(Part* x) {
|
||||
part = x;
|
||||
}
|
||||
Part* PartFrame::getPart() {
|
||||
return part;
|
||||
}
|
||||
|
||||
void PartFrame::addMarkerFrame(std::shared_ptr<MarkerFrame> markerFrame)
|
||||
{
|
||||
markerFrames->push_back(markerFrame);
|
||||
}
|
||||
|
||||
std::shared_ptr<EndFramec> PartFrame::endFrame(std::string name)
|
||||
{
|
||||
auto match = std::find_if(markerFrames->begin(), markerFrames->end(), [&](std::shared_ptr<MarkerFrame> mkr) {return mkr->endFrames->at(0)->getName() == name; });
|
||||
//auto match = std::find_if(markerFrames->begin(), markerFrames->end(), [&](std::shared_ptr<MarkerFrame> mkr) {return mkr->getName() == name; });
|
||||
|
||||
return (*match)->endFrames->at(0);
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "CartesianFrame.h"
|
||||
#include "Part.h"
|
||||
#include "MarkerFrame.h"
|
||||
#include "EndFramec.h"
|
||||
#include "EulerConstraint.h"
|
||||
#include "AbsConstraint.h"
|
||||
#include "FullColumn.h"
|
||||
@@ -12,28 +13,32 @@
|
||||
namespace MbD {
|
||||
class Part;
|
||||
class MarkerFrame;
|
||||
class EndFramec;
|
||||
|
||||
class PartFrame : public CartesianFrame
|
||||
{
|
||||
//ToDo: part iqX iqE qX qE qXdot qEdot qXddot qEddot aGeu aGabs markerFrames
|
||||
public:
|
||||
PartFrame();
|
||||
PartFrame(const char* str);
|
||||
void initialize();
|
||||
|
||||
void setqX(FullColDptr x);
|
||||
FullColDptr getqX();
|
||||
void setqE(FullColDptr x);
|
||||
FullColDptr getqE();
|
||||
void setPart(std::shared_ptr<Part> x);
|
||||
std::shared_ptr<Part> getPart();
|
||||
void setPart(Part* x);
|
||||
Part* getPart();
|
||||
void addMarkerFrame(std::shared_ptr<MarkerFrame> x);
|
||||
std::shared_ptr<EndFramec> endFrame(std::string name);
|
||||
|
||||
std::weak_ptr<Part> part;
|
||||
Part* part;
|
||||
int iqX, iqE; //Position index of frame variables qX and qE in system list of variables
|
||||
FullColDptr qX = std::make_shared<FullColumn<double>>(3);
|
||||
FullColDptr qE = std::make_shared<FullColumn<double>>(4);
|
||||
std::shared_ptr<EulerConstraint> aGeu;
|
||||
std::vector<std::shared_ptr<AbsConstraint>> aGabs;
|
||||
std::vector<std::shared_ptr<MarkerFrame>> markerFrames;
|
||||
std::unique_ptr<std::vector<std::shared_ptr<AbsConstraint>>> aGabs;
|
||||
std::unique_ptr<std::vector<std::shared_ptr<MarkerFrame>>> markerFrames;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1,31 @@
|
||||
#include <memory>
|
||||
#include <typeinfo>
|
||||
#include <assert.h>
|
||||
|
||||
#include "PrescribedMotion.h"
|
||||
#include "EndFrameqct.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
PrescribedMotion::PrescribedMotion() {
|
||||
initialize();
|
||||
}
|
||||
|
||||
PrescribedMotion::PrescribedMotion(const char* str) : Joint(str) {
|
||||
initialize();
|
||||
}
|
||||
|
||||
void PrescribedMotion::initialize()
|
||||
{
|
||||
}
|
||||
|
||||
void PrescribedMotion::connectsItoJ(std::shared_ptr<EndFramec> frmi, std::shared_ptr<EndFramec> frmj)
|
||||
{
|
||||
Joint::connectsItoJ(frmi, frmj);
|
||||
if (typeid(frmI).name() != "EndFrameqct") {
|
||||
std::shared_ptr<EndFramec> newFrmI;
|
||||
newFrmI = std::make_shared<EndFrameqct>();
|
||||
std::swap(frmI, newFrmI);
|
||||
assert(typeid(frmI).name() != "EndFrameqct");
|
||||
}
|
||||
}
|
||||
|
||||
19
MbDCode/PrescribedMotion.cpp.bak
Normal file
19
MbDCode/PrescribedMotion.cpp.bak
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <memory>
|
||||
#include <typeinfo>
|
||||
#include <assert.h>
|
||||
|
||||
#include "PrescribedMotion.h"
|
||||
#include "EndFrameqct.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
void PrescribedMotion::connectsItoJ(std::shared_ptr<EndFramec> frmi, std::shared_ptr<EndFramec> frmj)
|
||||
{
|
||||
Joint::connectsItoJ(frmi, frmj);
|
||||
if (typeid(frmI).name() != "EndFrameqct") {
|
||||
std::shared_ptr<EndFramec> newFrmI;
|
||||
newFrmI = std::make_shared<EndFrameqct>();
|
||||
std::swap(frmI, newFrmI);
|
||||
assert(typeid(frmI).name() != "EndFrameqct");
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,12 @@
|
||||
namespace MbD {
|
||||
class PrescribedMotion : public Joint
|
||||
{
|
||||
//xBlk yBlk zBlk phiBlk theBlk psiBlk
|
||||
public:
|
||||
PrescribedMotion();
|
||||
PrescribedMotion(const char* str);
|
||||
void initialize();
|
||||
void connectsItoJ(std::shared_ptr<EndFramec> frmI, std::shared_ptr<EndFramec> frmJ) override;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
11
MbDCode/PrescribedMotion.h.bak
Normal file
11
MbDCode/PrescribedMotion.h.bak
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
#include "Joint.h"
|
||||
|
||||
namespace MbD {
|
||||
class PrescribedMotion : public Joint
|
||||
{
|
||||
public:
|
||||
void connectsItoJ(std::shared_ptr<EndFramec> frmI, std::shared_ptr<EndFramec> frmJ) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1 +1,15 @@
|
||||
#include "RevoluteJoint.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
RevoluteJoint::RevoluteJoint() {
|
||||
initialize();
|
||||
}
|
||||
|
||||
RevoluteJoint::RevoluteJoint(const char* str) : Joint(str) {
|
||||
initialize();
|
||||
}
|
||||
|
||||
void RevoluteJoint::initialize()
|
||||
{
|
||||
}
|
||||
|
||||
1
MbDCode/RevoluteJoint.cpp.bak
Normal file
1
MbDCode/RevoluteJoint.cpp.bak
Normal file
@@ -0,0 +1 @@
|
||||
#include "RevoluteJoint.h"
|
||||
@@ -3,6 +3,11 @@
|
||||
namespace MbD {
|
||||
class RevoluteJoint : public Joint
|
||||
{
|
||||
//
|
||||
public:
|
||||
RevoluteJoint();
|
||||
RevoluteJoint(const char* str);
|
||||
void initialize();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
8
MbDCode/RevoluteJoint.h.bak
Normal file
8
MbDCode/RevoluteJoint.h.bak
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include "Joint.h"
|
||||
namespace MbD {
|
||||
class RevoluteJoint : public Joint
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ namespace MbD {
|
||||
}
|
||||
}
|
||||
};
|
||||
typedef std::shared_ptr<SparseMatrix<double>> SpMatDptr;
|
||||
typedef std::initializer_list<std::initializer_list<std::initializer_list<double>>> ListListPairD;
|
||||
}
|
||||
|
||||
typedef std::shared_ptr<MbD::SparseMatrix<double>> SpMatDptr;
|
||||
typedef std::initializer_list<std::initializer_list<std::initializer_list<double>>> ListListPairD;
|
||||
|
||||
|
||||
@@ -13,6 +13,6 @@ namespace MbD {
|
||||
SparseRow(std::initializer_list<std::pair<const int, T>> list) : SparseVector<T>{ list } {}
|
||||
SparseRow(std::initializer_list<std::initializer_list<T>> list) : SparseVector<T>{ list } {}
|
||||
};
|
||||
typedef std::shared_ptr<SparseRow<double>> SpRowDptr;
|
||||
}
|
||||
|
||||
typedef std::shared_ptr<MbD::SparseRow<double>> SpRowDptr;
|
||||
|
||||
1
MbDCode/Symbolic.cpp
Normal file
1
MbDCode/Symbolic.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "Symbolic.h"
|
||||
7
MbDCode/Symbolic.h
Normal file
7
MbDCode/Symbolic.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
namespace MbD {
|
||||
class Symbolic
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,15 +1,64 @@
|
||||
#include<algorithm>
|
||||
|
||||
#include "System.h"
|
||||
|
||||
void MbD::System::addPart(std::shared_ptr<Part> part)
|
||||
{
|
||||
part->setSystem(*this);
|
||||
parts.push_back(part);
|
||||
using namespace MbD;
|
||||
|
||||
System::System() {
|
||||
time = std::make_unique<Time>();
|
||||
parts = std::make_unique<std::vector<std::shared_ptr<Part>>>();
|
||||
jointsMotions = std::make_unique<std::vector<std::shared_ptr<Joint>>>();
|
||||
systemSolver = std::make_unique<SystemSolver>(this);
|
||||
}
|
||||
|
||||
MbD::System::System() {
|
||||
parts = std::vector<std::shared_ptr<Part>>();
|
||||
jointsMotions = std::vector<std::shared_ptr<Joint>>();
|
||||
systemSolver = std::make_shared<SystemSolver>(*this);
|
||||
//std::vector<std::shared_ptr<Part>> parts;
|
||||
//std::vector<std::shared_ptr<Joint>> jointsMotions;
|
||||
System::System(const char* str) : Item(str) {
|
||||
time = std::make_unique<Time>();
|
||||
parts = std::make_unique<std::vector<std::shared_ptr<Part>>>();
|
||||
jointsMotions = std::make_unique<std::vector<std::shared_ptr<Joint>>>();
|
||||
systemSolver = std::make_unique<SystemSolver>(this);
|
||||
}
|
||||
|
||||
void System::addPart(std::shared_ptr<Part> part)
|
||||
{
|
||||
part->setSystem(*this);
|
||||
parts->push_back(part);
|
||||
}
|
||||
|
||||
void System::runKINEMATICS()
|
||||
{
|
||||
//Smalltalk code
|
||||
//admSystem preMbDrun.
|
||||
|
||||
// [self initializeLocally.
|
||||
// self initializeGlobally.
|
||||
// self hasChanged]
|
||||
// whileTrue.
|
||||
// self partsJointsMotionsForcesTorquesDo : [:item | item postInput] .
|
||||
// admSystem outputFor : #INPUT.
|
||||
// mbdSystemSolver runAllIC.
|
||||
// admSystem outputFor : #'INITIAL CONDITIONS'.
|
||||
// mbdSystemSolver runBasicKinematic.
|
||||
// admSystem postMbDrun
|
||||
|
||||
while (true)
|
||||
{
|
||||
initializeLocally();
|
||||
initializeGlobally();
|
||||
if (!hasChanged) break;
|
||||
}
|
||||
systemSolver->runAllIC();
|
||||
systemSolver->runBasicKinematic();
|
||||
}
|
||||
|
||||
void System::initializeLocally()
|
||||
{
|
||||
hasChanged = false;
|
||||
timeValue = systemSolver->tstart;
|
||||
std::for_each(parts->begin(), parts->end(), [](const auto& part) { part->initializeLocally(); });
|
||||
std::for_each(jointsMotions->begin(), jointsMotions->end(), [](const auto& joint) { joint->initializeLocally(); });
|
||||
systemSolver->initializeLocally();
|
||||
}
|
||||
|
||||
void System::initializeGlobally()
|
||||
{
|
||||
}
|
||||
|
||||
63
MbDCode/System.cpp.bak
Normal file
63
MbDCode/System.cpp.bak
Normal file
@@ -0,0 +1,63 @@
|
||||
#include<algorithm>
|
||||
|
||||
#include "System.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
System::System() {
|
||||
time = std::make_unique<Time>();
|
||||
parts = std::make_unique<std::vector<std::shared_ptr<Part>>>();
|
||||
jointsMotions = std::make_unique<std::vector<std::shared_ptr<Joint>>>();
|
||||
systemSolver = std::make_unique<SystemSolver>(this);
|
||||
}
|
||||
|
||||
System::System(const char* str) : Item(str) {
|
||||
time = std::make_unique<Time>();
|
||||
parts = std::make_unique<std::vector<std::shared_ptr<Part>>>();
|
||||
jointsMotions = std::make_unique<std::vector<std::shared_ptr<Joint>>>();
|
||||
systemSolver = std::make_unique<SystemSolver>(this);
|
||||
}
|
||||
|
||||
void System::addPart(std::shared_ptr<Part> part)
|
||||
{
|
||||
part->setSystem(*this);
|
||||
parts->push_back(part);
|
||||
}
|
||||
|
||||
void System::runKINEMATICS()
|
||||
{
|
||||
//admSystem preMbDrun.
|
||||
|
||||
// [self initializeLocally.
|
||||
// self initializeGlobally.
|
||||
// self hasChanged]
|
||||
// whileTrue.
|
||||
// self partsJointsMotionsForcesTorquesDo : [:item | item postInput] .
|
||||
// admSystem outputFor : #INPUT.
|
||||
// mbdSystemSolver runAllIC.
|
||||
// admSystem outputFor : #'INITIAL CONDITIONS'.
|
||||
// mbdSystemSolver runBasicKinematic.
|
||||
// admSystem postMbDrun
|
||||
|
||||
while (true)
|
||||
{
|
||||
initializeLocally();
|
||||
initializeGlobally();
|
||||
if (!hasChanged) break;
|
||||
}
|
||||
systemSolver->runAllIC();
|
||||
systemSolver->runBasicKinematic();
|
||||
}
|
||||
|
||||
void System::initializeLocally()
|
||||
{
|
||||
hasChanged = false;
|
||||
timeValue = systemSolver->tstart;
|
||||
std::for_each(parts->begin(), parts->end(), [](const auto& part) { part->initializeLocally(); });
|
||||
std::for_each(jointsMotions->begin(), jointsMotions->end(), [](const auto& joint) { joint->initializeLocally(); });
|
||||
systemSolver->initializeLocally();
|
||||
}
|
||||
|
||||
void System::initializeGlobally()
|
||||
{
|
||||
}
|
||||
@@ -1,3 +1,11 @@
|
||||
/*****************************************************************//**
|
||||
* \file System.h
|
||||
* \brief Multibody system of parts, joints, forces.
|
||||
*
|
||||
* \author askoh
|
||||
* \date May 2023
|
||||
*********************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
@@ -6,6 +14,7 @@
|
||||
#include "Part.h"
|
||||
#include "Joint.h"
|
||||
#include "SystemSolver.h"
|
||||
#include "Time.h"
|
||||
|
||||
namespace MbD {
|
||||
class Part;
|
||||
@@ -21,13 +30,25 @@ namespace MbD {
|
||||
static System singleInstance; // Block-scoped static Singleton instance
|
||||
return singleInstance;
|
||||
};
|
||||
std::vector<std::shared_ptr<Part>> parts;
|
||||
std::vector<std::shared_ptr<Joint>> jointsMotions;
|
||||
static System& getInstance(const char* str) {
|
||||
//https://medium.com/@caglayandokme/further-enhancing-the-singleton-pattern-in-c-8278b02b1ac7
|
||||
static System singleInstance(str); // Block-scoped static Singleton instance
|
||||
return singleInstance;
|
||||
};
|
||||
std::unique_ptr<std::vector<std::shared_ptr<Part>>> parts;
|
||||
std::unique_ptr<std::vector<std::shared_ptr<Joint>>> jointsMotions;
|
||||
bool hasChanged = false;
|
||||
std::shared_ptr<SystemSolver> systemSolver;
|
||||
void addPart(std::shared_ptr<Part> part);
|
||||
void runKINEMATICS();
|
||||
void initializeLocally();
|
||||
void initializeGlobally();
|
||||
|
||||
double timeValue;
|
||||
std::unique_ptr<Time> time;
|
||||
private:
|
||||
System();
|
||||
System(const char* str);
|
||||
//System() = default; // Private constructor
|
||||
System(const System&) = delete;
|
||||
System& operator=(const System&) = delete; // Deleted copy assignment
|
||||
|
||||
@@ -1 +1,19 @@
|
||||
#include "SystemSolver.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
void SystemSolver::initializeLocally()
|
||||
{
|
||||
}
|
||||
|
||||
void SystemSolver::initializeGlobally()
|
||||
{
|
||||
}
|
||||
|
||||
void SystemSolver::runAllIC()
|
||||
{
|
||||
}
|
||||
|
||||
void SystemSolver::runBasicKinematic()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6,17 +6,32 @@
|
||||
#include "NewtonRaphson.h"
|
||||
|
||||
namespace MbD {
|
||||
class System;
|
||||
class SystemSolver : public Solver
|
||||
{
|
||||
//system parts jointsMotions forcesTorques sensors variables icTypeSolver setsOfRedundantConstraints errorTolPosKine errorTolAccKine
|
||||
//iterMaxPosKine iterMaxAccKine basicIntegrator tstartPasts tstart hmin hmax tend toutFirst hout direction corAbsTol corRelTol
|
||||
//intAbsTol intRelTol iterMaxDyn orderMax translationLimit rotationLimit
|
||||
public:
|
||||
SystemSolver(System& x) : system(x) {
|
||||
}
|
||||
std::shared_ptr<NewtonRaphson> icTypeSolver;
|
||||
System& system;
|
||||
};
|
||||
class System;
|
||||
class SystemSolver : public Solver
|
||||
{
|
||||
//system parts jointsMotions forcesTorques sensors variables icTypeSolver setsOfRedundantConstraints errorTolPosKine errorTolAccKine
|
||||
//iterMaxPosKine iterMaxAccKine basicIntegrator tstartPasts tstart hmin hmax tend toutFirst hout direction corAbsTol corRelTol
|
||||
//intAbsTol intRelTol iterMaxDyn orderMax translationLimit rotationLimit
|
||||
public:
|
||||
SystemSolver(System* x) : system(x) {
|
||||
}
|
||||
void initializeLocally();
|
||||
void initializeGlobally();
|
||||
void runAllIC();
|
||||
void runBasicKinematic();
|
||||
|
||||
std::shared_ptr<NewtonRaphson> icTypeSolver;
|
||||
System* system;
|
||||
|
||||
double tstart = 0;
|
||||
double tend = 10;
|
||||
double toutFirst = 0.0;
|
||||
double errorTolPosKine = 1.0e-6;
|
||||
int iterMaxPosKine = 100;
|
||||
double hmin = 1.0e-9;
|
||||
double hmax = 1.0;
|
||||
double hout = 1.0e-1;
|
||||
double direction = 1;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
11
MbDCode/Temp.cpp
Normal file
11
MbDCode/Temp.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "Temp.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
//Temp::Temp() //: Constraint()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//Temp::Temp(Item* item) //: Constraint(item)
|
||||
//{
|
||||
//}
|
||||
20
MbDCode/Temp.h
Normal file
20
MbDCode/Temp.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "Constraint.h"
|
||||
#include "FullRow.h"
|
||||
|
||||
namespace MbD {
|
||||
class Temp : public Constraint
|
||||
{
|
||||
//pGpE iqE
|
||||
public:
|
||||
Temp() {};
|
||||
Temp(Item* item) {};
|
||||
|
||||
FullRowDptr pGpE = std::make_shared<FullRow<double>>(4); //partial derivative of G wrt pE
|
||||
int iqE = -1;
|
||||
};
|
||||
}
|
||||
|
||||
9
MbDCode/Time.cpp
Normal file
9
MbDCode/Time.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "Time.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
Time::Time()
|
||||
{
|
||||
std::string str = "t";
|
||||
this->setName(str);
|
||||
}
|
||||
11
MbDCode/Time.h
Normal file
11
MbDCode/Time.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
#include "IndependentVariable.h"
|
||||
namespace MbD {
|
||||
class Time :
|
||||
public IndependentVariable
|
||||
{
|
||||
public:
|
||||
Time();
|
||||
};
|
||||
}
|
||||
|
||||
13
MbDCode/Variable.cpp
Normal file
13
MbDCode/Variable.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include "Variable.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
void Variable::setName(std::string& str)
|
||||
{
|
||||
name = str;
|
||||
}
|
||||
|
||||
const std::string& Variable::getName() const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
19
MbDCode/Variable.h
Normal file
19
MbDCode/Variable.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
#include "Symbolic.h"
|
||||
namespace MbD {
|
||||
class Variable :
|
||||
public Symbolic
|
||||
{
|
||||
//name value
|
||||
public:
|
||||
public:
|
||||
Variable() {}
|
||||
void setName(std::string& str);
|
||||
const std::string& getName() const;
|
||||
private:
|
||||
std::string name;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@ namespace MbD {
|
||||
{
|
||||
public:
|
||||
Vector() {}
|
||||
Vector(int i) : Array<T>(i) {}
|
||||
Vector(size_t count) : Array<T>(count) {}
|
||||
Vector(size_t count, const T& value) : Array<T>(count, value) {}
|
||||
Vector(std::initializer_list<T> list) : Array<T>{ list } {}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1 +1,15 @@
|
||||
#include "ZRotation.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
ZRotation::ZRotation() {
|
||||
initialize();
|
||||
}
|
||||
|
||||
ZRotation::ZRotation(const char* str) : PrescribedMotion(str) {
|
||||
initialize();
|
||||
}
|
||||
|
||||
void ZRotation::initialize()
|
||||
{
|
||||
}
|
||||
|
||||
1
MbDCode/ZRotation.cpp.bak
Normal file
1
MbDCode/ZRotation.cpp.bak
Normal file
@@ -0,0 +1 @@
|
||||
#include "ZRotation.h"
|
||||
@@ -4,6 +4,11 @@
|
||||
namespace MbD {
|
||||
class ZRotation : public PrescribedMotion
|
||||
{
|
||||
//
|
||||
public:
|
||||
ZRotation();
|
||||
ZRotation(const char* str);
|
||||
void initialize();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
9
MbDCode/ZRotation.h.bak
Normal file
9
MbDCode/ZRotation.h.bak
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include "PrescribedMotion.h"
|
||||
|
||||
namespace MbD {
|
||||
class ZRotation : public PrescribedMotion
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user