## Custom material

Typically: "How do I... ", "How can I... " questions
kleinash
Posts: 112
Joined: 28 Sep 2014, 09:58

### Custom material

Hi,

I have created a unique surface for my object which I am importing into vrep. This is so that I can modify the dynamic properties and see the effects.

I do this by selecting defaultMaterial and duplicating it, giving it a unique name, and saving the scene.

However, every time I re-open my scene I have to reselect the chosen material for my object (which I don't mind doing) but I find that there are a number of surface that have spawned and saved in the scene, the list just keeps growing and growing each time I run the simulation so it takes longer for me to scroll down and find the material that I originally created.

Is this a known issue? Is there a way to stop it?

Thx

coppelia
Posts: 7838
Joined: 14 Dec 2012, 00:25

### Re: Custom material

Hello,

yes, this is a known issue and has been corrected for next release. In next release actually, materials won't be shared among shapes anymore, i.e. each shape will have its one material, that if modified, will only affect that single shape.

Cheers

kleinash
Posts: 112
Joined: 28 Sep 2014, 09:58

### Re: Custom material

Ok, thank you. Is there any reason why this causes changes in how the simulation works? I ask because of the issue I am getting.

I have a child script that runs during the simulation "TheAlmighty"
I import an object and set its material id line 49. (it started out as 'usr_ode_mat' and I change it here each time so keep with what's been generated)

I want to see the effect of the variables within ODE. So I run the simulation and record some values that I got from a real robot. Then I plot the correlation - the first thing I tried was friction - I got a great value for correlation, but when I ran the simulation again it came out with a different value for correlation - even though I had changed nothing.

I have tried so solve the issue by setting "TheAlmighty" itself to have a material value (line 123) - but that does not seem to help.

https://www.dropbox.com/s/miytanf3v4gw1 ... e.ttt?dl=0

coppelia
Posts: 7838
Joined: 14 Dec 2012, 00:25

### Re: Custom material

If you are running with ODE, then indeed, there will be different results from one simulation run to the next. So if you restart V-REP every time before running a simulation, you should get the exact same results. Is that correct?

This happens with the ODE plugin, version 8 and before. See this post for details.

Cheers

kleinash
Posts: 112
Joined: 28 Sep 2014, 09:58

### Re: Custom material

Yes, that is correct. Thank you.

EDIT: I followed the attached suggestion and found that the object disappears as said when quickStep is deactivated. (Ubuntu 16.04; V-REP 3.3.2r3 64 bit)
I then added this line to "TheAlmighty"

Code: Select all

    seed=0
simSetEngineInt32Parameter(sim_ode_global_randomseed,-1,seed)
But am still getting non-deterministic - do I have it down correctly?

coppelia
Posts: 7838
Joined: 14 Dec 2012, 00:25

### Re: Custom material

This has not yet made it into V-REP 3.3.2. It will be in next release

Cheers

kleinash
Posts: 112
Joined: 28 Sep 2014, 09:58

### Re: Custom material

coppelia wrote:This has not yet made it into V-REP 3.3.2. It will be in next release

Cheers
Ok - thank you.

Is there a way to either:

1) Save all aspects of the simulation so that when it is re-run it will do exactly the same thing as it did previously. To be able to optimise the constraints of ODE.
2) Set the seed so that it does #1 in the source code - I have looked for the boolean setting for #define RANDOMLY_REORDER_CONSTRAINTS 1 but cannot find it in the VREP folder.

We settled on using ODE, but perhaps looking at one of the other engines now is the answer. before this made things unstable though.

coppelia
Posts: 7838
Joined: 14 Dec 2012, 00:25

### Re: Custom material

I would recommend to wait for the next release, since:
• You will be able to set the seed programmatically (for the ODE engine)
• Normally the Vortex engine should be freely available.
Cheers

kleinash
Posts: 112
Joined: 28 Sep 2014, 09:58

### Re: Custom material

Thank you!

Just as interest - when will that be?

I have tried using the Newton and Vortex engines - but both are proving to be unstable, I think it has to do with my objects being imported rather than built from within VREP. Vortex does not seem to have a user manual that can help with stability within VREP and Newton straight up won't work with the imported objects. The hand breaks apart and the object acts as though its swimming then sinking.

ODE is the most stable out of all three, but the non-determinism is an issue. I will have to set the seed, run the simulation to see what the result is - if the correlation (with the real world) is high enough keep the seed, but if not then unset seed and run again till I get a higher correlation.

coppelia