- Move existing OndselSolver, GNN ML layer, and tooling into GNN/ directory for integration in later phases - Add Create addon scaffold: package.xml, Init.py - Add expression DAG with eval, symbolic diff, simplification - Add parameter table with fixed/free variable tracking - Add quaternion rotation as polynomial Expr trees - Add RigidBody entity (7 DOF: position + unit quaternion) - Add constraint classes: Coincident, DistancePointPoint, Fixed - Add Newton-Raphson solver with symbolic Jacobian + numpy lstsq - Add pre-solve passes: substitution + single-equation - Add DOF counting via Jacobian SVD rank - Add KindredSolver IKCSolver bridge for kcsolve integration - Add 82 unit tests covering all modules Registers as 'kindred' solver via kcsolve.register_solver() when loaded by Create's addon_loader.
78 lines
2.1 KiB
C++
78 lines
2.1 KiB
C++
/***************************************************************************
|
|
* Copyright (c) 2023 Ondsel, Inc. *
|
|
* *
|
|
* This file is part of OndselSolver. *
|
|
* *
|
|
* See LICENSE file for details about copyright. *
|
|
***************************************************************************/
|
|
|
|
#include "AbsConstraint.h"
|
|
#include "PartFrame.h"
|
|
|
|
using namespace MbD;
|
|
//
|
|
//AbsConstraint::AbsConstraint() {}
|
|
//
|
|
//AbsConstraint::AbsConstraint(const std::string& str) : Constraint(str) {}
|
|
|
|
AbsConstraint::AbsConstraint(size_t i)
|
|
{
|
|
axis = i;
|
|
}
|
|
|
|
void AbsConstraint::calcPostDynCorrectorIteration()
|
|
{
|
|
if (axis < 3) {
|
|
aG = static_cast<PartFrame*>(owner)->qX->at(axis);
|
|
}
|
|
else {
|
|
aG = static_cast<PartFrame*>(owner)->qE->at(axis - 3);
|
|
}
|
|
}
|
|
|
|
void AbsConstraint::useEquationNumbers()
|
|
{
|
|
iqXminusOnePlusAxis = static_cast<PartFrame*>(owner)->iqX + axis;
|
|
}
|
|
|
|
std::string MbD::AbsConstraint::constraintSpec()
|
|
{
|
|
return "AbsConstraint" + MbDMath::XYZFromInt(axis);
|
|
}
|
|
|
|
void AbsConstraint::fillPosICJacob(SpMatDsptr mat)
|
|
{
|
|
mat->atijplusNumber(iG, iqXminusOnePlusAxis, 1.0);
|
|
mat->atijplusNumber(iqXminusOnePlusAxis, iG, 1.0);
|
|
}
|
|
|
|
void AbsConstraint::fillPosICError(FColDsptr col)
|
|
{
|
|
Constraint::fillPosICError(col);
|
|
col->at(iqXminusOnePlusAxis) += lam;
|
|
}
|
|
|
|
void AbsConstraint::fillPosKineJacob(SpMatDsptr mat)
|
|
{
|
|
mat->atijplusNumber(iG, iqXminusOnePlusAxis, 1.0);
|
|
}
|
|
|
|
void AbsConstraint::fillVelICJacob(SpMatDsptr mat)
|
|
{
|
|
this->fillPosICJacob(mat);
|
|
}
|
|
|
|
void AbsConstraint::fillAccICIterError(FColDsptr col)
|
|
{
|
|
col->atiplusNumber(iqXminusOnePlusAxis, lam);
|
|
auto partFrame = static_cast<PartFrame*>(owner);
|
|
double sum;
|
|
if (axis < 3) {
|
|
sum = partFrame->qXddot->at(axis);
|
|
}
|
|
else {
|
|
sum = partFrame->qEddot->at(axis - 3);
|
|
}
|
|
col->atiplusNumber(iG, sum);
|
|
}
|