Deformable surface contact

Typically: "How do I... ", "How can I... " questions
briany
Posts: 6
Joined: 26 Apr 2013, 14:11

Deformable surface contact

Post by briany » 26 Apr 2013, 15:13

Hi, I'm trying to simulate the behaviour of a hexapod moving across a deformable surface such as a sand bed. To keep it simple at this stage I'm intending to ignore the fact that the robot will sink into the surface, I just want to model the force action / reaction between the feet and the ground. I have a model of what that relationship is, the challenge is to implement it in V-REP!

Although the reality is a bit more complex than this, a rough idea of what happens is that as the foot applies a shear force to the ground to propel the robot forward, and as the force applied by the foot increases, the reaction force from the ground initially will be a similar value but eventually will reach a limit as the sand fails and starts to flow; the foot then will lose traction and the leg will slip in the sand.
I saw this post viewtopic.php?f=9&t=350 on a somewhat similar topic and have implemented a force sensor on the end of the leg so I can derive the force applied by the foot to the ground. However I am not clear how I then use this information to modify the behaviour of the contact - in effect I either want the frictional properties of the interface to change depending on how much force the foot applies, or have the reaction force calculated eg in a script and applied instead of the normal physics engines result. Can you help?

Thanks!

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

Re: Deformable surface contact

Post by coppelia » 26 Apr 2013, 15:54

Hello Brian,

The task is not easy. In your case, it would be really messy to act upon the friction/contact model, because that would allow you to somehow control the friction, but not the penetration. And even the friction is very difficult to control: remember that with physics engines such as Bullet or ODE that V-REP supports, a friction of X doesn't mean anything (there is no physical size attached to that X). Moreover a friction of X in ODE will have a different result in Bullet.

But following is my suggestion/idea, since you probably later intend to have the feet sink into the sand too:
  • Have the feet of the hexapod and the ground not react to collision. You can reach that behaviour by setting complementary respondable masks for the two entities.
  • Have the minimum distance calculated between each foot tip and the ground. You can for that register 6 distance objects in the distance calculation module and then call simReadDistance.
  • Have 6 feet support pads, maybe looking like a cap that could be fitted onto each foot tip, follow the distance on the floor where the minimum distance point is measured. Those pads need to be static and respondable. Those pads would need to be controlled in position by you.
  • Feet would just rest on those pads, not the ground. The force sensors can be mounted on the legs, or on the pads, it doesn't matter. Then you could control the pads quite precisely, allowing the foot to sink if you lower the pad, or slide horizontally to mimic the dynamic friction in the sand.
  • Not sure if this point is necessary, but you could even mount the pads on 3 prismatic joints operating in a similar way as damped springs. You would still have to position the base of that construction under each leg at the point of collision.
In above scenario, if your floor is flat, you could simplify a lot things: no need to calculate the minimum distance to the ground. And on uneven ground, you could also use a proximity sensor of type ray that could calculate the point where the feet would touch the ground (will be a bit faster than the distance calculation).

I guess that will be the best modelisation of walking in sand you could get, given the physics engines restrictions.

Cheers

briany
Posts: 6
Joined: 26 Apr 2013, 14:11

Re: Deformable surface contact

Post by briany » 28 Apr 2013, 08:26

Hi, I like the support pads idea, really neat, and as you say, it will enable me to simulate the full x,y,z movement of the foot including the sinkage. Essentially this seems to be comprised of two methods to control the position of the support pads - one based on the minimum distance calculation when there is no force on the pad (the foot is in the air) and one based on my foot / sand algorithm when the foot is in contact with the pad.
I will have a go at implementing a ray type proximity sensor to deal with the first aspect. I guess I need to "steer" the ray to point along the foot trajectory, the components of which are the (downward) foot movement and the (forward) movement of the robot base. To do this, should I have the sensor have its own child script, calculate the a,b,g angles from these components and use simSetObjectOrientation to point the ray?

The pads then likewise have their own child scripts which control their position; if the force is zero, they take the point on the surface pointed to by the ray, if non zero the script has explicit rules to move the pads across the surface and into it (sinkage).

Suppose I use a heightfield to represent uneven ground? For the first phase the minimum distance calculation gives me the point on the surface, but in the second phase the pads will slide across the surface with +- change in the z axis also. Ideally I want a shorthand way of constraining the movement to the heightfield surface so my algorithm can calculate z movement(sinkage) and translation in the x,y plane (as though its on the flat), but then apply these to movements across / into a non planar surface? Is there a (relatively) easy way of doing this?

By the way, I think V-REP is a great product, particularly in the way it combines accessibility, so its quick to get started, with really powerful and extendable features.

Regards

Brian

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

Re: Deformable surface contact

Post by coppelia » 28 Apr 2013, 22:10

Hello Brian,

For the ray-type proximity sensors, just position all of them under the ground, vertical, looking up, at a fixed Z-position. Then simply have each one of them follow their respective foot tip in X/Y coordinate (I'd use a dummy or sphere-shape for the tip). Then you can figure out the Z-coordinate of the point on the ground by adding the Z-coord. of the proximity sensor and the measured distance to the ground of the proximity sensor. Just make sure the proximity sensors can only detect the ground.

When your pads slide across the surface, you can calculate the sinking depth using the above distance calculation. The proximity sensor will also return the normal vector of the detected point on the ground. You can also use several sampled points around one foot, to determin an interpolated position for your foot.

I'd attach the pads to their respective proximity sensors. You can also attach auxiliary proximity sensors to the first one to calculate interpolated positions as mentionned above. Then simply shift around the main proximity sensor in the X/Y plane, and adjust the Z-coordinate of the pad as desired.

You will have to handle following problems:
  • A force sensor can be quite noisy, specially with just one measurement. The good thing is that by default in V-REP, the physics engine does 10 calculations for 1 simulation pass, meaning that your force sensor will deliver a value calculated from 10 measurements
  • The first point above is also your problem here: if you move your pads in each simulation pass (while the dynamics is doing 10 passes), results will not be as good. So you can adjust the settings so that for one simulation pass there will be 1 dynamics calculation pass. You can do this by setting the simulation time step to 5ms here, and keeping the dynamics time step at 5ms here. If you do this however your force sensors will be more noisy again (see the first point above).
Cheers

briany
Posts: 6
Joined: 26 Apr 2013, 14:11

Re: Deformable surface contact

Post by briany » 04 May 2013, 16:10

Hi, I'm making okay progress with this but have a bit of a problem with the force sensors - I think I might be doing something wrong!

I have set up the proximity sensors with vertical rays, and have a script attached to the proximity sensors work out the distance to the surface (this varies as it is a heightfield). Attached to the proximity sensor is a "sandwich" forming a pad comprising three elements in a stack - a thin, disc like cylinder, a force sensor and another disc like cylinder (as I had understood that a force sensor worked like a rigid joint between two respondable shapes). Each disc component fo the stack is static and respondable. The x,y position of the proximity sensors is found from the foot position so now the pads follow the feet and slide across the surface of the heightfield very nicely.
My problem is that although everything seems to work, all of my x,y,z outputs from the force sensor are Null (graphed and dumped to a csv file). Actually I expect x and y to be zero (not Null) because at the moment the pads are following the feet in the x,y plane full time, even when the feet are in contact with the pads, so there should be no force in the x,y plane - however I should see the z axis force rise and fall as the pad is stepped on.
I have modified the respondable mask for the heightfield so now it does not interact with either the feet or the pads, so the feet are walking on the pads not the heightfield - and the upper and lower pads have complementary masks so do not interact with each other except via the force sensor. Any ideas what to try?

Regards

Brian

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

Re: Deformable surface contact

Post by coppelia » 04 May 2013, 18:53

Hi Brian,

Never forget to inspect the dynamic content of your scene to find errors. Also check if your dynamically enabled objects have a little icon on their right during simulation. I guess your force/torque sensor is not simulated, the reason is that it doesn't make sense to have a force/torque sensor between 2 static shapes. You will have to make the child of the force sensor non-static.

The rest of what you describe looks ok.

Cheers

briany
Posts: 6
Joined: 26 Apr 2013, 14:11

Re: Deformable surface contact

Post by briany » 05 May 2013, 19:53

Thanks - I see now that you can't connect two static shapes with a dynamically enabled force sensor, (as the manual would have told me.....)
Actually, I did it this way because in the prior version of my scene, where the lower pad was dynamically enabled but non-static, when the simulation ran the lower pad didn't move with the upper pad but fell off immediately. Prior to running the simulation, if you drag the upper pad around with the mouse then the whole assembly stays together.The numbers reported by the force sensor look reasonable (it detects the stepping motion of the leg) but its a bit disconcerting to have parts of the assembly fall off......

My tree structure for the sub-assembly is as follows: scene-> proximity sensor -> upper pad (static, respondable, position controlled programmatically) -> force sensor -> lower pad (non-static, respondable).

Might this be connected with the physics engine (it does it with both ODE and Bullet though)? The pads are quite small mass but the same size so you don't have the issue of connecting a large mass to a small mass through the force sensor.

Brian

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

Re: Deformable surface contact

Post by coppelia » 05 May 2013, 20:11

Brian,

not sure what you mean with parts of the assembly fall off. Is it the extremity pad?

When you say upper pad is static, and lower pad is non-static, then this doesn't sound correct: the foot will contact the upper pad, so that one should be non-static, and the lower one should be static. So:

proxSensor --> lower pad (static) --> force sensor --> upper pad (non-static)

Does everything look ok in the dynamic content view? If you can, send me the scene so that I can have a quick look at it

Cheers

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

Re: Deformable surface contact

Post by coppelia » 06 May 2013, 09:52

Thanks for the file.

I had a look at it and it seems that your upper pad is colliding with the ground/heightfield. Make sure that their global respondable masks are different.
Then you helped discover a bug! The bug was introduced in version 3.0.3 or 3.0.2 I guess. Here is a corrected version (actually an early beta of version 3.0.4), unfortunately only windows.

Cheers

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

Re: Deformable surface contact

Post by coppelia » 06 May 2013, 11:11

...and thinking about it:

Moving the static pad around will induce high forces on the force/torque sensor, since the position of the static pad is instantaneously changed --> in theory there would be infinite forces acting on the non-static pad.

I would have a non-static pad attached via a vertical prismatic spring/damper to the static pad, and the force sensor attached to the leg tip (i.e. Leg --> force sensor --> leg tip)

The spring/damper and non-static pad is not needed if the pad only moves down/away from the leg tip after contact, which should be the case in a sandy environment!

Cheers

Post Reply