-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathMainSystemCreateExt.tex
More file actions
1381 lines (1328 loc) · 103 KB
/
MainSystemCreateExt.tex
File metadata and controls
1381 lines (1328 loc) · 103 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\begin{flushleft}
\noindent {def {\bf \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/exudyn/mainSystemExtensions.py\#L148}{CreateGround}{}}}\label{sec:mainsystemextensions:CreateGround}
({\it name}= '', {\it referencePosition}= [0.,0.,0.], {\it referenceRotationMatrix}= np.eye(3), {\it graphicsDataList}= [], {\it graphicsDataUserFunction}= 0, {\it show}= True)
\end{flushleft}
\setlength{\itemindent}{0.7cm}
\begin{itemize}[leftmargin=0.7cm]
\item[--]
{\bf function description}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]helper function to create a ground object, using arguments of ObjectGround; this function is mainly added for consistency with other mainSystemExtensions
\item[]- NOTE that this function is added to MainSystem via Python function MainSystemCreateGround.
\end{itemize}
\item[--]
{\bf input}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]{\it name}: name string for object
\item[]{\it referencePosition}: reference coordinates for point node (always a 3D vector, no matter if 2D or 3D mass)
\item[]{\it referenceRotationMatrix}: reference rotation matrix for rigid body node (always 3D matrix, no matter if 2D or 3D body)
\item[]{\it graphicsDataList}: list of GraphicsData for optional ground visualization
\item[]{\it graphicsDataUserFunction}: a user function graphicsDataUserFunction(mbs, itemNumber)->BodyGraphicsData (list of GraphicsData), which can be used to draw user-defined graphics; this is much slower than regular GraphicsData
\item[]{\it color}: color of node
\item[]{\it show}: True: show ground object;
\end{itemize}
\item[--]
{\bf output}: ObjectIndex; returns ground object index
\item[--]
{\bf example}: \vspace{-12pt}\ei\begin{lstlisting}[language=Python, xleftmargin=36pt]
import exudyn as exu
from exudyn.utilities import * #includes itemInterface and rigidBodyUtilities
import numpy as np
SC = exu.SystemContainer()
mbs = SC.AddSystem()
ground=mbs.CreateGround(referencePosition = [2,0,0],
graphicsDataList = [exu.graphics.CheckerBoard(point=[0,0,0], normal=[0,1,0],size=4)])
\end{lstlisting}\vspace{-24pt}\bi\item[]\vspace{-24pt}\vspace{12pt}\end{itemize}
%
%
\noindent For examples on CreateGround see Relevant Examples (Ex) and TestModels (TM) with weblink to github:
\bi
\item \footnotesize \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/ballBearningModel.py}{\texttt{ballBearningModel.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/basicTutorial2024.py}{\texttt{basicTutorial2024.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/beamTutorial.py}{\texttt{beamTutorial.py}} (Ex),
\\ \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/bicycleIftommBenchmark.py}{\texttt{bicycleIftommBenchmark.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/bungeeJump.py}{\texttt{bungeeJump.py}} (Ex),
...
,
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/ballBearingTest.py}{\texttt{ballBearingTest.py}} (TM),
\\ \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/contactCurveExample.py}{\texttt{contactCurveExample.py}} (TM),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/contactSphereSphereTest.py}{\texttt{contactSphereSphereTest.py}} (TM),
...
\ei
%
\begin{flushleft}
\noindent {def {\bf \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/exudyn/mainSystemExtensions.py\#L217}{CreateMassPoint}{}}}\label{sec:mainsystemextensions:CreateMassPoint}
({\it name}= '', {\it referencePosition}= [0.,0.,0.], {\it initialDisplacement}= [0.,0.,0.], {\it initialVelocity}= [0.,0.,0.], {\it physicsMass}= 0, {\it gravity}= [0.,0.,0.], {\it graphicsDataList}= [], {\it drawSize}= -1, {\it color}= [-1.,-1.,-1.,-1.], {\it show}= True, {\it create2D}= False, {\it returnDict}= False)
\end{flushleft}
\setlength{\itemindent}{0.7cm}
\begin{itemize}[leftmargin=0.7cm]
\item[--]
{\bf function description}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]helper function to create 2D or 3D mass point object and node, using arguments as in NodePoint and MassPoint
\item[]- NOTE that this function is added to MainSystem via Python function MainSystemCreateMassPoint.
\end{itemize}
\item[--]
{\bf input}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]{\it name}: name string for object, node is 'Node:'+name
\item[]{\it referencePosition}: reference coordinates for point node (always a 3D vector, no matter if 2D or 3D mass)
\item[]{\it initialDisplacement}: initial displacements for point node (always a 3D vector, no matter if 2D or 3D mass)
\item[]{\it initialVelocity}: initial velocities for point node (always a 3D vector, no matter if 2D or 3D mass)
\item[]{\it physicsMass}: mass of mass point
\item[]{\it gravity}: gravity vevtor applied (always a 3D vector, no matter if 2D or 3D mass)
\item[]{\it graphicsDataList}: list of GraphicsData for optional mass visualization
\item[]{\it drawSize}: general drawing size of node
\item[]{\it color}: color of node
\item[]{\it show}: True: if graphicsData list is empty, node is shown, otherwise body is shown; False: nothing is shown
\item[]{\it create2D}: if True, create NodePoint2D and MassPoint2D
\item[]{\it returnDict}: if False, returns object index; if True, returns dict of all information on created object and node
\end{itemize}
\item[--]
{\bf output}: Union[dict, ObjectIndex]; returns mass point object index or dict with all data on request (if returnDict=True)
\item[--]
{\bf example}: \vspace{-12pt}\ei\begin{lstlisting}[language=Python, xleftmargin=36pt]
import exudyn as exu
from exudyn.utilities import * #includes itemInterface and rigidBodyUtilities
import numpy as np
SC = exu.SystemContainer()
mbs = SC.AddSystem()
b0=mbs.CreateMassPoint(referencePosition = [0,0,0],
initialVelocity = [2,5,0],
physicsMass = 1, gravity = [0,-9.81,0],
drawSize = 0.5, color=exu.graphics.color.blue)
mbs.Assemble()
simulationSettings = exu.SimulationSettings() #takes currently set values or default values
simulationSettings.timeIntegration.numberOfSteps = 1000
simulationSettings.timeIntegration.endTime = 2
mbs.SolveDynamic(simulationSettings = simulationSettings)
\end{lstlisting}\vspace{-24pt}\bi\item[]\vspace{-24pt}\vspace{12pt}\end{itemize}
%
%
\noindent For examples on CreateMassPoint see Relevant Examples (Ex) and TestModels (TM) with weblink to github:
\bi
\item \footnotesize \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/basicTutorial2024.py}{\texttt{basicTutorial2024.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/cartesianSpringDamper.py}{\texttt{cartesianSpringDamper.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/cartesianSpringDamperUserFunction.py}{\texttt{cartesianSpringDamperUserFunction.py}} (Ex),
\\ \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/chatGPTupdate.py}{\texttt{chatGPTupdate.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/NGsolveOCCgeometry.py}{\texttt{NGsolveOCCgeometry.py}} (Ex),
...
,
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/createFunctionsTest.py}{\texttt{createFunctionsTest.py}} (TM),
\\ \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/deleteItemsTest.py}{\texttt{deleteItemsTest.py}} (TM),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/loadUserFunctionTest.py}{\texttt{loadUserFunctionTest.py}} (TM),
...
\ei
%
\begin{flushleft}
\noindent {def {\bf \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/exudyn/mainSystemExtensions.py\#L351}{CreateRigidBody}{}}}\label{sec:mainsystemextensions:CreateRigidBody}
({\it name}= '', {\it referencePosition}= [0.,0.,0.], {\it referenceRotationMatrix}= np.eye(3), {\it initialVelocity}= [0.,0.,0.], {\it initialAngularVelocity}= [0.,0.,0.], {\it initialDisplacement}= None, {\it initialRotationMatrix}= None, {\it inertia}= None, {\it gravity}= [0.,0.,0.], {\it nodeType}= exudyn.NodeType.RotationEulerParameters, {\it graphicsDataList}= [], {\it graphicsDataUserFunction}= 0, {\it drawSize}= -1, {\it color}= [-1.,-1.,-1.,-1.], {\it show}= True, {\it create2D}= False, {\it returnDict}= False)
\end{flushleft}
\setlength{\itemindent}{0.7cm}
\begin{itemize}[leftmargin=0.7cm]
\item[--]
{\bf function description}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]helper function to create 3D (or 2D) rigid body object and node; all quantities are global (angular velocity, etc.); use this function to easily create a rigid body; graphics can be directly obtained from inertia object, e.g. in case of cylindrical or cuboid shape
\item[]- NOTE that this function is added to MainSystem via Python function MainSystemCreateRigidBody.
\end{itemize}
\item[--]
{\bf input}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]{\it name}: name string for object, node is 'Node:'+name
\item[]{\it referencePosition}: reference position vector for rigid body node (always a 3D vector, no matter if 2D or 3D body)
\item[]{\it referenceRotationMatrix}: reference rotation matrix for rigid body node (always 3D matrix, no matter if 2D or 3D body)
\item[]{\it initialVelocity}: initial translational velocity vector for node (always a 3D vector, no matter if 2D or 3D body)
\item[]{\it initialAngularVelocity}: initial angular velocity vector for node (always a 3D vector, no matter if 2D or 3D body)
\item[]{\it initialDisplacement}: initial translational displacement vector for node (always a 3D vector, no matter if 2D or 3D body); these displacements are deviations from reference position, e.g. for a finite element node [None: unused]
\item[]{\it initialRotationMatrix}: initial rotation provided as matrix (always a 3D matrix, no matter if 2D or 3D body); this rotation is superimposed to reference rotation [None: unused]
\item[]{\it inertia}: an instance of class RigidBodyInertia, see rigidBodyUtilities; may also be from derived class (InertiaCuboid, InertiaMassPoint, InertiaCylinder, ...)
\item[]{\it gravity}: gravity vevtor applied (always a 3D vector, no matter if 2D or 3D mass)
\item[]{\it graphicsDataList}: list of GraphicsData for rigid body visualization; use exudyn.graphics functions to create GraphicsData for basic solids
\item[]{\it graphicsDataUserFunction}: a user function graphicsDataUserFunction(mbs, itemNumber)->BodyGraphicsData (list of GraphicsData), which can be used to draw user-defined graphics; this is much slower than regular GraphicsData
\item[]{\it drawSize}: general drawing size of node
\item[]{\it color}: color of node
\item[]{\it show}: True: if graphicsData list is empty, node is shown, otherwise body is shown; False: nothing is shown
\item[]{\it create2D}: if True, create NodeRigidBody2D and ObjectRigidBody2D
\item[]{\it returnDict}: if False, returns object index; if True, returns dict of all information on created object and node
\end{itemize}
\item[--]
{\bf output}: Union[dict, ObjectIndex]; returns rigid body object index (or dict with 'nodeNumber', 'objectNumber' and possibly 'loadNumber' and 'markerBodyMass' if returnDict=True)
\item[--]
{\bf example}: \vspace{-12pt}\ei\begin{lstlisting}[language=Python, xleftmargin=36pt]
import exudyn as exu
from exudyn.utilities import * #includes itemInterface and rigidBodyUtilities
import numpy as np
SC = exu.SystemContainer()
mbs = SC.AddSystem()
b0 = mbs.CreateRigidBody(inertia = InertiaCuboid(density=5000,
sideLengths=[1,0.1,0.1]),
referencePosition = [1,0,0],
initialVelocity = [2,5,0],
initialAngularVelocity = [5,0.5,0.7],
gravity = [0,-9.81,0],
graphicsDataList = [exu.graphics.Brick(size=[1,0.1,0.1],
color=exu.graphics.color.red)])
mbs.Assemble()
simulationSettings = exu.SimulationSettings() #takes currently set values or default values
simulationSettings.timeIntegration.numberOfSteps = 1000
simulationSettings.timeIntegration.endTime = 2
mbs.SolveDynamic(simulationSettings = simulationSettings)
\end{lstlisting}\vspace{-24pt}\bi\item[]\vspace{-24pt}\vspace{12pt}\end{itemize}
%
%
\noindent For examples on CreateRigidBody see Relevant Examples (Ex) and TestModels (TM) with weblink to github:
\bi
\item \footnotesize \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/addPrismaticJoint.py}{\texttt{addPrismaticJoint.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/addRevoluteJoint.py}{\texttt{addRevoluteJoint.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/ANCFrotatingCable2D.py}{\texttt{ANCFrotatingCable2D.py}} (Ex),
\\ \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/ballBearningModel.py}{\texttt{ballBearningModel.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/bicycleIftommBenchmark.py}{\texttt{bicycleIftommBenchmark.py}} (Ex),
...
,
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/ballBearingTest.py}{\texttt{ballBearingTest.py}} (TM),
\\ \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/bricardMechanism.py}{\texttt{bricardMechanism.py}} (TM),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/carRollingDiscTest.py}{\texttt{carRollingDiscTest.py}} (TM),
...
\ei
%
\begin{flushleft}
\noindent {def {\bf \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/exudyn/mainSystemExtensions.py\#L589}{CreateSpringDamper}{}}}\label{sec:mainsystemextensions:CreateSpringDamper}
({\it name}= '', {\it bodyNumbers}= [None, None], {\it localPosition0}= [0.,0.,0.], {\it localPosition1}= [0.,0.,0.], {\it referenceLength}= None, {\it stiffness}= 0., {\it damping}= 0., {\it force}= 0., {\it velocityOffset}= 0., {\it springForceUserFunction}= 0, {\it bodyOrNodeList}= [None, None], {\it bodyList}= [None, None], {\it show}= True, {\it drawSize}= -1, {\it color}= exudyn.graphics.color.default)
\end{flushleft}
\setlength{\itemindent}{0.7cm}
\begin{itemize}[leftmargin=0.7cm]
\item[--]
{\bf function description}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]helper function to create SpringDamper connector, using arguments from ObjectConnectorSpringDamper; similar interface as CreateDistanceConstraint(...), see there for for further information
\item[]- NOTE that this function is added to MainSystem via Python function MainSystemCreateSpringDamper.
\end{itemize}
\item[--]
{\bf input}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]{\it name}: name string for connector; markers get Marker0:name and Marker1:name
\item[]{\it bodyNumbers}: a list of two body numbers (ObjectIndex) to be connected
\item[]{\it localPosition0}: local position (as 3D list or numpy array) on body0, if not a node number
\item[]{\it localPosition1}: local position (as 3D list or numpy array) on body1, if not a node number
\item[]{\it referenceLength}: if None, length is computed from reference position of bodies or nodes; if not None, this scalar reference length is used for spring
\item[]{\it stiffness}: scalar stiffness coefficient
\item[]{\it damping}: scalar damping coefficient
\item[]{\it force}: scalar additional force applied
\item[]{\it velocityOffset}: scalar offset: if referenceLength is changed over time, the velocityOffset may be changed accordingly to emulate a reference motion
\item[]{\it springForceUserFunction}: a user function springForceUserFunction(mbs, t, itemNumber, deltaL, deltaL\_t, stiffness, damping, force)->float ; this function replaces the internal connector force computation
\item[]{\it bodyOrNodeList}: alternative to bodyNumbers; a list of object numbers (with specific localPosition0/1) or node numbers; may alse be mixed types; to use this case, set bodyNumbers = [None,None]
\item[]{\it show}: if True, connector visualization is drawn
\item[]{\it drawSize}: general drawing size of connector
\item[]{\it color}: color of connector
\end{itemize}
\item[--]
{\bf output}: ObjectIndex; returns index of newly created object
\item[--]
{\bf example}: \vspace{-12pt}\ei\begin{lstlisting}[language=Python, xleftmargin=36pt]
import exudyn as exu
from exudyn.utilities import * #includes itemInterface and rigidBodyUtilities
import numpy as np
SC = exu.SystemContainer()
mbs = SC.AddSystem()
b0 = mbs.CreateMassPoint(referencePosition = [2,0,0],
initialVelocity = [2,5,0],
physicsMass = 1, gravity = [0,-9.81,0],
drawSize = 0.5, color=exu.graphics.color.blue)
oGround = mbs.AddObject(ObjectGround())
#add vertical spring
oSD = mbs.CreateSpringDamper(bodyNumbers=[oGround, b0],
localPosition0=[2,1,0],
localPosition1=[0,0,0],
stiffness=1e4, damping=1e2,
drawSize=0.2)
mbs.Assemble()
simulationSettings = exu.SimulationSettings() #takes currently set values or default values
simulationSettings.timeIntegration.numberOfSteps = 1000
simulationSettings.timeIntegration.endTime = 2
SC.visualizationSettings.nodes.drawNodesAsPoint=False
mbs.SolveDynamic(simulationSettings = simulationSettings)
\end{lstlisting}\vspace{-24pt}\bi\item[]\vspace{-24pt}\vspace{12pt}\end{itemize}
%
%
\noindent For examples on CreateSpringDamper see Relevant Examples (Ex) and TestModels (TM) with weblink to github:
\bi
\item \footnotesize \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/basicTutorial2024.py}{\texttt{basicTutorial2024.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/camFollowerExample.py}{\texttt{camFollowerExample.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/chatGPTupdate.py}{\texttt{chatGPTupdate.py}} (Ex),
\\ \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/contactCurveWithLongCurve.py}{\texttt{contactCurveWithLongCurve.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/springDamperTutorialNew.py}{\texttt{springDamperTutorialNew.py}} (Ex),
...
,
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/createFunctionsTest.py}{\texttt{createFunctionsTest.py}} (TM),
\\ \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/loadUserFunctionTest.py}{\texttt{loadUserFunctionTest.py}} (TM),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/mainSystemExtensionsTests.py}{\texttt{mainSystemExtensionsTests.py}} (TM),
...
\ei
%
\begin{flushleft}
\noindent {def {\bf \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/exudyn/mainSystemExtensions.py\#L723}{CreateCartesianSpringDamper}{}}}\label{sec:mainsystemextensions:CreateCartesianSpringDamper}
({\it name}= '', {\it bodyNumbers}= [None, None], {\it localPosition0}= [0.,0.,0.], {\it localPosition1}= [0.,0.,0.], {\it stiffness}= [0.,0.,0.], {\it damping}= [0.,0.,0.], {\it offset}= [0.,0.,0.], {\it springForceUserFunction}= 0, {\it bodyOrNodeList}= [None, None], {\it bodyList}= [None, None], {\it show}= True, {\it drawSize}= -1, {\it color}= exudyn.graphics.color.default)
\end{flushleft}
\setlength{\itemindent}{0.7cm}
\begin{itemize}[leftmargin=0.7cm]
\item[--]
{\bf function description}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]helper function to create CartesianSpringDamper connector, using arguments from ObjectConnectorCartesianSpringDamper
\item[]- NOTE that this function is added to MainSystem via Python function MainSystemCreateCartesianSpringDamper.
\end{itemize}
\item[--]
{\bf input}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]{\it name}: name string for connector; markers get Marker0:name and Marker1:name
\item[]{\it bodyNumbers}: a list of two body numbers (ObjectIndex) to be connected
\item[]{\it localPosition0}: local position (as 3D list or numpy array) on body0, if not a node number
\item[]{\it localPosition1}: local position (as 3D list or numpy array) on body1, if not a node number
\item[]{\it stiffness}: stiffness coefficients (as 3D list or numpy array)
\item[]{\it damping}: damping coefficients (as 3D list or numpy array)
\item[]{\it offset}: offset vector (as 3D list or numpy array)
\item[]{\it springForceUserFunction}: a user function springForceUserFunction(mbs, t, itemNumber, displacement, velocity, stiffness, damping, offset)->[float,float,float] ; this function replaces the internal connector force computation
\item[]{\it bodyOrNodeList}: alternative to bodyNumbers; a list of object numbers (with specific localPosition0/1) or node numbers; may alse be mixed types; to use this case, set bodyNumbers = [None,None]
\item[]{\it show}: if True, connector visualization is drawn
\item[]{\it drawSize}: general drawing size of connector
\item[]{\it color}: color of connector
\end{itemize}
\item[--]
{\bf output}: ObjectIndex; returns index of newly created object
\item[--]
{\bf example}: \vspace{-12pt}\ei\begin{lstlisting}[language=Python, xleftmargin=36pt]
import exudyn as exu
from exudyn.utilities import * #includes itemInterface and rigidBodyUtilities
import numpy as np
SC = exu.SystemContainer()
mbs = SC.AddSystem()
b0 = mbs.CreateMassPoint(referencePosition = [7,0,0],
physicsMass = 1, gravity = [0,-9.81,0],
drawSize = 0.5, color=exu.graphics.color.blue)
oGround = mbs.AddObject(ObjectGround())
oSD = mbs.CreateCartesianSpringDamper(bodyNumbers=[oGround, b0],
localPosition0=[7.5,1,0],
localPosition1=[0,0,0],
stiffness=[200,2000,0], damping=[2,20,0],
drawSize=0.2)
mbs.Assemble()
simulationSettings = exu.SimulationSettings() #takes currently set values or default values
simulationSettings.timeIntegration.numberOfSteps = 1000
simulationSettings.timeIntegration.endTime = 2
SC.visualizationSettings.nodes.drawNodesAsPoint=False
mbs.SolveDynamic(simulationSettings = simulationSettings)
\end{lstlisting}\vspace{-24pt}\bi\item[]\vspace{-24pt}\vspace{12pt}\end{itemize}
%
%
\noindent For examples on CreateCartesianSpringDamper see Relevant Examples (Ex) and TestModels (TM) with weblink to github:
\bi
\item \footnotesize \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/cartesianSpringDamper.py}{\texttt{cartesianSpringDamper.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/cartesianSpringDamperUserFunction.py}{\texttt{cartesianSpringDamperUserFunction.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/chatGPTupdate.py}{\texttt{chatGPTupdate.py}} (Ex),
\\ \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/complexEigenvaluesTest.py}{\texttt{complexEigenvaluesTest.py}} (TM),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/computeODE2AEeigenvaluesTest.py}{\texttt{computeODE2AEeigenvaluesTest.py}} (TM),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/createFunctionsTest.py}{\texttt{createFunctionsTest.py}} (TM),
\\ \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/mainSystemExtensionsTests.py}{\texttt{mainSystemExtensionsTests.py}} (TM),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/mainSystemUserFunctionsTest.py}{\texttt{mainSystemUserFunctionsTest.py}} (TM),
...
\ei
%
\begin{flushleft}
\noindent {def {\bf \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/exudyn/mainSystemExtensions.py\#L812}{CreateRigidBodySpringDamper}{}}}\label{sec:mainsystemextensions:CreateRigidBodySpringDamper}
({\it name}= '', {\it bodyNumbers}= [None, None], {\it localPosition0}= [0.,0.,0.], {\it localPosition1}= [0.,0.,0.], {\it stiffness}= np.zeros((6,6)), {\it damping}= np.zeros((6,6)), {\it offset}= [0.,0.,0.,0.,0.,0.], {\it rotationMatrixJoint}= np.eye(3), {\it useGlobalFrame}= True, {\it intrinsicFormulation}= True, {\it springForceTorqueUserFunction}= 0, {\it postNewtonStepUserFunction}= 0, {\it bodyOrNodeList}= [None, None], {\it bodyList}= [None, None], {\it show}= True, {\it drawSize}= -1, {\it color}= exudyn.graphics.color.default)
\end{flushleft}
\setlength{\itemindent}{0.7cm}
\begin{itemize}[leftmargin=0.7cm]
\item[--]
{\bf function description}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]helper function to create RigidBodySpringDamper connector, using arguments from ObjectConnectorRigidBodySpringDamper, see there for the full documentation
\item[]- NOTE that this function is added to MainSystem via Python function MainSystemCreateRigidBodySpringDamper.
\end{itemize}
\item[--]
{\bf input}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]{\it name}: name string for connector; markers get Marker0:name and Marker1:name
\item[]{\it bodyNumbers}: a list of two body numbers (ObjectIndex) to be connected
\item[]{\it localPosition0}: local position (as 3D list or numpy array) on body0, if not a node number
\item[]{\it localPosition1}: local position (as 3D list or numpy array) on body1, if not a node number
\item[]{\it stiffness}: stiffness coefficients (as 6D matrix or numpy array)
\item[]{\it damping}: damping coefficients (as 6D matrix or numpy array)
\item[]{\it offset}: offset vector (as 6D list or numpy array)
\item[]{\it rotationMatrixJoint}: additional rotation matrix; in case useGlobalFrame=False, it transforms body0/node0 local frame to joint frame; if useGlobalFrame=True, it transforms global frame to joint frame
\item[]{\it useGlobalFrame}: if False, the rotationMatrixJoint is defined in the local coordinate system of body0
\item[]{\it intrinsicFormulation}: if True, uses intrinsic formulation of Maserati and Morandini, which uses matrix logarithm and is independent of order of markers (preferred formulation); otherwise, Tait-Bryan angles are used for computation of torque, see documentation
\item[]{\it springForceTorqueUserFunction}: a user function springForceTorqueUserFunction(mbs, t, itemNumber, displacement, rotation, velocity, angularVelocity, stiffness, damping, rotJ0, rotJ1, offset)->[float,float,float, float,float,float] ; this function replaces the internal connector force / torque computation
\item[]{\it postNewtonStepUserFunction}: a special user function postNewtonStepUserFunction(mbs, t, Index itemIndex, dataCoordinates, displacement, rotation, velocity, angularVelocity, stiffness, damping, rotJ0, rotJ1, offset)->[PNerror, recommendedStepSize, data[0], data[1], ...] ; for details, see RigidBodySpringDamper for full docu
\item[]{\it bodyOrNodeList}: alternative to bodyNumbers; a list of object numbers (with specific localPosition0/1) or node numbers; may alse be mixed types; to use this case, set bodyNumbers = [None,None]
\item[]{\it show}: if True, connector visualization is drawn
\item[]{\it drawSize}: general drawing size of connector
\item[]{\it color}: color of connector
\end{itemize}
\item[--]
{\bf output}: ObjectIndex; returns index of newly created object
\item[--]
{\bf example}: \vspace{-12pt}\ei\begin{lstlisting}[language=Python, xleftmargin=36pt]
#coming later
\end{lstlisting}\vspace{-24pt}\bi\item[]\vspace{-24pt}\vspace{12pt}\end{itemize}
%
%
\noindent For examples on CreateRigidBodySpringDamper see Relevant Examples (Ex) and TestModels (TM) with weblink to github:
\bi
\item \footnotesize \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/bricardMechanism.py}{\texttt{bricardMechanism.py}} (TM),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/rigidBodySpringDamperIntrinsic.py}{\texttt{rigidBodySpringDamperIntrinsic.py}} (TM)
\ei
%
\begin{flushleft}
\noindent {def {\bf \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/exudyn/mainSystemExtensions.py\#L942}{CreateTorsionalSpringDamper}{}}}\label{sec:mainsystemextensions:CreateTorsionalSpringDamper}
({\it name}= '', {\it bodyNumbers}= [None, None], {\it position}= [0.,0.,0.], {\it axis}= [0.,0.,0.], {\it stiffness}= 0., {\it damping}= 0., {\it offset}= 0., {\it velocityOffset}= 0., {\it torque}= 0., {\it useGlobalFrame}= True, {\it springTorqueUserFunction}= 0, {\it unlimitedRotations}= True, {\it show}= True, {\it drawSize}= -1, {\it color}= exudyn.graphics.color.default)
\end{flushleft}
\setlength{\itemindent}{0.7cm}
\begin{itemize}[leftmargin=0.7cm]
\item[--]
{\bf function description}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]helper function to create TorsionalSpringDamper connector, using arguments from ObjectConnectorTorsionalSpringDamper, see there for the full documentation
\item[]- NOTE that this function is added to MainSystem via Python function MainSystemCreateTorsionalSpringDamper.
\end{itemize}
\item[--]
{\bf input}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]{\it name}: name string for connector; markers get Marker0:name and Marker1:name
\item[]{\it bodyNumbers}: a list of two body numbers (ObjectIndex) to be connected
\item[]{\it position}: a 3D vector as list or np.array: if useGlobalFrame=True it describes the global position of the joint in reference configuration; else: local position in body0
\item[]{\it axis}: a 3D vector as list or np.array containing the axis around which the spring acts, either in local body0 coordinates (useGlobalFrame=False), or in global reference configuration (useGlobalFrame=True)
\item[]{\it stiffness}: scalar stiffness of spring
\item[]{\it damping}: scalar damping added to spring
\item[]{\it offset}: scalar offset, which can be used to realize a P-controlled actuator
\item[]{\it velocityOffset}: scalar velocity offset, which can be used to realize a D-controlled actuator
\item[]{\it torque}: additional constant torque added to spring-damper, acting between the two bodies
\item[]{\it useGlobalFrame}: if False, the position and axis vectors are defined in the local coordinate system of body0, otherwise in global (reference) coordinates
\item[]springTorqueUserFunction : a user function springTorqueUserFunction(mbs, t, itemNumber, rotation, angularVelocity, stiffness, damping, offset)->float ; this function replaces the internal connector torque computation
\item[]{\it unlimitedRotations}: if True, an additional generic data node is added to enable measurement of rotations beyond +/- pi; this also allows the spring to cope with multiple turns.
\item[]{\it show}: if True, connector visualization is drawn
\item[]{\it drawSize}: general drawing size of connector
\item[]{\it color}: color of connector
\end{itemize}
\item[--]
{\bf output}: ObjectIndex; returns index of newly created object
\item[--]
{\bf example}: \vspace{-12pt}\ei\begin{lstlisting}[language=Python, xleftmargin=36pt]
#coming later
\end{lstlisting}\vspace{-24pt}\bi\item[]\vspace{-24pt}\vspace{12pt}\end{itemize}
%
%
\noindent For examples on CreateTorsionalSpringDamper see Relevant Examples (Ex) and TestModels (TM) with weblink to github:
\bi
\item \footnotesize \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/createFunctionsTest.py}{\texttt{createFunctionsTest.py}} (TM)
\ei
%
\begin{flushleft}
\noindent {def {\bf \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/exudyn/mainSystemExtensions.py\#L1100}{CreateRevoluteJoint}{}}}\label{sec:mainsystemextensions:CreateRevoluteJoint}
({\it name}= '', {\it bodyNumbers}= [None, None], {\it position}= [], {\it axis}= [], {\it useGlobalFrame}= True, {\it show}= True, {\it axisRadius}= 0.1, {\it axisLength}= 0.4, {\it color}= exudyn.graphics.color.default)
\end{flushleft}
\setlength{\itemindent}{0.7cm}
\begin{itemize}[leftmargin=0.7cm]
\item[--]
{\bf function description}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]Create revolute joint between two bodies; definition of joint position and axis in global coordinates (alternatively in body0 local coordinates) for reference configuration of bodies; all markers, markerRotation and other quantities are automatically computed
\item[]- NOTE that this function is added to MainSystem via Python function MainSystemCreateRevoluteJoint.
\end{itemize}
\item[--]
{\bf input}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]{\it name}: name string for joint; markers get Marker0:name and Marker1:name
\item[]{\it bodyNumbers}: a list of object numbers for body0 and body1; must be rigid body or ground object
\item[]{\it position}: a 3D vector as list or np.array: if useGlobalFrame=True it describes the global position of the joint in reference configuration; else: local position in body0
\item[]{\it axis}: a 3D vector as list or np.array containing the joint axis either in local body0 coordinates (useGlobalFrame=False), or in global reference configuration (useGlobalFrame=True)
\item[]{\it useGlobalFrame}: if False, the position and axis vectors are defined in the local coordinate system of body0, otherwise in global (reference) coordinates
\item[]{\it show}: if True, connector visualization is drawn
\item[]{\it axisRadius}: radius of axis for connector graphical representation
\item[]{\it axisLength}: length of axis for connector graphical representation
\item[]{\it color}: color of connector
\end{itemize}
\item[--]
{\bf output}: ObjectIndex; returns index of created joint
\item[--]
{\bf example}: \vspace{-12pt}\ei\begin{lstlisting}[language=Python, xleftmargin=36pt]
import exudyn as exu
from exudyn.utilities import * #includes itemInterface and rigidBodyUtilities
import numpy as np
SC = exu.SystemContainer()
mbs = SC.AddSystem()
b0 = mbs.CreateRigidBody(inertia = InertiaCuboid(density=5000,
sideLengths=[1,0.1,0.1]),
referencePosition = [3,0,0],
gravity = [0,-9.81,0],
graphicsDataList = [exu.graphics.Brick(size=[1,0.1,0.1],
color=exu.graphics.color.steelblue)])
oGround = mbs.AddObject(ObjectGround())
mbs.CreateRevoluteJoint(bodyNumbers=[oGround, b0], position=[2.5,0,0], axis=[0,0,1],
useGlobalFrame=True, axisRadius=0.02, axisLength=0.14)
mbs.Assemble()
simulationSettings = exu.SimulationSettings() #takes currently set values or default values
simulationSettings.timeIntegration.numberOfSteps = 1000
simulationSettings.timeIntegration.endTime = 2
mbs.SolveDynamic(simulationSettings = simulationSettings)
\end{lstlisting}\vspace{-24pt}\bi\item[]\vspace{-24pt}\vspace{12pt}\end{itemize}
%
%
\noindent For examples on CreateRevoluteJoint see Relevant Examples (Ex) and TestModels (TM) with weblink to github:
\bi
\item \footnotesize \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/addRevoluteJoint.py}{\texttt{addRevoluteJoint.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/bicycleIftommBenchmark.py}{\texttt{bicycleIftommBenchmark.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/chatGPTupdate.py}{\texttt{chatGPTupdate.py}} (Ex),
\\ \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/chatGPTupdate2.py}{\texttt{chatGPTupdate2.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/involuteGearGraphics.py}{\texttt{involuteGearGraphics.py}} (Ex),
...
,
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/bricardMechanism.py}{\texttt{bricardMechanism.py}} (TM),
\\ \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/createFunctionsTest.py}{\texttt{createFunctionsTest.py}} (TM),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/createRollingDiscPenaltyTest.py}{\texttt{createRollingDiscPenaltyTest.py}} (TM),
...
\ei
%
\begin{flushleft}
\noindent {def {\bf \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/exudyn/mainSystemExtensions.py\#L1201}{CreatePrismaticJoint}{}}}\label{sec:mainsystemextensions:CreatePrismaticJoint}
({\it name}= '', {\it bodyNumbers}= [None, None], {\it position}= [], {\it axis}= [], {\it useGlobalFrame}= True, {\it show}= True, {\it axisRadius}= 0.1, {\it axisLength}= 0.4, {\it color}= exudyn.graphics.color.default)
\end{flushleft}
\setlength{\itemindent}{0.7cm}
\begin{itemize}[leftmargin=0.7cm]
\item[--]
{\bf function description}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]Create prismatic joint between two bodies; definition of joint position and axis in global coordinates (alternatively in body0 local coordinates) for reference configuration of bodies; all markers, markerRotation and other quantities are automatically computed
\item[]- NOTE that this function is added to MainSystem via Python function MainSystemCreatePrismaticJoint.
\end{itemize}
\item[--]
{\bf input}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]{\it name}: name string for joint; markers get Marker0:name and Marker1:name
\item[]{\it bodyNumbers}: a list of object numbers for body0 and body1; must be rigid body or ground object
\item[]{\it position}: a 3D vector as list or np.array: if useGlobalFrame=True it describes the global position of the joint in reference configuration; else: local position in body0
\item[]{\it axis}: a 3D vector as list or np.array containing the joint axis either in local body0 coordinates (useGlobalFrame=False), or in global reference configuration (useGlobalFrame=True)
\item[]{\it useGlobalFrame}: if False, the position and axis vectors are defined in the local coordinate system of body0, otherwise in global (reference) coordinates
\item[]{\it show}: if True, connector visualization is drawn
\item[]{\it axisRadius}: radius of axis for connector graphical representation
\item[]{\it axisLength}: length of axis for connector graphical representation
\item[]{\it color}: color of connector
\end{itemize}
\item[--]
{\bf output}: ObjectIndex; returns index of created joint
\item[--]
{\bf example}: \vspace{-12pt}\ei\begin{lstlisting}[language=Python, xleftmargin=36pt]
import exudyn as exu
from exudyn.utilities import * #includes itemInterface and rigidBodyUtilities
import numpy as np
SC = exu.SystemContainer()
mbs = SC.AddSystem()
b0 = mbs.CreateRigidBody(inertia = InertiaCuboid(density=5000,
sideLengths=[1,0.1,0.1]),
referencePosition = [4,0,0],
initialVelocity = [0,4,0],
gravity = [0,-9.81,0],
graphicsDataList = [exu.graphics.Brick(size=[1,0.1,0.1],
color=exu.graphics.color.steelblue)])
oGround = mbs.AddObject(ObjectGround())
mbs.CreatePrismaticJoint(bodyNumbers=[oGround, b0], position=[3.5,0,0], axis=[0,1,0],
useGlobalFrame=True, axisRadius=0.02, axisLength=1)
mbs.Assemble()
simulationSettings = exu.SimulationSettings() #takes currently set values or default values
simulationSettings.timeIntegration.numberOfSteps = 1000
simulationSettings.timeIntegration.endTime = 2
mbs.SolveDynamic(simulationSettings = simulationSettings)
\end{lstlisting}\vspace{-24pt}\bi\item[]\vspace{-24pt}\vspace{12pt}\end{itemize}
%
%
\noindent For examples on CreatePrismaticJoint see Relevant Examples (Ex) and TestModels (TM) with weblink to github:
\bi
\item \footnotesize \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/addPrismaticJoint.py}{\texttt{addPrismaticJoint.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/chatGPTupdate.py}{\texttt{chatGPTupdate.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/chatGPTupdate2.py}{\texttt{chatGPTupdate2.py}} (Ex),
\\ \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/involuteGearGraphics.py}{\texttt{involuteGearGraphics.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/createFunctionsTest.py}{\texttt{createFunctionsTest.py}} (TM),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/mainSystemExtensionsTests.py}{\texttt{mainSystemExtensionsTests.py}} (TM),
\\ \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/pickleCopyMbs.py}{\texttt{pickleCopyMbs.py}} (TM),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/relativeRotationTranslationMechanism.py}{\texttt{relativeRotationTranslationMechanism.py}} (TM),
...
\ei
%
\begin{flushleft}
\noindent {def {\bf \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/exudyn/mainSystemExtensions.py\#L1296}{CreateSphericalJoint}{}}}\label{sec:mainsystemextensions:CreateSphericalJoint}
({\it name}= '', {\it bodyNumbers}= [None, None], {\it position}= [], {\it constrainedAxes}= [1,1,1], {\it useGlobalFrame}= True, {\it show}= True, {\it jointRadius}= 0.1, {\it color}= exudyn.graphics.color.default)
\end{flushleft}
\setlength{\itemindent}{0.7cm}
\begin{itemize}[leftmargin=0.7cm]
\item[--]
{\bf function description}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]Create spherical joint between two bodies; definition of joint position in global coordinates (alternatively in body0 local coordinates) for reference configuration of bodies; all markers are automatically computed
\item[]- NOTE that this function is added to MainSystem via Python function MainSystemCreateSphericalJoint.
\end{itemize}
\item[--]
{\bf input}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]{\it name}: name string for joint; markers get Marker0:name and Marker1:name
\item[]{\it bodyNumbers}: a list of object numbers for body0 and body1; must be mass point, rigid body or ground object
\item[]{\it position}: a 3D vector as list or np.array: if useGlobalFrame=True it describes the global position of the joint in reference configuration; else: local position in body0
\item[]{\it constrainedAxes}: flags, which determines which (global) translation axes are constrained; each entry may only be 0 (=free) axis or 1 (=constrained axis)
\item[]{\it useGlobalFrame}: if False, the point and axis vectors are defined in the local coordinate system of body0
\item[]{\it show}: if True, connector visualization is drawn
\item[]{\it jointRadius}: radius of sphere for connector graphical representation
\item[]{\it color}: color of connector
\end{itemize}
\item[--]
{\bf output}: ObjectIndex; returns index of created joint
\item[--]
{\bf example}: \vspace{-12pt}\ei\begin{lstlisting}[language=Python, xleftmargin=36pt]
import exudyn as exu
from exudyn.utilities import * #includes itemInterface and rigidBodyUtilities
import numpy as np
SC = exu.SystemContainer()
mbs = SC.AddSystem()
b0 = mbs.CreateRigidBody(inertia = InertiaCuboid(density=5000,
sideLengths=[1,0.1,0.1]),
referencePosition = [5,0,0],
initialAngularVelocity = [5,0,0],
gravity = [0,-9.81,0],
graphicsDataList = [exu.graphics.Brick(size=[1,0.1,0.1],
color=exu.graphics.color.orange)])
oGround = mbs.AddObject(ObjectGround())
mbs.CreateSphericalJoint(bodyNumbers=[oGround, b0], position=[5.5,0,0],
useGlobalFrame=True, jointRadius=0.06)
mbs.Assemble()
simulationSettings = exu.SimulationSettings() #takes currently set values or default values
simulationSettings.timeIntegration.numberOfSteps = 1000
simulationSettings.timeIntegration.endTime = 2
mbs.SolveDynamic(simulationSettings = simulationSettings)
\end{lstlisting}\vspace{-24pt}\bi\item[]\vspace{-24pt}\vspace{12pt}\end{itemize}
%
%
\noindent For examples on CreateSphericalJoint see Relevant Examples (Ex) and TestModels (TM) with weblink to github:
\bi
\item \footnotesize \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/newtonsCradle.py}{\texttt{newtonsCradle.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/createFunctionsTest.py}{\texttt{createFunctionsTest.py}} (TM),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/driveTrainTest.py}{\texttt{driveTrainTest.py}} (TM),
\\ \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/mainSystemExtensionsTests.py}{\texttt{mainSystemExtensionsTests.py}} (TM)
\ei
%
\begin{flushleft}
\noindent {def {\bf \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/exudyn/mainSystemExtensions.py\#L1386}{CreateGenericJoint}{}}}\label{sec:mainsystemextensions:CreateGenericJoint}
({\it name}= '', {\it bodyNumbers}= [None, None], {\it position}= [], {\it rotationMatrixAxes}= np.eye(3), {\it constrainedAxes}= [1,1,1, 1,1,1], {\it useGlobalFrame}= True, {\it offsetUserFunction}= 0, {\it offsetUserFunction\_t}= 0, {\it show}= True, {\it axesRadius}= 0.1, {\it axesLength}= 0.4, {\it color}= exudyn.graphics.color.default)
\end{flushleft}
\setlength{\itemindent}{0.7cm}
\begin{itemize}[leftmargin=0.7cm]
\item[--]
{\bf function description}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]Create generic joint between two bodies; definition of joint position (position) and axes (rotationMatrixAxes) in global coordinates (useGlobalFrame=True) or in local coordinates of body0 (useGlobalFrame=False), where rotationMatrixAxes is an additional rotation to body0; all markers, markerRotation and other quantities are automatically computed
\item[]- NOTE that this function is added to MainSystem via Python function MainSystemCreateGenericJoint.
\end{itemize}
\item[--]
{\bf input}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]{\it name}: name string for joint; markers get Marker0:name and Marker1:name
\item[]{\it bodyNumber0}: a object number for body0, must be rigid body or ground object
\item[]{\it bodyNumber1}: a object number for body1, must be rigid body or ground object
\item[]{\it position}: a 3D vector as list or np.array: if useGlobalFrame=True it describes the global position of the joint in reference configuration; else: local position in body0
\item[]{\it rotationMatrixAxes}: rotation matrix which defines orientation of constrainedAxes; if useGlobalFrame, this rotation matrix is global, else the rotation matrix is post-multiplied with the rotation of body0, identical with rotationMarker0 in the joint
\item[]{\it constrainedAxes}: flag, which determines which translation (0,1,2) and rotation (3,4,5) axes are constrained; each entry may only be 0 (=free) axis or 1 (=constrained axis); ALL constrained Axes are defined relative to reference rotation of body0 times rotation0
\item[]{\it useGlobalFrame}: if False, the position is defined in the local coordinate system of body0, otherwise it is defined in global coordinates
\item[]{\it offsetUserFunction}: a user function offsetUserFunction(mbs, t, itemNumber, offsetUserFunctionParameters)->float ; this function replaces the internal (constant) by a user-defined offset. This allows to realize rheonomic joints and allows kinematic simulation
\item[]{\it offsetUserFunction\_t}: a user function offsetUserFunction\_t(mbs, t, itemNumber, offsetUserFunctionParameters)->float ; this function replaces the internal (constant) by a user-defined offset velocity; this function is used instead of offsetUserFunction, if velocityLevel (index2) time integration
\item[]{\it show}: if True, connector visualization is drawn
\item[]{\it axesRadius}: radius of axes for connector graphical representation
\item[]{\it axesLength}: length of axes for connector graphical representation
\item[]{\it color}: color of connector
\end{itemize}
\item[--]
{\bf output}: ObjectIndex; returns index of created joint
\item[--]
{\bf example}: \vspace{-12pt}\ei\begin{lstlisting}[language=Python, xleftmargin=36pt]
import exudyn as exu
from exudyn.utilities import * #includes itemInterface and rigidBodyUtilities
import numpy as np
SC = exu.SystemContainer()
mbs = SC.AddSystem()
b0 = mbs.CreateRigidBody(inertia = InertiaCuboid(density=5000,
sideLengths=[1,0.1,0.1]),
referencePosition = [6,0,0],
initialAngularVelocity = [0,8,0],
gravity = [0,-9.81,0],
graphicsDataList = [exu.graphics.Brick(size=[1,0.1,0.1],
color=exu.graphics.color.orange)])
oGround = mbs.AddObject(ObjectGround())
mbs.CreateGenericJoint(bodyNumbers=[oGround, b0], position=[5.5,0,0],
constrainedAxes=[1,1,1, 1,0,0],
rotationMatrixAxes=RotationMatrixX(0.125*pi), #tilt axes
useGlobalFrame=True, axesRadius=0.02, axesLength=0.2)
mbs.Assemble()
simulationSettings = exu.SimulationSettings() #takes currently set values or default values
simulationSettings.timeIntegration.numberOfSteps = 1000
simulationSettings.timeIntegration.endTime = 2
mbs.SolveDynamic(simulationSettings = simulationSettings)
\end{lstlisting}\vspace{-24pt}\bi\item[]\vspace{-24pt}\vspace{12pt}\end{itemize}
%
%
\noindent For examples on CreateGenericJoint see Relevant Examples (Ex) and TestModels (TM) with weblink to github:
\bi
\item \footnotesize \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/bungeeJump.py}{\texttt{bungeeJump.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/pistonEngine.py}{\texttt{pistonEngine.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/universalJoint.py}{\texttt{universalJoint.py}} (Ex),
\\ \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/bricardMechanism.py}{\texttt{bricardMechanism.py}} (TM),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/complexEigenvaluesTest.py}{\texttt{complexEigenvaluesTest.py}} (TM),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/computeODE2AEeigenvaluesTest.py}{\texttt{computeODE2AEeigenvaluesTest.py}} (TM),
\\ \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/createSphereQuadContact2.py}{\texttt{createSphereQuadContact2.py}} (TM),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/driveTrainTest.py}{\texttt{driveTrainTest.py}} (TM),
...
\ei
%
\begin{flushleft}
\noindent {def {\bf \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/exudyn/mainSystemExtensions.py\#L1500}{CreateDistanceConstraint}{}}}\label{sec:mainsystemextensions:CreateDistanceConstraint}
({\it name}= '', {\it bodyNumbers}= [None, None], {\it localPosition0}= [0.,0.,0.], {\it localPosition1}= [0.,0.,0.], {\it distance}= None, {\it bodyOrNodeList}= [None, None], {\it bodyList}= [None, None], {\it show}= True, {\it drawSize}= -1., {\it color}= exudyn.graphics.color.default)
\end{flushleft}
\setlength{\itemindent}{0.7cm}
\begin{itemize}[leftmargin=0.7cm]
\item[--]
{\bf function description}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]Create distance joint between two bodies; definition of joint positions in local coordinates of bodies or nodes; if distance=None, it is computed automatically from reference length; all markers are automatically computed
\item[]- NOTE that this function is added to MainSystem via Python function MainSystemCreateDistanceConstraint.
\end{itemize}
\item[--]
{\bf input}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]{\it name}: name string for joint; markers get Marker0:name and Marker1:name
\item[]{\it bodyNumbers}: a list of two body numbers (ObjectIndex) to be constrained
\item[]{\it localPosition0}: local position (as 3D list or numpy array) on body0, if not a node number
\item[]{\it localPosition1}: local position (as 3D list or numpy array) on body1, if not a node number
\item[]{\it distance}: if None, distance is computed from reference position of bodies or nodes; if not None, this distance is prescribed between the two positions; if distance = 0, it will create a SphericalJoint as this case is not possible with a DistanceConstraint
\item[]{\it bodyOrNodeList}: alternative to bodyNumbers; a list of object numbers (with specific localPosition0/1) or node numbers; may alse be mixed types; to use this case, set bodyNumbers = [None,None]
\item[]{\it show}: if True, connector visualization is drawn
\item[]{\it drawSize}: general drawing size of node
\item[]{\it color}: color of connector
\end{itemize}
\item[--]
{\bf output}: ObjectIndex; returns index of created joint
\item[--]
{\bf example}: \vspace{-12pt}\ei\begin{lstlisting}[language=Python, xleftmargin=36pt]
import exudyn as exu
from exudyn.utilities import * #includes itemInterface and rigidBodyUtilities
import numpy as np
SC = exu.SystemContainer()
mbs = SC.AddSystem()
b0 = mbs.CreateRigidBody(inertia = InertiaCuboid(density=5000,
sideLengths=[1,0.1,0.1]),
referencePosition = [6,0,0],
gravity = [0,-9.81,0],
graphicsDataList = [exu.graphics.Brick(size=[1,0.1,0.1],
color=exu.graphics.color.orange)])
m1 = mbs.CreateMassPoint(referencePosition=[5.5,-1,0],
physicsMass=1, drawSize = 0.2)
n1 = mbs.GetObject(m1)['nodeNumber']
oGround = mbs.AddObject(ObjectGround())
mbs.CreateDistanceConstraint(bodyNumbers=[oGround, b0],
localPosition0 = [6.5,1,0],
localPosition1 = [0.5,0,0],
distance=None, #automatically computed
drawSize=0.06)
mbs.CreateDistanceConstraint(bodyOrNodeList=[b0, n1],
localPosition0 = [-0.5,0,0],
localPosition1 = [0.,0.,0.], #must be [0,0,0] for Node
distance=None, #automatically computed
drawSize=0.06)
mbs.Assemble()
simulationSettings = exu.SimulationSettings() #takes currently set values or default values
simulationSettings.timeIntegration.numberOfSteps = 1000
simulationSettings.timeIntegration.endTime = 2
mbs.SolveDynamic(simulationSettings = simulationSettings)
\end{lstlisting}\vspace{-24pt}\bi\item[]\vspace{-24pt}\vspace{12pt}\end{itemize}
%
%
\noindent For examples on CreateDistanceConstraint see Relevant Examples (Ex) and TestModels (TM) with weblink to github:
\bi
\item \footnotesize \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/chatGPTupdate.py}{\texttt{chatGPTupdate.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/chatGPTupdate2.py}{\texttt{chatGPTupdate2.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/newtonsCradle.py}{\texttt{newtonsCradle.py}} (Ex),
\\ \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/createFunctionsTest.py}{\texttt{createFunctionsTest.py}} (TM),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/deleteItemsTest.py}{\texttt{deleteItemsTest.py}} (TM),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/mainSystemExtensionsTests.py}{\texttt{mainSystemExtensionsTests.py}} (TM),
\\ \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/taskmanagerTest.py}{\texttt{taskmanagerTest.py}} (TM)
\ei
%
\begin{flushleft}
\noindent {def {\bf \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/exudyn/mainSystemExtensions.py\#L1635}{CreateCoordinateConstraint}{}}}\label{sec:mainsystemextensions:CreateCoordinateConstraint}
({\it name}= '', {\it bodyNumbers}= [None, None], {\it coordinates}= [None, None], {\it offset}= 0., {\it factorValue1}= 1., {\it velocityLevel}= False, {\it offsetUserFunction}= 0, {\it offsetUserFunction\_t}= 0, {\it show}= True, {\it drawSize}= -1., {\it color}= exudyn.graphics.color.default)
\end{flushleft}
\setlength{\itemindent}{0.7cm}
\begin{itemize}[leftmargin=0.7cm]
\item[--]
{\bf function description}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]Create coordinate constraint for two bodies, or body on ground; markers and NodePointGround are automatically created when needed
\item[]- NOTE that this function is added to MainSystem via Python function MainSystemCreateCoordinateConstraint.
\end{itemize}
\item[--]
{\bf input}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]{\it name}: name string for joint; markers get Marker0:name and Marker1:name
\item[]{\it bodyNumbers}: a list of two body numbers (ObjectIndex) to be constrained
\item[]{\it coordinates}: a list of two coordinates for the respective bodies (in case of ground, it shall be None)
\item[]{\it offset}: an fixed offset between the two coordinate values
\item[]{\it factorValue1}: an additional factor multiplied with coordinate value1 used in algebraic equation, to enable (e.g. gear) ratio between coordinates
\item[]{\it velocityLevel}: If true: connector constrains velocities (only works for ODE2 coordinates!); offset is used between velocities; if True, the offsetUserFunction\_t is considered and offsetUserFunction is ignored
\item[]{\it offsetUserFunction}: a Python function which defines the time-dependent offset; see description in CoordinateConstraint
\item[]{\it offsetUserFunction\_t}: time derivative of offsetUserFunction; needed for velocity level constraints; see description in CoordinateConstraint
\item[]{\it show}: if True, connector visualization is drawn
\item[]{\it drawSize}: general drawing size of node
\item[]{\it color}: color of connector
\end{itemize}
\item[--]
{\bf output}: ObjectIndex; returns index of created joint
\item[--]
{\bf example}: \vspace{-12pt}\ei\begin{lstlisting}[language=Python, xleftmargin=36pt]
import exudyn as exu
from exudyn.utilities import * #includes itemInterface and rigidBodyUtilities
import numpy as np
SC = exu.SystemContainer()
mbs = SC.AddSystem()
b0 = mbs.CreateRigidBody(inertia = InertiaCuboid(density=5000,
sideLengths=[1,0.1,0.1]),
referencePosition = [6,0,0],
gravity = [0,-9.81,0],
graphicsDataList = [exu.graphics.Brick(size=[1,0.1,0.1],
color=exu.graphics.color.orange)])
m1 = mbs.CreateMassPoint(referencePosition=[5.5,-1,0],
physicsMass=1, drawSize = 0.2)
mbs.CreateCoordinateConstraint(bodyNumbers=[None, b0],
coordinates=[None, 0]) #constraints X-coordinate
#constrain Y-coordinate of b0 to Z-coordinate of m1:
mbs.CreateCoordinateConstraint(bodyNumbers=[b0, m1],
coordinates=[1, 2])
mbs.Assemble()
simulationSettings = exu.SimulationSettings() #takes currently set values or default values
simulationSettings.timeIntegration.numberOfSteps = 1000
simulationSettings.timeIntegration.endTime = 2
mbs.SolveDynamic(simulationSettings = simulationSettings)
\end{lstlisting}\vspace{-24pt}\bi\item[]\vspace{-24pt}\vspace{12pt}\end{itemize}
%
%
\noindent For examples on CreateCoordinateConstraint see Relevant Examples (Ex) and TestModels (TM) with weblink to github:
\bi
\item \footnotesize \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/ballBearningModel.py}{\texttt{ballBearningModel.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/camFollowerExample.py}{\texttt{camFollowerExample.py}} (Ex),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/Examples/involuteGearGraphics.py}{\texttt{involuteGearGraphics.py}} (Ex),
\\ \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/ballBearingTest.py}{\texttt{ballBearingTest.py}} (TM),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/contactCurveExample.py}{\texttt{contactCurveExample.py}} (TM),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/createFunctionsTest.py}{\texttt{createFunctionsTest.py}} (TM)
\ei
%
\begin{flushleft}
\noindent {def {\bf \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/exudyn/mainSystemExtensions.py\#L1777}{CreateRollingDisc}{}}}\label{sec:mainsystemextensions:CreateRollingDisc}
({\it name}= '', {\it bodyNumbers}= [None, None], {\it axisPosition}= [], {\it axisVector}= [1,0,0], {\it discRadius}= 0., {\it planePosition}= [0,0,0], {\it planeNormal}= [0,0,1], {\it constrainedAxes}= [1,1,1], {\it activeConnector}= True, {\it show}= True, {\it discWidth}= 0.1, {\it color}= exudyn.graphics.color.default)
\end{flushleft}
\setlength{\itemindent}{0.7cm}
\begin{itemize}[leftmargin=0.7cm]
\item[--]
{\bf function description}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]Create an ideal rolling disc joint between wheel rigid body and ground; the disc is infinitely thin and the ground is a perfectly flat plane; the wheel may lift off; definition of joint position and axis in global coordinates (alternatively in wheel (body1) local coordinates) for reference configuration of bodies; all markers and other quantities are automatically computed; some constraint conditions may be deactivated, e.g. to resolve redundancy of constraints for multi-wheel vehicles
\item[]- NOTE that this function is added to MainSystem via Python function MainSystemCreateRollingDisc.
\end{itemize}
\item[--]
{\bf input}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]{\it name}: name string for joint; markers get Marker0:name and Marker1:name
\item[]{\it bodyNumbers}: a list of object numbers for body0=ground and body1=wheel; must be rigid body or ground object
\item[]{\it axisPosition}: a 3D vector as list or np.array: position of wheel axis in local body1=wheel coordinates
\item[]{\it axisVector}: a 3D vector as list or np.array containing the joint (=wheel) axis in local body1=wheel coordinates
\item[]{\it discRadius}: radius of the disc
\item[]{\it planePosition}: any 3D position vector of plane in ground object; given as local coordinates in ground object
\item[]{\it planeNormal}: 3D normal vector of the rolling (contact) plane on ground; given as local coordinates in ground object
\item[]{\it constrainedAxes}: [j0,j1,j2] flags, which determine which constraints are active, in which j0 represents the constraint for lateral motion, j1 longitudinal (forward/backward) motion and j2 represents the normal (contact) direction
\item[]{\it activeConnector}: flag to activate or deactivate the joint
\item[]{\it show}: if True, connector visualization is drawn
\item[]{\it discWidth}: disc with, only used for drawing
\item[]{\it color}: color of connector
\end{itemize}
\item[--]
{\bf output}: ObjectIndex; returns index of created joint
\item[--]
{\bf example}: \vspace{-12pt}\ei\begin{lstlisting}[language=Python, xleftmargin=36pt]
import exudyn as exu
from exudyn.utilities import * #includes itemInterface and rigidBodyUtilities
import numpy as np
SC = exu.SystemContainer()
mbs = SC.AddSystem()
r = 0.2
oDisc = mbs.CreateRigidBody(inertia = InertiaCylinder(density=5000, length=0.1, outerRadius=r, axis=0),
referencePosition = [1,0,r],
initialAngularVelocity = [-3*2*pi,0,0],
initialVelocity = [0,r*3*2*pi,0],
gravity = [0,0,-9.81],
graphicsDataList = [exu.graphics.Cylinder(pAxis = [-0.05,0,0], vAxis = [0.1,0,0], radius = r*0.99,
color=exu.graphics.color.blue),
exu.graphics.Basis(length=2*r)])
oGround = mbs.CreateGround(graphicsDataList=[exu.graphics.CheckerBoard(size=4)])
mbs.CreateRollingDisc(bodyNumbers=[oGround, oDisc],
axisPosition=[0,0,0], axisVector=[1,0,0], #on local wheel frame
planePosition = [0,0,0], planeNormal = [0,0,1], #in ground frame
discRadius = r,
discWidth=0.01, color=exu.graphics.color.steelblue)
mbs.Assemble()
simulationSettings = exu.SimulationSettings()
simulationSettings.timeIntegration.numberOfSteps = 1000
simulationSettings.timeIntegration.endTime = 2
mbs.SolveDynamic(simulationSettings = simulationSettings)
\end{lstlisting}\vspace{-24pt}\bi\item[]\vspace{-24pt}\vspace{12pt}\end{itemize}
%
%
\noindent For examples on CreateRollingDisc see Relevant Examples (Ex) and TestModels (TM) with weblink to github:
\bi
\item \footnotesize \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/createFunctionsTest.py}{\texttt{createFunctionsTest.py}} (TM),
\exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/TestModels/createRollingDiscTest.py}{\texttt{createRollingDiscTest.py}} (TM)
\ei
%
\begin{flushleft}
\noindent {def {\bf \exuUrl{https://github.com/jgerstmayr/EXUDYN/blob/master/main/pythonDev/exudyn/mainSystemExtensions.py\#L1887}{CreateRollingDiscPenalty}{}}}\label{sec:mainsystemextensions:CreateRollingDiscPenalty}
({\it name}= '', {\it bodyNumbers}= [None, None], {\it axisPosition}= [], {\it axisVector}= [1,0,0], {\it discRadius}= 0., {\it planePosition}= [0,0,0], {\it planeNormal}= [0,0,1], {\it contactStiffness}= 0., {\it contactDamping}= 0., {\it dryFriction}= [0,0], {\it dryFrictionAngle}= 0., {\it dryFrictionProportionalZone}= 0., {\it viscousFriction}= [0,0], {\it rollingFrictionViscous}= 0., {\it useLinearProportionalZone}= False, {\it activeConnector}= True, {\it show}= True, {\it discWidth}= 0.1, {\it color}= exudyn.graphics.color.default)
\end{flushleft}
\setlength{\itemindent}{0.7cm}
\begin{itemize}[leftmargin=0.7cm]
\item[--]
{\bf function description}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]Create penalty-based rolling disc joint between wheel rigid body and ground; the disc is infinitely thin and the ground is a perfectly flat plane; the wheel may lift off; definition of joint position and axis in global coordinates (alternatively in wheel (body1) local coordinates) for reference configuration of bodies; all markers and other quantities are automatically computed
\item[]- NOTE that this function is added to MainSystem via Python function MainSystemCreateRollingDiscPenalty.
\end{itemize}
\item[--]
{\bf input}: \vspace{-6pt}
\begin{itemize}[leftmargin=1.2cm]
\setlength{\itemindent}{-0.7cm}
\item[]{\it name}: name string for joint; markers get Marker0:name and Marker1:name
\item[]{\it bodyNumbers}: a list of object numbers for body0=ground and body1=wheel; must be rigid body or ground object
\item[]{\it axisPosition}: a 3D vector as list or np.array: position of wheel axis in local body1=wheel coordinates
\item[]{\it axisVector}: a 3D vector as list or np.array containing the joint (=wheel) axis in local body1=wheel coordinates
\item[]{\it discRadius}: radius of the disc
\item[]{\it planePosition}: any 3D position vector of plane in ground object; given as local coordinates in ground object
\item[]{\it planeNormal}: 3D normal vector of the rolling (contact) plane on ground; given as local coordinates in ground object
\item[]{\it dryFrictionAngle}: angle (radiant) which defines a rotation of the local tangential coordinates dry friction; this allows to model Mecanum wheels with specified roll angle
\item[]{\it contactStiffness}: normal contact stiffness
\item[]{\it contactDamping}: normal contact damping
\item[]{\it dryFriction}: 2D list of friction parameters; dry friction coefficients in local wheel coordinates, where for dryFrictionAngle=0, the first parameter refers to forward direction and the second parameter to lateral direction
\item[]{\it viscousFriction}: 2D list of viscous friction coefficients [SI:1/(m/s)] in local wheel coordinates; proportional to slipping velocity, leading to increasing slipping friction force for increasing slipping velocity; directions are same as in dryFriction
\item[]{\it dryFrictionProportionalZone}: limit velocity [m/s] up to which the friction is proportional to velocity (for regularization / avoid numerical oscillations)
\item[]{\it rollingFrictionViscous}: rolling friction [SI:1], which acts against the velocity of the trail on ground and leads to a force proportional to the contact normal force;
\item[]{\it useLinearProportionalZone}: if True, a linear proportional zone is used; the linear zone performs better in implicit time integration as the Jacobian has a constant tangent in the sticking case
\item[]{\it activeConnector}: flag to activate or deactivate the connector
\item[]{\it show}: if True, connector visualization is drawn
\item[]{\it discWidth}: disc with, only used for drawing
\item[]{\it color}: color of connector
\end{itemize}
\item[--]
{\bf output}: ObjectIndex; returns index of created joint
\item[--]
{\bf example}: \vspace{-12pt}\ei\begin{lstlisting}[language=Python, xleftmargin=36pt]
import exudyn as exu
from exudyn.utilities import * #includes itemInterface and rigidBodyUtilities
import numpy as np
SC = exu.SystemContainer()
mbs = SC.AddSystem()
r = 0.2
oDisc = mbs.CreateRigidBody(inertia = InertiaCylinder(density=5000, length=0.1, outerRadius=r, axis=0),
referencePosition = [1,0,r],