## Applying wheel contact forces

Typically: "How do I... ", "How can I... " questions
drodriguez
Posts: 1
Joined: 06 Jul 2018, 02:10

### Applying wheel contact forces

Hi,
I've been trying to simulate a scene containing a 4-wheel robot in which I overwrite the physics engine by making the floor and the wheels non-respondable and applying the contact forces and torques calculated in an external python script to each of the wheels. I need to do this so that I can simulate the movement of the robot through different types of terrains, such as sand or snow.

For the purpose of checking the feasibility of doing this in VREP, I created a very simple scene in which the forces, in this case, are applied through sim.addForcesAndTorques in a child script.

The simplified model of the robot contains two rockers, or arms, attached to each side of the main body as can be seen in the image below. These arms allow the robot to surmount obstacles while keeping the 4 wheels in contact with the ground. In reality, there is a differential gear connecting the two arms. In order to simulate the effect of the differential, what I've done is to create a dependency between the arm joints so that the position of one joint is always the same but opposite to the other (this forces me to use VORTEX).

Now, everything seems to be working just fine if I use Vortex to simulate the contact of the wheels with the floor. The problem comes when I try to apply the contact forces myself. I have checked every possible source of error that I can think of: inertias, relationships between masses of the different parts, playing with local masks; but even for the simple case of keeping the robot in place without moving, by just applying vertical forces equivalent to that of gravity, the model behaves in a very unstable and sometimes strange fashion. (see scene below for reference)

I have been trying to make it to work for so long that it might be that I'm overlooking a very simple mistake. I will truly appreciate any guidance or recommendations.

Thanks!

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

### Re: Applying wheel contact forces

Hello,

you can't simply apply fixed forces, since a tiny little positional/orientational error will make your vehicle spin faster and faster. Notice that with all physics engines, but the Newton engine, you'll have that spinning. Also with Newton, you'll get this, if the initial orientation of your vehicle is slightly off.

You will need a controller that regulates your forces according to their z-position relative to the floor.

If you do the regulation from the Python remote API client, then you should run in synchronous mode and make sure to set the simulation time step at the same size as the dynamics step (i.e. by default the simulation step is 50ms, while the dynamics step is 5ms, which means that by default the physics engine will perform 10 calculation passes for each simulation step).

Cheers