Limits output issue.

This commit is contained in:
Aik-Siong Koh
2024-04-08 23:01:06 -06:00
parent 55963abe51
commit 8d3aecbcfb
31 changed files with 47 additions and 38 deletions

View File

@@ -62,8 +62,6 @@ void MbD::ASMTAllowRotation::setMotionJoint(std::string motionJoint)
void MbD::ASMTAllowRotation::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "AllowRotation");
storeOnLevelString(os, level + 1, "Name");
storeOnLevelString(os, level + 2, name);
ASMTItemIJ::storeOnLevel(os, level);
storeOnLevelString(os, level + 1, "MotionJoint");
storeOnLevelString(os, level + 2, motionJoint);

View File

@@ -501,6 +501,8 @@ void MbD::ASMTAssembly::runDraggingTest2()
limit2->settol("1.0e-9");
assembly->addLimit(limit2);
assembly->outputFile("assembly.asmt");
auto& dragPart = assembly->parts->at(0);
auto dragParts = std::make_shared<std::vector<std::shared_ptr<ASMTPart>>>();
dragParts->push_back(dragPart);
@@ -519,7 +521,7 @@ void MbD::ASMTAssembly::runDraggingTest2()
void MbD::ASMTAssembly::runDraggingTest3()
{
auto assembly = ASMTAssembly::assemblyFromFile("../testapp/rackPinion2.asmt");
auto assembly = ASMTAssembly::assemblyFromFile("../testapp/rackPinion3.asmt");
auto dragPart = assembly->partNamed("/OndselAssembly/rackPinion#Box");
auto rotPart = assembly->partNamed("/OndselAssembly/rackPinion#Cylinder");
auto dragParts = std::make_shared<std::vector<std::shared_ptr<ASMTPart>>>();
@@ -1455,6 +1457,7 @@ void MbD::ASMTAssembly::storeOnLevelConstraintSets(std::ofstream& os, size_t lev
storeOnLevelString(os, level, "ConstraintSets");
storeOnLevelJoints(os, level + 1);
storeOnLevelMotions(os, level + 1);
storeOnLevelLimits(os, level + 1);
storeOnLevelGeneralConstraintSets(os, level + 1);
}
@@ -1482,6 +1485,14 @@ void MbD::ASMTAssembly::storeOnLevelMotions(std::ofstream& os, size_t level)
}
}
void MbD::ASMTAssembly::storeOnLevelLimits(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "Limits");
for (auto& limit : *limits) {
limit->storeOnLevel(os, level + 1);
}
}
void MbD::ASMTAssembly::storeOnLevelGeneralConstraintSets(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "GeneralConstraintSets");

View File

@@ -121,6 +121,7 @@ namespace MbD {
void storeOnLevelForceTorques(std::ofstream& os, size_t level);
void storeOnLevelJoints(std::ofstream& os, size_t level);
void storeOnLevelMotions(std::ofstream& os, size_t level);
void storeOnLevelLimits(std::ofstream& os, size_t level);
void storeOnLevelGeneralConstraintSets(std::ofstream& os, size_t level);
void storeOnTimeSeries(std::ofstream& os) override;
void setFilename(std::string filename);

View File

@@ -156,8 +156,6 @@ void MbD::ASMTGeneralMotion::createMbD(std::shared_ptr<System> mbdSys, std::shar
void MbD::ASMTGeneralMotion::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "GeneralMotion");
storeOnLevelString(os, level + 1, "Name");
storeOnLevelString(os, level + 2, name);
ASMTItemIJ::storeOnLevel(os, level);
}

View File

@@ -207,10 +207,10 @@ std::shared_ptr<Constant> MbD::ASMTItem::sptrConstant(double value)
return std::make_shared<Constant>(value);
}
void MbD::ASMTItem::storeOnLevel(std::ofstream&, size_t)
void MbD::ASMTItem::storeOnLevel(std::ofstream& os, size_t level)
{
noop();
assert(false);
storeOnLevelString(os, level + 1, "Name");
storeOnLevelString(os, level + 2, name);
}
void MbD::ASMTItem::storeOnLevelTabs(std::ofstream& os, size_t level)

View File

@@ -105,6 +105,7 @@ void MbD::ASMTItemIJ::readTZonIs(std::vector<std::string>& lines)
void MbD::ASMTItemIJ::storeOnLevel(std::ofstream& os, size_t level)
{
ASMTItem::storeOnLevel(os, level);
storeOnLevelString(os, level + 1, "MarkerI");
storeOnLevelString(os, level + 2, markerI);
storeOnLevelString(os, level + 1, "MarkerJ");

View File

@@ -42,8 +42,6 @@ void MbD::ASMTJoint::storeOnLevel(std::ofstream& os, size_t level)
auto jointType = classname();
jointType = jointType.substr(4, jointType.size() - 4); //Remove ASMT in name
storeOnLevelString(os, level, jointType);
storeOnLevelString(os, level + 1, "Name");
storeOnLevelString(os, level + 2, name);
ASMTItemIJ::storeOnLevel(os, level);
}

View File

@@ -22,7 +22,15 @@ void MbD::ASMTLimit::initMarkers()
void MbD::ASMTLimit::storeOnLevel(std::ofstream& os, size_t level)
{
assert(false);
ASMTItemIJ::storeOnLevel(os, level);
storeOnLevelString(os, level + 1, "MotionJoint");
storeOnLevelString(os, level + 2, motionJoint);
storeOnLevelString(os, level + 1, "Limit");
storeOnLevelString(os, level + 2, limit);
storeOnLevelString(os, level + 1, "Type");
storeOnLevelString(os, level + 2, type);
storeOnLevelString(os, level + 1, "Tol");
storeOnLevelString(os, level + 2, tol);
}
void MbD::ASMTLimit::readMotionJoint(std::vector<std::string>& lines)

View File

@@ -22,15 +22,5 @@ std::shared_ptr<ItemIJ> MbD::ASMTRotationLimit::mbdClassNew()
void MbD::ASMTRotationLimit::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "RotationLimit");
storeOnLevelString(os, level + 1, "Name");
storeOnLevelString(os, level + 2, name);
ASMTItemIJ::storeOnLevel(os, level);
storeOnLevelString(os, level + 1, "MotionJoint");
storeOnLevelString(os, level + 2, motionJoint);
storeOnLevelString(os, level + 1, "Limit");
storeOnLevelString(os, level + 2, limit);
storeOnLevelString(os, level + 1, "Type");
storeOnLevelString(os, level + 2, type);
storeOnLevelString(os, level + 1, "Tol");
storeOnLevelString(os, level + 2, tol);
ASMTLimit::storeOnLevel(os, level);
}

View File

@@ -102,8 +102,6 @@ void MbD::ASMTRotationalMotion::setRotationZ(std::string rotZ)
void MbD::ASMTRotationalMotion::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "RotationalMotion");
storeOnLevelString(os, level + 1, "Name");
storeOnLevelString(os, level + 2, name);
ASMTItemIJ::storeOnLevel(os, level);
storeOnLevelString(os, level + 1, "MotionJoint");
storeOnLevelString(os, level + 2, motionJoint);

View File

@@ -21,15 +21,5 @@ std::shared_ptr<ItemIJ> MbD::ASMTTranslationLimit::mbdClassNew()
void MbD::ASMTTranslationLimit::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "TranslationLimit");
storeOnLevelString(os, level + 1, "Name");
storeOnLevelString(os, level + 2, name);
ASMTItemIJ::storeOnLevel(os, level);
storeOnLevelString(os, level + 1, "MotionJoint");
storeOnLevelString(os, level + 2, motionJoint);
storeOnLevelString(os, level + 1, "Limit");
storeOnLevelString(os, level + 2, limit);
storeOnLevelString(os, level + 1, "Type");
storeOnLevelString(os, level + 2, type);
storeOnLevelString(os, level + 1, "Tol");
storeOnLevelString(os, level + 2, tol);
ASMTLimit::storeOnLevel(os, level);
}

View File

@@ -71,8 +71,6 @@ void MbD::ASMTTranslationalMotion::readTranslationZ(std::vector<std::string>& li
void MbD::ASMTTranslationalMotion::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "TranslationalMotion");
storeOnLevelString(os, level + 1, "Name");
storeOnLevelString(os, level + 2, name);
ASMTItemIJ::storeOnLevel(os, level);
}

View File

@@ -407,6 +407,7 @@ Assembly
/Assembly/joint_2
RotationZ
integral(time, rampstep(time, 0.0, 0.0, 1.0, 0.0 + 10.0*(1.0 - 0.0)))
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity

View File

@@ -407,6 +407,7 @@ Assembly
/Assembly/joint_2
RotationZ
integral(time, rampstep(time, 0.0, 0.0, 1.0, 0.0 + 10.0*(1.0 - 0.0)))
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity

View File

@@ -54,6 +54,7 @@ Assembly
ConstraintSets
Joints
Motions
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity

View File

@@ -54,6 +54,7 @@ Assembly
ConstraintSets
Joints
Motions
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity

View File

@@ -168,6 +168,7 @@ Assembly
/Assembly/structural_node_1/Marker1
MarkerJ
/Assembly/structural_node_2/Marker0
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity

View File

@@ -168,6 +168,7 @@ Assembly
/Assembly/structural_node_1/Marker1
MarkerJ
/Assembly/structural_node_2/Marker0
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity

View File

@@ -168,6 +168,7 @@ Assembly
/Assembly/structural_node_1/Marker1
MarkerJ
/Assembly/structural_node_2/Marker0
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity

View File

@@ -168,6 +168,7 @@ Assembly
/Assembly/structural_node_1/Marker1
MarkerJ
/Assembly/structural_node_2/Marker0
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity

View File

@@ -407,6 +407,7 @@ Assembly
/Assembly/joint_2
RotationZ
integral(time, rampstep(time, 0.0, 0.0, 1.0, 0.0 + 6.28*(1.0 - 0.0)))
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity

View File

@@ -407,6 +407,7 @@ Assembly
/Assembly/joint_2
RotationZ
integral(time, rampstep(time, 0.0, 0.0, 1.0, 0.0 + 6.28*(1.0 - 0.0)))
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity

View File

@@ -979,6 +979,7 @@ Assembly
/Assembly/joint_19
RotationZ
integral(time, rampstep(time, 0.25, 0.0, 2.0, 0.0 + 5.0*(2.0 - 0.25))/2)
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity

View File

@@ -979,6 +979,7 @@ Assembly
/Assembly/joint_19
RotationZ
integral(time, rampstep(time, 0.25, 0.0, 2.0, 0.0 + 5.0*(2.0 - 0.25))/2)
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity

View File

@@ -845,6 +845,7 @@ Assembly
/Assembly/joint_2
RotationZ
integral(time, rampstep(time, 0.25, 0.0, 3.0, 0.0 + 1.0*(3.0 - 0.25)))
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity

View File

@@ -845,6 +845,7 @@ Assembly
/Assembly/joint_2
RotationZ
integral(time, rampstep(time, 0.25, 0.0, 3.0, 0.0 + 1.0*(3.0 - 0.25)))
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity

View File

@@ -1595,6 +1595,7 @@ Assembly
/Assembly/joint_4
RotationZ
integral(time, rampstep(time, 0.25, 0.0, 2.0, 0.0 + 0.5*(2.0 - 0.25)))
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity

View File

@@ -1595,6 +1595,7 @@ Assembly
/Assembly/joint_4
RotationZ
integral(time, rampstep(time, 0.25, 0.0, 2.0, 0.0 + 0.5*(2.0 - 0.25)))
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity

View File

@@ -26,8 +26,8 @@ void sharedptrTest();
int main()
{
ASMTAssembly::runDraggingTest3();
ASMTAssembly::runDraggingTest2();
ASMTAssembly::runDraggingTest3();
ASMTAssembly::runDraggingTest();
//ASMTAssembly::runFile("../testapp/pistonWithLimits.asmt");
ASMTAssembly::runFile("../testapp/pistonAllowZRotation.asmt");

View File

@@ -168,6 +168,7 @@ Assembly
MarkerJ
/Assembly/structural_node_1/Marker1
Motions
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity

View File

@@ -168,6 +168,7 @@ Assembly
MarkerJ
/Assembly/structural_node_1/Marker1
Motions
Limits
GeneralConstraintSets
ForceTorques
ConstantGravity