Create an uneven terrain

Typically: "How do I... ", "How can I... " questions
Post Reply
Adersh M
Posts: 23
Joined: 30 Nov 2022, 06:52

Create an uneven terrain

Post by Adersh M »

Is there a way to create a terrain with z as a nonlinear function of x and y? I want to do motion planning on a terrain that is not flat.
coppelia
Site Admin
Posts: 10747
Joined: 14 Dec 2012, 00:25

Re: Create an uneven terrain

Post by coppelia »

Hello,

yes, you can create a heightfield shape. You can import it, or you can generate it with sim.createHeightfieldShape. See also the models Models/nature/terrain bump.ttm and Models/nature/terrain.ttm

Cheers
Adersh M
Posts: 23
Joined: 30 Nov 2022, 06:52

Re: Create an uneven terrain

Post by Adersh M »

Okay. Thank you. Also, I have tried with the terrain models available in Coppeliasim but faced an issue. Once you configure the heightfield with the GUI and close it, the GUI is gone forever. Further modification is not possible. Also, the exact relation of height with x and y co-ordinate is not provided.
coppelia
Site Admin
Posts: 10747
Joined: 14 Dec 2012, 00:25

Re: Create an uneven terrain

Post by coppelia »

That model is just an example. Best is probably that you generate it yourself, then you can get exactly what you want.

Cheers
mfocchi
Posts: 8
Joined: 07 May 2024, 09:59

Re: Create an uneven terrain

Post by mfocchi »

Dear CoppeliaSim Developers

I need to create a 30 slope for a tracked vehicle, possibly without a sharp edge at the beginning. I was thinking to do it with a heightfield. However I found the interface a bit obscure.
For now I created a flat one 5x5 m square:

height = {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1 ,0.1,0.1}
obj = sim.createHeightfieldShape(2, 0, 3, 3, 5.,height)

I have some questions:
1) array of xPointCount*yPointCount height values: what is this indexing?
2) what is shadingAngle?
3) how to add some texture?
4) the stiffness and the material of the heightfield can be changed? (e.g. to be slightly deformable?) how? or it behaves like a floor?
coppelia
Site Admin
Posts: 10747
Joined: 14 Dec 2012, 00:25

Re: Create an uneven terrain

Post by coppelia »

Hello,

be aware there there is a bug that might affect hightfields in V4.5 and V4.6 (we'll bring V4.7 out in 1-2 weeks hopefully).

Points on the heightfield (in your case) are:

(x-axis points to the right, y-axis to the top)

Code: Select all

p0   p1   p2

p3   p4   p5

p6   p7   p8
Shading angle allows you to make a shape appear smooth or sharp.

The various HF properties are related to the engine you use. You'll have to click engine properties in the shape dynamics dialog.

Cheers
mfocchi
Posts: 8
Joined: 07 May 2024, 09:59

Re: Create an uneven terrain

Post by mfocchi »

Dear
Thank you for the response, I was able to create the slope programmatically, however, when I simulate the robot going over the slope, it penetrates it like if it is not respondable. If I stop the simulation to change the dynamic properties of the heightfield this disappears. If I double click on it during the simulation it says it is static and respondable. What should I do?
I could not find the heightfield as a primitive shape to be put into the scene.
Additionally is there a way to add a texture to it?

thanks!
Michele
coppelia
Site Admin
Posts: 10747
Joined: 14 Dec 2012, 00:25

Re: Create an uneven terrain

Post by coppelia »

Then you are probably experiencing the heightfield bug I mentionned earlier. Please wait until CoppeliaSim V4.7

Cheers
mfocchi
Posts: 8
Joined: 07 May 2024, 09:59

Re: Create an uneven terrain

Post by mfocchi »

Dear

to you have a tentative date 4.7 will be out? otherwise is it possible to have a dirty bugfix?
coppelia
Site Admin
Posts: 10747
Joined: 14 Dec 2012, 00:25

Re: Create an uneven terrain

Post by coppelia »

CoppeliaSim V4.7 should be out today.

Cheers
Post Reply