Clarification on sim.getContactInfo

Typically: "How do I... ", "How can I... " questions
Post Reply
shac12
Posts: 9
Joined: 06 Jul 2019, 13:21

Clarification on sim.getContactInfo

Post by shac12 » 31 Oct 2019, 06:38

Hi,

I am trying to use the sim.getContactInfo function to get the reaction forces on a wheel. The explanation of the index argument is not exactly clear. If I want the reaction forces at all the contact points what index am I meant to input ?

Kind Regards,
Sharif

shac12
Posts: 9
Joined: 06 Jul 2019, 13:21

Re: Clarification on sim.getContactInfo

Post by shac12 » 31 Oct 2019, 07:04

Hi,

I would also like to ask whether the returned reaction force is with respect to the absolute frame of reference. i.e a wheel rolling about the y axis would generate a reaction force in the x direction.

Kind Regards,
Sharif

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

Re: Clarification on sim.getContactInfo

Post by coppelia » 01 Nov 2019, 12:17

Hello Sharif,

by default a simulation step in V-REP has 10 dynamics sub-steps. This can of course be adjusted. But in that case the index argument will vary between 0 and 9.
Values are expressed in the absolute reference frame. Have a look at the example model in Models/other/contact display.ttm

Cheers

shac12
Posts: 9
Joined: 06 Jul 2019, 13:21

Re: Clarification on sim.getContactInfo

Post by shac12 » 05 Nov 2019, 12:08

Hi coppelia,

I ended up doing this and it seems to work fine. It is a reasonable estimation of the applied torque. It sums up all the force that the various contacts experience. Perhaps I might suggest that there be an inbuilt function to just give the sum instead of looping through all the contact points and summing it manually.

local i = 0
local force = {0, 0}
local reactionForce = {0, 0, 0}
while (reactionForce ~= nil) do
force[1] = force[1] + reactionForce[1]
force[2] = force[2] + reactionForce[2]
_, _, reactionForce, _ = sim.getContactInfo(sim_handle_all, wheelH, i)
i = i + 1
end

I also found out that only newton and vortex seem to support different value for kinetic and static friction for materials. ODE and Bullet have the same value for both kinetic and static which is a crucial factor in accurately modelling slip and how my traction controller would operate. So I have switched to newton physics engine, haven't been able to get vortex to work as of yet.

Kind Regards,
Sharif

Post Reply