Merge pull request #12 from Ondsel-Development/working
getPosition3D getQuarternions added
This commit is contained in:
@@ -307,14 +307,18 @@ void MbD::ASMTSpatialContainer::updateFromMbD()
|
||||
auto aAOp = mbdPart->aAOp();
|
||||
auto vOcmO = mbdPart->qXdot()->times(mbdUnts->velocity);
|
||||
auto omeOPO = mbdPart->omeOpO()->times(mbdUnts->omega);
|
||||
omega3D = omeOPO;
|
||||
auto aOcmO = mbdPart->qXddot()->times(mbdUnts->acceleration);
|
||||
auto alpOPO = mbdPart->alpOpO()->times(mbdUnts->alpha);
|
||||
auto& rPcmP = principalMassMarker->position3D;
|
||||
auto& aAPp = principalMassMarker->rotationMatrix;
|
||||
auto aAOP = aAOp->timesTransposeFullMatrix(aAPp);
|
||||
rotationMatrix = aAOP;
|
||||
auto rPcmO = aAOP->timesFullColumn(rPcmP);
|
||||
auto rOPO = rOcmO->minusFullColumn(rPcmO);
|
||||
position3D = rOPO;
|
||||
auto vOPO = vOcmO->minusFullColumn(omeOPO->cross(rPcmO));
|
||||
velocity3D = vOPO;
|
||||
auto aOPO = aOcmO->minusFullColumn(alpOPO->cross(rPcmO))->minusFullColumn(omeOPO->cross(omeOPO->cross(rPcmO)));
|
||||
xs->push_back(rOPO->at(0));
|
||||
ys->push_back(rOPO->at(1));
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "ASMTSpatialItem.h"
|
||||
#include "Units.h"
|
||||
#include "Part.h"
|
||||
#include "ASMTSpatialContainer.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
@@ -93,6 +96,21 @@ void MbD::ASMTSpatialItem::readOmega3D(std::vector<std::string>& lines)
|
||||
lines.erase(lines.begin());
|
||||
}
|
||||
|
||||
void MbD::ASMTSpatialItem::getPosition3D(double& a, double& b, double& c)
|
||||
{
|
||||
a = position3D->at(0);
|
||||
b = position3D->at(1);
|
||||
c = position3D->at(2);
|
||||
}
|
||||
|
||||
void MbD::ASMTSpatialItem::getQuarternions(double& q0, double& q1, double& q2, double& q3)
|
||||
{
|
||||
auto eulerParameters = rotationMatrix->asEulerParameters();
|
||||
q0 = eulerParameters->at(3);
|
||||
q1 = eulerParameters->at(0);
|
||||
q2 = eulerParameters->at(1);
|
||||
q3 = eulerParameters->at(2);
|
||||
}
|
||||
|
||||
// Overloads to simplify syntax.
|
||||
void MbD::ASMTSpatialItem::setPosition3D(double a, double b, double c)
|
||||
|
||||
@@ -16,7 +16,6 @@ namespace MbD {
|
||||
//
|
||||
public:
|
||||
void setPosition3D(FColDsptr position3D);
|
||||
void setQuarternions(double q0, double q1, double q2, double q3);
|
||||
void setRotationMatrix(FMatDsptr rotationMatrix);
|
||||
void setVelocity3D(FColDsptr velocity3D);
|
||||
void setOmega3D(FColDsptr omega3D);
|
||||
@@ -35,7 +34,10 @@ namespace MbD {
|
||||
});
|
||||
|
||||
// Overloads to simplify syntax.
|
||||
void getPosition3D(double& a, double& b, double& c);
|
||||
void getQuarternions(double& q0, double& q1, double& q2, double& q3);
|
||||
void setPosition3D(double a, double b, double c);
|
||||
void setQuarternions(double q0, double q1, double q2, double q3);
|
||||
void setVelocity3D(double a, double b, double c);
|
||||
void setOmega3D(double a, double b, double c);
|
||||
void setRotationMatrix(double v11, double v12, double v13,
|
||||
|
||||
@@ -24,7 +24,7 @@ void runSpMat();
|
||||
|
||||
int main()
|
||||
{
|
||||
MBDynSystem::runFile("crank_slider.mbd"); //To be completed
|
||||
//MBDynSystem::runFile("crank_slider.mbd"); //To be completed
|
||||
//ASMTAssembly::runSinglePendulumSuperSimplified(); //Mass is missing
|
||||
ASMTAssembly::runSinglePendulumSimplified();
|
||||
ASMTAssembly::runSinglePendulum();
|
||||
|
||||
Reference in New Issue
Block a user