Hi,
the problem is that, by removing only the bodies, the links that are bound 
to such bodies will have dangling pointers. For the time being you can 
remove the relative links by doing something like:

Before the simulation loop:







*myfoot  = mysystem.SearchBody('M-410iB-300 
-3/M-410iB-300-12-1')myfoot_linklist = []for link in 
mysystem.Get_linklist():    if (chrono.CastToChLinkMateGeneric(link)):      
  mate_link = chrono.CastToChLinkMateGeneric(link)        if 
(mate_link.GetBody1() == myfoot or mate_link.GetBody2() == myfoot):        
    myfoot_linklist.append(mate_link)*

*removed = False*

and in the simulation loop











*while(vis.Run()):    vis.BeginScene()    vis.Render()    
mysystem.DoStepDynamics(0.001)    vis.EndScene()    if mysystem.GetChTime() 
> 1 and not removed:        mysystem.RemoveBody(myfoot)        for link in 
myfoot_linklist:            mysystem.RemoveLink(link)        removed = True*

However, we may add an option to *ChSystem::RemoveBody* to optionally take 
care also of attached links.

BTW, we are going to update that spider_robot demo soon with the latest API 
changes.



Il giorno sabato 13 gennaio 2024 alle 09:13:51 UTC+1 [email protected] ha 
scritto:

> Hello everyone.
>
> I custom modeled a wheelbarrow in solidwork and installed a motor on each 
> wheel. As shown in the picture below. Where A,B, and C are the parts of the 
> wheel and body. 1️⃣ and 2️⃣ indicate universal joints.
> After the modeling is complete, simulate in the pychrono simulator. I want 
> to delete 2️⃣ and C at some point in the car's motion. Using this method 
> Chsystem. Removebody () (HTTP: / / 
> https://api.projectchrono.org/classchrono_1_1_ch_system.html#a6bcfccb9a810168596f0a53e02a8
>  
> 7b58). When I used it, it seemed to delete the unexpected "body" except for 
> 2️⃣ and C. And the simulation freezes. Am I using it in a wrong way?
> I use the official documentation spiders code examples (
> https://api.projectchrono.org/tutorial_pychrono_demo_spider_robot.html). 
> I found that this problem also occurred, I deleted "bbody", but only left 
> bbody. Remove the arm part of spider, it will also get stuck.
> Am I using it in a wrong way? Please help me take a look, thank you very 
> much!!
> (video link:https://youtu.be/ewbHQHve4AE)
> Regard,
> Jay[image: CleanShot 2024-01-13 at [email protected]]
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/ae274d67-609a-4646-8709-8007e0bbb4e7n%40googlegroups.com.

Reply via email to