A SERIOUS SURGICAL simulation!

Share with us how are you using the powerrrr of the force

Moderator: Alain

Re: A SERIOUS SURGICAL simulation!

Postby Charles » Tue Feb 11, 2020 10:32 am

Julio Jerez wrote:To add a funtionality is a three steps process.

1- you add a c sharp interface in unity for the feature you want to add.
say adding the kinematic joint.
2- you write a c++/header class that glue the Unity interface and the class in newton that support that feature
3-you add the header file to the swig script. file newton.i

then you compile the plugin and swig will generate the wrapper that turn the class into a managed c++ objects that can be called from c chaps.
file newton_wrap.cxx


I followed these steps and intergrated the class of dCustomKinematicController into Unity this afternoon, and it worked! But there is a question denoted as Q2.

Q2: i called the function described in the image appended just once, but the body will move back and forth for quite a few seconds before settle down. I had tried to "SetPickMode" but got no better.

You could see the appendix for details:
function called: https://drive.google.com/open?id=1WPmhO ... vFuCw4lYM_
components in Unity: https://drive.google.com/open?id=1LJ3OR ... 9xBNPSzqFj
end result: https://youtu.be/K_0G_WuPCMg
Charles
 
Posts: 43
Joined: Thu Jan 16, 2020 12:58 am

Re: A SERIOUS SURGICAL simulation!

Postby Julio Jerez » Tue Feb 11, 2020 12:53 pm

Oeh you have the dll linking, cool.
This morning I saw that the cshap dll was making reference to some vehicle classes that I have commented out. So I fixed that.

I see you are on your way and you do not really need much assistance on the unity side.

What I will do is that I will create a mock-up demo of the thing you try to simulate.

I assume it is some kind of long flexible pipe, stiffer than a rope but more flexible than a metal wire. That can be simulated by a series of connected short rods using thin capsules.
This capsules are jointed by a universal joint that allows bending under some stress but that does not allows relative rotation along the axial axis.
The root is connected to a heavier body that can be used as a handle to manipulate the entire thing.

Did I get this right?
if so can you tell me dimensions?
Or if I missed the point, please correct my interpretation.

This demo will be part of the standard joint demos in the sandbox, and you can use as a template to make you thing in Unity.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: A SERIOUS SURGICAL simulation!

Postby Julio Jerez » Tue Feb 11, 2020 3:38 pm

Charles wrote:Q2: i called the function described in the image appended just once, but the body will move back and forth for quite a few seconds before settle down. I had tried to "SetPickMode" but got no better.

I was gong to go on a long explanation but, what I am going to do is that I will make the demo and show you how to solve these problem.
believe or not what you are seen is a good thing. but you parameter are not properly calibrated.

modeling with Newton is more close to reality that with some of the impulse based engines. so you will have to unlearn some of the stuff the "experts has been tell people for the pass 15 years".

but anyway let me fix the demo so they you can see how is put together, then you can ask more specific questions.
you mention C++ before, are you able to read teh SDK demos. or play the sandbox demos?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: A SERIOUS SURGICAL simulation!

Postby Charles » Tue Feb 11, 2020 10:15 pm

Julio Jerez wrote:I see you are on your way and you do not really need much assistance on the unity side.

What I will do is that I will create a mock-up demo of the thing you try to simulate.


That would be great! Thanks! :D :D :D

Julio Jerez wrote:I assume it is some kind of long flexible pipe, stiffer than a rope but more flexible than a metal wire. That can be simulated by a series of connected short rods using thin capsules.
This capsules are jointed by a universal joint that allows bending under some stress but that does not allows relative rotation along the axial axis.
The root is connected to a heavier body that can be used as a handle to manipulate the entire thing.

Did I get this right?
if so can you tell me dimensions?
Or if I missed the point, please correct my interpretation.


Almost there :D , but i think it will be helpful to get you more familiar with the real operation-Percutaneous Coronary Intervention. Here are some good vedios for that purpuse.
https://www.youtube.com/watch?v=HOwyDph3b2c
https://www.youtube.com/watch?v=gvRtP3wl_AY
https://www.youtube.com/watch?v=I45kJJoCa6s

I also take a screenshot of the first vedio to illustrate the very detail and the dimentions.
https://drive.google.com/open?id=1TlYQc ... tWo5eTlGhP

Note that you can perform uniform scale of all the objects,for example 10 times bigger if some objects' size are too small to handle.

Back to what you said, i think you lost the BLOOD-VESSEL part, an object with PREKNOWN deform animation. And i want handle it as a rigidbody as i said before. :D :D :D
Last edited by Charles on Tue Feb 11, 2020 10:42 pm, edited 2 times in total.
Charles
 
Posts: 43
Joined: Thu Jan 16, 2020 12:58 am

Re: A SERIOUS SURGICAL simulation!

Postby Charles » Tue Feb 11, 2020 10:31 pm

Julio Jerez wrote:but anyway let me fix the demo so they you can see how is put together, then you can ask more specific questions.
you mention C++ before, are you able to read teh SDK demos. or play the sandbox demos?


That's kindful! Yes i can read the SDK demos and a little coding in c++ is also OK now. And i have play the sandbox demos several times.

In addition i think i should synchronize the version information with you. When i built the newest UnityPlugin the other day, i got only one dll not three. Therefore, i used the old version of NewtonDynamics and the UnityPlugin now. :(
Charles
 
Posts: 43
Joined: Thu Jan 16, 2020 12:58 am

Re: A SERIOUS SURGICAL simulation!

Postby Julio Jerez » Wed Feb 12, 2020 12:00 pm

no sure what you mean by old version, teh plugin generates three dll.

NewtonWrapper.dll is the cpp dll that glue the newton SDK which is compiled static and the swig wraped that make manage c++ interrace that can be call form cshap.

NewtonPlugin.dll is a csharp dll of classes that are added to the unity.

NewtonPluginEditor.dll is an editor class to present the some of the gui controllers in the editor. thsi si no needed for run time onle for the editor.

you should try to get later and build it, because this is what I am using. The library compile and link so it should work with Unity, I have no tested because I can do that during week days.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: A SERIOUS SURGICAL simulation!

Postby Julio Jerez » Wed Feb 12, 2020 2:51 pm

ok I start adding the demo for the flexible pipe.
so far is just a long pipe made of 50 small capsules of 0.5 unit in length each. this is configurable.
is all rigid for now after I will add the option for make flexible and with the ability of rotate around the axial axis.
if you sync the newton SDK you can see what I mean and tell me if is goes the right direction.

the function name is
void AddFlexyPipe(DemoEntityManager* const scene, const dVector& origin)
you can play with the number of links and the dimensions.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: A SERIOUS SURGICAL simulation!

Postby Julio Jerez » Wed Feb 12, 2020 3:24 pm

ok I added this ineface to control the cone angle stiffness independent of the joint per joint stiffness.

void SetConeStiffness(dFloat coneStiffness);
dFloat GetConeStiffness(dFloat coneStiffness) const

and very tiny amount make the joint act like a some what stiff rope.
you can play with it an tell if it is alone what you look for?
I will stop here now until you review it.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: A SERIOUS SURGICAL simulation!

Postby Julio Jerez » Wed Feb 12, 2020 9:01 pm

ok I added one last setting to the joint so that it look like, I believe what you seek.

you nee to sync to later and run the sandbox, is setup to run that demo.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: A SERIOUS SURGICAL simulation!

Postby Charles » Thu Feb 13, 2020 9:54 am

Julio Jerez wrote:ok I added one last setting to the joint so that it look like, I believe what you seek.

you nee to sync to later and run the sandbox, is setup to run that demo.


The simulation is AMAZING and so STABLE! :D :D :D The slender rod is just what i have been looking for.

I also digged into the code and try to add two new features to the first node but failed today. For this two features i need your professional help anagin. They are described below:

1.The motion of the first node are no problem for now, but i don't know how to twist the first node. When come to twist i mean rotating the node around an axis of the node itself, as shown in this vedio:

https://youtu.be/fjB3C-2BUFQ
The first node roates around the z axis of itself and the following nodes also roate of the same angle as a result. This simulates the surgeon rotating the proximal end of a catheter in order to choose the proper vessel to move in. The catheter's tip has curved shape in rest state so when twisted it can go to the proper vessle. As showned :
https://drive.google.com/open?id=1W3Ycr ... z_-y6y4Bqa

I tried the follwing code, but i did not got the exactly effect:
https://drive.google.com/file/d/1D4g6o9 ... sp=sharing

2.The first node can only be manipulated by the player(move/twist). It must not be affected by any other objects. And i can't figure out how to do that. In reality, the sugeon must hold the proximal end of the catheter tightly to ensure it is stable.
Charles
 
Posts: 43
Joined: Thu Jan 16, 2020 12:58 am

Re: A SERIOUS SURGICAL simulation!

Postby Julio Jerez » Thu Feb 13, 2020 11:48 am

Charles wrote:The simulation is AMAZING and so STABLE! :D :D :D The slender rod is just what i have been looking for.

ok thanks
Now you can see that not all physics engines are created equal.
The claims of some are closer to the truth than the claims of the self appointed experts who's only achievement seems to be hitpieces pseudo academic papers, that they pier review themselves.
These self appointed expert are the most dishonest and corrupt people I have ever met. They use accademia as weapons to favor themself, their friends and the company the sponsor their grants.


The rest of the questions, I have not done yet. I will try some time today.
the trick is that you are not going to be able to manipulate any of the link themself to get other to do what you want, the reason is that each link is subjected equally to the influence of the others. so any action applied to one is transmitted to the neighbor and the neighbor neighbored and so on.

This is how the laws of physics works. in most systems there will a dominant massive body that dictate how the others will move.

in the example you gave, you say the doctor manipulate the catheter tip, he would not be able to do it if there was not some kind of handle that translate the doctor motion to the catheter.

in this simulation we can emulate that with a handle that will be several time heavier that the link,
20 or 40 time heavier. and the first link will be constrained to this object.

what this does is that it act as a impedance in the system that separate the the handle from the rest of the links. now the problem reduces to simple manipulating the handle object.

of course the handle could be the first link, but to make it stand out I will use a different size cylinder.
then this cylinder can be contrained to the world with a kinematic joint that you can controll at will to the degree of precision that the simulation allows.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: A SERIOUS SURGICAL simulation!

Postby Julio Jerez » Sat Feb 15, 2020 10:05 am

ok I now added the handle object.
it is represented by a cylinder which a little larger and 30 time heavier that a single link.
it is connected to the first link wit the same joint.

you can move with the mouse and see that is work but you will see bad behavior if you move violently.
this is because the mouse pick function aren't smooth.

pick bodies from the screen is not something that resemble anything close to reality. because the values on the screen and subjected to the perspective projection. For example a one pixel distance translate to very differnce push forces depending on the distance from the eyepoint.

for this to work the next step is adding a GUI interface to manipulate a control joint that is attached to the cylinder handle.

the joint is one that is designed to only let the handle moves along the allows degree of freedom.
this GUI is what you use to interface with the entire thong, and you can even map the inputs a Haptic device if you have one.

that will be the complete demo. I believe but for now Sync the SDK and see if you undertand it so far.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: A SERIOUS SURGICAL simulation!

Postby Charles » Sun Feb 16, 2020 9:54 am

Julio Jerez wrote:that will be the complete demo. I believe but for now Sync the SDK and see if you undertand it so far.


Thanks a lot! I have digged the source and finally, I have merged the demo scence of standard joint into the Unity, and it run very well!

But i have an question here: How can i rotate the handle around the axis of itself, say the z axis of the handle? Each time i try to do that, the handle always rotate about the world axis not axis of itself. And i tried many ways but the result are all the same.
Charles
 
Posts: 43
Joined: Thu Jan 16, 2020 12:58 am

Re: A SERIOUS SURGICAL simulation!

Postby Charles » Sun Feb 16, 2020 10:10 am

Dave Gravel wrote:For my part I have work and help about bronchoscope project.


Hi Dave Gravel, i don't know the detail process of bronchoscope.

There may be one big difference: In the process of cardiovascular intervention, a guidewire moves along a catheter. And they are both slender rods which manipulated by the sugeon. So, does bronchoscope has the same situation?
Charles
 
Posts: 43
Joined: Thu Jan 16, 2020 12:58 am

Re: A SERIOUS SURGICAL simulation!

Postby Dave Gravel » Sun Feb 16, 2020 1:09 pm

Hi Charles,
I can't certified for sure, To me both look very similar.
It make already many years maybe some methods have change from the times.
I remember the simulation and the possible movement by the rod and again it look very similar.
Maybe from the bronchoscope the simulation is a bit more simpler.
The bronchoscope have a guidewire too but i'm not 100% sure if it can move the exact same way.
I think in some special cases you can use the bronchoscope without guidewire but in general it use a guidewire.
Sorry I can't give more detail I don't know more about it.
Your work look very nice done and the video is really nice.
I have just like to share with you that I have already see and work on similar simulation and that newton dynamics is able to reproduce it.
Last edited by Dave Gravel on Sun Feb 16, 2020 4:12 pm, edited 1 time in total.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

PreviousNext

Return to User Gallery

Who is online

Users browsing this forum: No registered users and 5 guests

cron