Skip to content
This repository was archived by the owner on Mar 1, 2025. It is now read-only.

Commit 719f6ed

Browse files
authored
Merge pull request #44 from Ondsel-Development/fixbranch
Fixbranch
2 parents 5671994 + 62b7f99 commit 719f6ed

19 files changed

+369
-395
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
.vs
3535
x64/
3636
*.bak
37+
assembly.asmt
3738

3839
build
3940
cmake-build-debug

CMakeLists.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ set(ONDSELSOLVER_SRC
4646
OndselSolver/ArcSine.cpp
4747
OndselSolver/ArcTan.cpp
4848
OndselSolver/ArcTan2.cpp
49+
OndselSolver/Arguments.cpp
4950
OndselSolver/ASMTAngleJoint.cpp
5051
OndselSolver/ASMTAnimationParameters.cpp
5152
OndselSolver/ASMTAssembly.cpp
@@ -83,6 +84,7 @@ set(ONDSELSOLVER_SRC
8384
OndselSolver/ASMTRefSurface.cpp
8485
OndselSolver/ASMTRevCylJoint.cpp
8586
OndselSolver/ASMTRevoluteJoint.cpp
87+
OndselSolver/ASMTRevRevJoint.cpp
8688
OndselSolver/ASMTRotationalMotion.cpp
8789
OndselSolver/ASMTScrewJoint.cpp
8890
OndselSolver/ASMTSimulationParameters.cpp
@@ -231,6 +233,16 @@ set(ONDSELSOLVER_SRC
231233
OndselSolver/MatrixSolver.cpp
232234
OndselSolver/MaximumIterationError.cpp
233235
OndselSolver/MbDMath.cpp
236+
OndselSolver/MBDynAxialRotationJoint.cpp
237+
OndselSolver/MBDynClampJoint.cpp
238+
OndselSolver/MBDynDriveHingeJoint.cpp
239+
OndselSolver/MBDynInLineJoint.cpp
240+
OndselSolver/MBDynInPlaneJoint.cpp
241+
OndselSolver/MBDynPrismaticJoint.cpp
242+
OndselSolver/MBDynRevoluteHingeJoint.cpp
243+
OndselSolver/MBDynRevolutePinJoint.cpp
244+
OndselSolver/MBDynSphericalHingeJoint.cpp
245+
OndselSolver/MBDynTotalJoint.cpp
234246
OndselSolver/MBDynBlock.cpp
235247
OndselSolver/MBDynBody.cpp
236248
OndselSolver/MBDynControlData.cpp
@@ -284,6 +296,7 @@ set(ONDSELSOLVER_SRC
284296
OndselSolver/RedundantConstraint.cpp
285297
OndselSolver/RevCylJoint.cpp
286298
OndselSolver/RevoluteJoint.cpp
299+
OndselSolver/RevRevJoint.cpp
287300
OndselSolver/ScalarNewtonRaphson.cpp
288301
OndselSolver/ScrewConstraintIJ.cpp
289302
OndselSolver/ScrewConstraintIqcJc.cpp
@@ -352,6 +365,7 @@ set(ONDSELSOLVER_HEADERS
352365
OndselSolver/ArcSine.h
353366
OndselSolver/ArcTan.h
354367
OndselSolver/ArcTan2.h
368+
OndselSolver/Arguments.h
355369
OndselSolver/ASMTAngleJoint.h
356370
OndselSolver/ASMTAnimationParameters.h
357371
OndselSolver/ASMTAssembly.h
@@ -389,6 +403,7 @@ set(ONDSELSOLVER_HEADERS
389403
OndselSolver/ASMTRefSurface.h
390404
OndselSolver/ASMTRevCylJoint.h
391405
OndselSolver/ASMTRevoluteJoint.h
406+
OndselSolver/ASMTRevRevJoint.h
392407
OndselSolver/ASMTRotationalMotion.h
393408
OndselSolver/ASMTScrewJoint.h
394409
OndselSolver/ASMTSimulationParameters.h
@@ -539,6 +554,16 @@ set(ONDSELSOLVER_HEADERS
539554
OndselSolver/MatrixSolver.h
540555
OndselSolver/MaximumIterationError.h
541556
OndselSolver/MbDMath.h
557+
OndselSolver/MBDynAxialRotationJoint.h
558+
OndselSolver/MBDynClampJoint.h
559+
OndselSolver/MBDynDriveHingeJoint.h
560+
OndselSolver/MBDynInLineJoint.h
561+
OndselSolver/MBDynInPlaneJoint.h
562+
OndselSolver/MBDynPrismaticJoint.h
563+
OndselSolver/MBDynRevoluteHingeJoint.h
564+
OndselSolver/MBDynRevolutePinJoint.h
565+
OndselSolver/MBDynSphericalHingeJoint.h
566+
OndselSolver/MBDynTotalJoint.h
542567
OndselSolver/MBDynBlock.h
543568
OndselSolver/MBDynBody.h
544569
OndselSolver/MBDynControlData.h
@@ -589,6 +614,7 @@ set(ONDSELSOLVER_HEADERS
589614
OndselSolver/resource.h
590615
OndselSolver/RevCylJoint.h
591616
OndselSolver/RevoluteJoint.h
617+
OndselSolver/RevRevJoint.h
592618
OndselSolver/ScalarNewtonRaphson.h
593619
OndselSolver/ScrewConstraintIJ.h
594620
OndselSolver/ScrewConstraintIqcJc.h

OndselSolver/ASMTAssembly.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#include "ASMTRefSurface.h"
5757
#include "ExternalSystem.h"
5858
#include "SystemSolver.h"
59+
#include "ASMTRevRevJoint.h"
5960

6061
using namespace MbD;
6162

@@ -582,14 +583,17 @@ void MbD::ASMTAssembly::readJoints(std::vector<std::string>& lines)
582583
joint = CREATE<ASMTUniversalJoint>::With();
583584
}
584585
//CompoundJoints
586+
else if (jointsLines[0] == "\t\t\tSphSphJoint") {
587+
joint = CREATE<ASMTSphSphJoint>::With();
588+
}
585589
else if (jointsLines[0] == "\t\t\tCylSphJoint") {
586590
joint = CREATE<ASMTCylSphJoint>::With();
587591
}
588592
else if (jointsLines[0] == "\t\t\tRevCylJoint") {
589593
joint = CREATE<ASMTRevCylJoint>::With();
590594
}
591-
else if (jointsLines[0] == "\t\t\tSphSphJoint") {
592-
joint = CREATE<ASMTSphSphJoint>::With();
595+
else if (jointsLines[0] == "\t\t\tRevRevJoint") {
596+
joint = CREATE<ASMTRevRevJoint>::With();
593597
}
594598
//InLineJoints
595599
else if (jointsLines[0] == "\t\t\tCylindricalJoint") {

OndselSolver/ASMTRevRevJoint.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/***************************************************************************
2+
* Copyright (c) 2023 Ondsel, Inc. *
3+
* *
4+
* This file is part of OndselSolver. *
5+
* *
6+
* See LICENSE file for details about copyright. *
7+
***************************************************************************/
8+
#include <fstream>
9+
10+
#include "ASMTRevRevJoint.h"
11+
#include "RevRevJoint.h"
12+
13+
using namespace MbD;
14+
15+
std::shared_ptr<Joint> MbD::ASMTRevRevJoint::mbdClassNew()
16+
{
17+
return CREATE<RevRevJoint>::With();
18+
}

OndselSolver/ASMTRevRevJoint.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/***************************************************************************
2+
* Copyright (c) 2023 Ondsel, Inc. *
3+
* *
4+
* This file is part of OndselSolver. *
5+
* *
6+
* See LICENSE file for details about copyright. *
7+
***************************************************************************/
8+
9+
#pragma once
10+
11+
#include "ASMTCompoundJoint.h"
12+
13+
namespace MbD {
14+
class ASMTRevRevJoint : public ASMTCompoundJoint
15+
{
16+
//
17+
public:
18+
std::shared_ptr<Joint> mbdClassNew() override;
19+
20+
};
21+
}
22+

OndselSolver/AngleZIecJec.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void MbD::AngleZIecJec::calcPostDynCorrectorIteration()
2929
auto diffOfSquares = sthez * sthez - (cthez * cthez);
3030
auto sumOfSquaresSquared = sumOfSquares * sumOfSquares;
3131
auto thez0to2pi = Numeric::arcTan0to2piYoverX(sthez, cthez);
32-
thez = std::round(thez - thez0to2pi / (2.0 * OS_M_PI)) * (2.0 * OS_M_PI) + thez0to2pi;
32+
thez = std::round((thez - thez0to2pi) / (2.0 * OS_M_PI)) * (2.0 * OS_M_PI) + thez0to2pi;
3333
cosOverSSq = cthez / sumOfSquares;
3434
sinOverSSq = sthez / sumOfSquares;
3535
twoCosSinOverSSqSq = 2.0 * cthez * sthez / sumOfSquaresSquared;
@@ -91,6 +91,7 @@ void MbD::AngleZIecJec::prePosIC()
9191
{
9292
aA00IeJe->prePosIC();
9393
aA10IeJe->prePosIC();
94+
assert(thez != std::numeric_limits<double>::min());
9495
KinematicIeJe::prePosIC();
9596
}
9697

OndselSolver/MBDynItem.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace MbD {
1313
class MBDynSystem;
14-
class MBDynVariable;
1514
class MBDynReference;
1615
class MBDynNode;
1716
class ASMTItem;

OndselSolver/MBDynSystem.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ namespace MbD {
1818
class MBDynControlData;
1919
class MBDynNode;
2020
class MBDynElement;
21-
class MBDynVariable;
2221
class MBDynLabel;
2322
class MBDynReference;
2423
class MBDynDrive;

OndselSolver/Numeric.cpp

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,35 +19,13 @@ double MbD::Numeric::arcTan0to2piYoverX(double y, double x)
1919
//"(y/x) arcTan in the range 0 to 2*pi."
2020
//"Double arcTan0to2piY: 1.0d overX: 1.0d."
2121

22-
if (x > 0.0) {
23-
if (y >= 0) {
24-
//"First quadrant."
25-
return std::atan2(y, x);
26-
}
27-
else {
28-
//"Forth quadrant."
29-
return 2.0 * OS_M_PI + std::atan2(y, x);
30-
}
22+
if (y >= 0) {
23+
//"First and second quadrants."
24+
return std::atan2(y, x);
3125
}
3226
else {
33-
if (x < 0.0) {
34-
//"Second and Third quadrants."
35-
return OS_M_PI + std::atan2(y, x);
36-
}
37-
else {
38-
//"x = 0"
39-
if (y > 0.0) {
40-
return OS_M_PI / 2.0;
41-
}
42-
else {
43-
if (y < 0.0) {
44-
return 1.5 * OS_M_PI;
45-
}
46-
else {
47-
throw std::invalid_argument("atan2(0, 0) is not defined.");
48-
}
49-
}
50-
}
27+
//"Third and forth quadrants."
28+
return 2.0 * OS_M_PI + std::atan2(y, x);
5129
}
5230
}
5331

OndselSolver/OndselSolver.vcxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@
191191
<ClCompile Include="ASMTRefSurface.cpp" />
192192
<ClCompile Include="ASMTRevCylJoint.cpp" />
193193
<ClCompile Include="ASMTRevoluteJoint.cpp" />
194+
<ClCompile Include="ASMTRevRevJoint.cpp" />
194195
<ClCompile Include="ASMTRotationalMotion.cpp" />
195196
<ClCompile Include="ASMTScrewJoint.cpp" />
196197
<ClCompile Include="ASMTSimulationParameters.cpp" />
@@ -405,6 +406,7 @@
405406
<ClCompile Include="RedundantConstraint.cpp" />
406407
<ClCompile Include="RevCylJoint.cpp" />
407408
<ClCompile Include="RevoluteJoint.cpp" />
409+
<ClCompile Include="RevRevJoint.cpp" />
408410
<ClCompile Include="RowTypeMatrix.cpp" />
409411
<ClCompile Include="ScalarNewtonRaphson.cpp" />
410412
<ClCompile Include="ScrewConstraintIJ.cpp" />
@@ -513,6 +515,7 @@
513515
<ClInclude Include="ASMTRefSurface.h" />
514516
<ClInclude Include="ASMTRevCylJoint.h" />
515517
<ClInclude Include="ASMTRevoluteJoint.h" />
518+
<ClInclude Include="ASMTRevRevJoint.h" />
516519
<ClInclude Include="ASMTRotationalMotion.h" />
517520
<ClInclude Include="ASMTScrewJoint.h" />
518521
<ClInclude Include="ASMTSimulationParameters.h" />
@@ -729,6 +732,7 @@
729732
<ClInclude Include="resource.h" />
730733
<ClInclude Include="RevCylJoint.h" />
731734
<ClInclude Include="RevoluteJoint.h" />
735+
<ClInclude Include="RevRevJoint.h" />
732736
<ClInclude Include="RowTypeMatrix.h" />
733737
<ClInclude Include="ScalarNewtonRaphson.h" />
734738
<ClInclude Include="ScrewConstraintIJ.h" />

0 commit comments

Comments
 (0)