Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
Simulating Guidewires In Blood Vessels
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Robin Viellieber
Simulating Guidewires In Blood Vessels
Commits
449ee0d3
Commit
449ee0d3
authored
Dec 02, 2022
by
rv3Dcv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add TimeStep
Performed debugging to understand the impact of the timestep on constraint solving
parent
1563d0d5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
11 deletions
+30
-11
CollisionTestPerformer.cs
...ulation/Assets/Guidewire_Assets/CollisionTestPerformer.cs
+19
-0
CollisionTestScene_2Spheres_CustomPipe.unity
...ewire_Assets/CollisionTestScene_2Spheres_CustomPipe.unity
+2
-2
PredictionStep.cs
...ewireSimulation/Assets/Guidewire_Assets/PredictionStep.cs
+3
-3
SimulationLoop.cs
...ewireSimulation/Assets/Guidewire_Assets/SimulationLoop.cs
+6
-6
No files found.
GuidewireSimulation/GuidewireSimulation/Assets/Guidewire_Assets/CollisionTestPerformer.cs
View file @
449ee0d3
...
...
@@ -67,5 +67,24 @@ public class CollisionTestPerformer : MonoBehaviour
Debug
.
Log
(
"Velocity at test end: "
+
simulationLoop
.
sphereVelocities
[
1
].
ToString
(
"e2"
));
Debug
.
Log
(
"End of Pull Phase of Collision Test Two"
);
}
// private IEnumerator PerformCollisionTestThree(float exitVelocity = 4f)
// {
// for (int sphereIndex = 0; sphereIndex < (simulationLoop.SpheresCount - 1); sphereIndex++)
// {
// simulationLoop.sphereExternalForces[sphereIndex] = Vector3.zero;
// }
// simulationLoop.sphereExternalForces[simulationLoop.SpheresCount - 1] = pullForce;
// yield return new WaitForSeconds(applyForceTime);
// simulationLoop.sphereExternalForces[simulationLoop.SpheresCount - 1] = Vector3.zero;
// float timeDiff = Time.time - startTime;
// Debug.Log("Elapsed time of collision test: " + timeDiff);
// Debug.Log("Velocity at test end: " + simulationLoop.sphereVelocities[1].ToString("e2"));
// Debug.Log("End of Pull Phase of Collision Test Two");
// }
}
}
\ No newline at end of file
GuidewireSimulation/GuidewireSimulation/Assets/Guidewire_Assets/CollisionTestScene_2Spheres_CustomPipe.unity
View file @
449ee0d3
...
...
@@ -415,7 +415,7 @@ PrefabInstance:
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
4233146888435007091
,
guid
:
0e128b35dc3ea6746b6de609560d672d
,
type
:
3
}
propertyPath
:
timeStep
value
:
0.0
4
value
:
0.0
02
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
4233146888435007091
,
guid
:
0e128b35dc3ea6746b6de609560d672d
,
type
:
3
}
propertyPath
:
fixedTimeStep
...
...
@@ -435,7 +435,7 @@ PrefabInstance:
objectReference
:
{
fileID
:
152071858
}
-
target
:
{
fileID
:
4233146888435007091
,
guid
:
0e128b35dc3ea6746b6de609560d672d
,
type
:
3
}
propertyPath
:
solveStretchConstraints
value
:
0
value
:
1
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
4233146888435007091
,
guid
:
0e128b35dc3ea6746b6de609560d672d
,
type
:
3
}
propertyPath
:
solveBendTwistConstraints
...
...
GuidewireSimulation/GuidewireSimulation/Assets/Guidewire_Assets/PredictionStep.cs
View file @
449ee0d3
...
...
@@ -31,15 +31,15 @@ public class PredictionStep : MonoBehaviour
{
// Debug.Log("dt " + Time.deltaTime + " fdt " + Time.fixedDeltaTime);
Vector3
calc
=
Time
.
deltaTime
*
sphereInverseMasses
[
1
]
*
sphereExternalForces
[
1
];
Debug
.
Log
(
"dt "
+
Time
.
deltaTime
+
" invMass "
+
sphereInverseMasses
[
1
]
+
" extF "
+
sphereExternalForces
[
1
].
ToString
(
"e3"
)
+
" calc "
+
calc
.
ToString
(
"e3"
)
+
" vorherigeVel "
+
sphereVelocities
[
1
].
ToString
(
"e3"
));
//
Debug.Log("dt " + Time.deltaTime + " invMass " + sphereInverseMasses[1] + " extF " + sphereExternalForces[1].ToString("e3")
//
+ " calc " + calc.ToString("e3") + " vorherigeVel " + sphereVelocities[1].ToString("e3"));
for
(
int
sphereIndex
=
0
;
sphereIndex
<
sphereVelocities
.
Length
;
sphereIndex
++)
{
sphereVelocities
[
sphereIndex
]
+=
Time
.
deltaTime
*
sphereInverseMasses
[
sphereIndex
]
*
sphereExternalForces
[
sphereIndex
];
}
Debug
.
Log
(
"velocity "
+
sphereVelocities
[
1
].
ToString
(
"e3"
));
//
Debug.Log("velocity " + sphereVelocities[1].ToString("e3"));
return
sphereVelocities
;
}
...
...
GuidewireSimulation/GuidewireSimulation/Assets/Guidewire_Assets/SimulationLoop.cs
View file @
449ee0d3
...
...
@@ -88,13 +88,16 @@ public class SimulationLoop : MonoBehaviour
* @attention Make sure that the guidewire setup fulfilles that the distance between two adjacent
* spheres is #rodElementLength.
*/
[
SerializeField
]
[
Range
(
0.001f
,
0.04f
)]
float
timeStep
=
0.01f
;
//!< The fixed time step in seconds at which the simulation runs.
[
SerializeField
]
[
Range
(
0.002f
,
0.04f
)]
float
timeStep
=
0.01f
;
/**< The fixed time step in seconds at which the simulation runs.
* @note A lower timestep than 0.002 can not be guaranteed by
* the test hardware to be executed in time. Only choose a lower timestep if
* you are certain your hardware can handle it.
*/
public
float
TimeStep
{
get
{
return
timeStep
;
}}
public
int
SpheresCount
{
get
;
private
set
;
}
//!< The count of all #spheres of the guidewire.
public
int
CylinderCount
{
get
;
private
set
;
}
//!< The count of all #cylinders of the guidewire.
int
counter
=
0
;
private
void
Awake
()
{
Assert
.
IsFalse
(
spheres
.
Length
==
0
);
...
...
@@ -142,12 +145,9 @@ public class SimulationLoop : MonoBehaviour
*/
private
void
FixedUpdate
()
{
if
(
counter
>
2
)
return
;
if
(
ExecuteSingleLoopTest
)
return
;
PerformSimulationLoop
();
counter
++;
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment