Excavation Environment

Typically: "How do I... ", "How can I... " questions
Post Reply
razer200033
Posts: 16
Joined: 27 Nov 2021, 19:41

Excavation Environment

Post by razer200033 »

Hi!

I am working on simulating an excavator. I have imported an STL mesh from a CAD software (screenshot attached). Now, I want to fill it with sand.

How can I do this?

https://ibb.co/yhRkb7h

Thanks!

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: Excavation Environment

Post by coppelia »

Hello,

sand and terrain deformation is not supported in CoppeliaSim. But this is how I would do it:
  • use dynamically enabled spheres as sand/rocks. Make sure to not use not too many of them
  • Make sure that they have a rotational damping, so that they do not roll on the floor, or only very little
  • Your imported shape is a random mesh currently: it will perform very bad with collision detection via the physics engines. Best is to reproduce that shape with cuboids.
  • When a rock moves below a certain Z-coordinate, surveil its movement. If it stops moving, or moves less than x meters per simulation step, make it static. You could also group it with the other static rocks, so that you get a bit more efficient
  • you can have a child script in charge of handling all rocks (creation, tracking, making them static, grouping, etc.), but you could also have each rock manage itself with a child script per rock. That would be a bit more delicate to handle.
some of the functions you can use: sim.copyPasteObjects, sim.groupShapes, sim.setObjectInt32Param(objHandle,sim.shapeintparam_static,staticState). Make one static rock and adjust its parameters. Then when simulation starts, duplicate it, make it dynamic, etc.

Cheers

razer200033
Posts: 16
Joined: 27 Nov 2021, 19:41

Re: Excavation Environment

Post by razer200033 »

Hi!

Thanks for replying.

I added multiple spheres, then added an invisible plane to prevent them from escaping from the top. Some of the spheres still escaped from the top.
Secondly, many of the generated spheres are shooting out from the sides and the bottom of the mesh. I also tried to create the mesh in a separate scene using several cuboids, which I later merged and made it static and respondable. But, the spheres were generating within the inner cuboids.

How do I deal with the escaping spheres, and make them static after generation?

I have attached the video of the simulation(in the STL mesh) and the screenshot of the script.

Simulation: https://streamable.com/uvrbwi
Screenshot: https://ibb.co/XSwGzCR

Thanks!

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: Excavation Environment

Post by coppelia »

You can try to add some linear damping to the spheres, but usually if they escape it is because there are forces pushing them out. This often happens when an dynamically enabled shape is created at the location where another dynamic object is already present.

To set a dynamically enabled shape to static mode, simply do:
sim.setInt32Parameter(shapeHandle,sim.shapeintparam_static,1)

cheers

Post Reply