3.37 Physics
Physics { |
3.37.1 Description
The Physics node allows to specify parameters for the physics simulation engine. Physics nodes are used in most Webots worlds with the exception of some purely kinematics-based simulations. The Physics node specifies the mass, the center of gravity and the mass distribution, thus allowing the physics engine to create a body and compute realistic forces.
A Physics node can be placed in a Solid node (or any node derived from Solid). The presence or absence of a Physics node in the physics field of a Solid defines whether the Solid will have a physics or a kinematic behavior.
|
|
3.37.2 Field Summary
-
The density field can be used to define the density of the containing Solid. The value of the density field should be a positive number number or -1. A -1 value indicates that the dentity is not known, in this case the mass field (see below) must be specified. If the density is specified (different from -1) then the total mass of the Solid is calculated by multiplying the specified density with the total volume of the geometrical primitives composing the boundingObject. Note that Webots ignores if the geometrical primitives intersect or not, the volume of each primitive is simply added to the total volume and finally multiplied by the density.
-
The mass field can be used to specify the total mass of the containing Solid. The value of the mass field should be a positive number or -1. A -1 value indicates that the total mass is not known, in this case the density field (see above) must be specified. If the mass is known, e.g., indicated in the specifications of the robot, then it is more accurate to specify the mass rather than the density.
-
The centerOfMass field defines the position of the center of mass of the solid. It is expressed in meters in the relative coordinate system of the Solid node. If centerOfMass field is different from [0 0 0], then the center of mass is depicted as a dark red/green/blue cross in Webots 3D-window.
-
The inertiaMatrix field can be used to manually specify the inertia matrix of the Solid. This field can either be empty (the default) or contain exactly 2 vectors. If this field is empty, Webots will compute the inertia matrix automatically according to the position and orientation of the geometrical primitives in boundingObject.
If this field contains 2 vectors, these values specify the inertia matrix of the Solid. If the inertia matrix is specified then the mass field must also be specified. The first vector [I11, I22, I33] represents the principals moments of inertia and the second vector [I12, I13, I23] represents the products of inertia. Together these values form a 3x3 inertia matrix:
[ I11 I12 I13 ]
[ I12 I22 I23 ]
[ I13 I23 I33 ]The Ixx values are expressed in kg*m2. The principals moments of inertia must be positive. The inertia matrix is defined with respect to the centerOfMass of the Solid. Internally, these 6 values are passed unchanged to the dMassSetParameters() ODE function.
-
The damping field allows to specify a Damping node that defines the velocity damping parameters to be applied to the Solid.
3.37.3 How to use Physics nodes?
If it contains a Physics node, a Solid object will be simulated in physics mode. The physics simulation mode takes into account the simulation of the forces that act on the bodies and the properties of these bodies, e.g., mass and moment of inertia. On the contrary, if its physics field is NULL, then the Solid will be simulated in kinematics mode. The kinematics mode simulates the objects motions without considering the forces that cause the motion. For example in kinematics mode an object can reach the desired speed immediately while in physics mode the inertial resistance will cause this object to accelerate progressively. It is usually not necessary to specify all the Physics nodes in a Webots world. Whether to use or not a Physics node in a particular case depends on what aspect of the real world your want to model in your simulation.
In passive objects
If a passive object should never move during a simulation then you should leave its physics field empty. In this case no contact force will be simulated on this object and hence it will never move. This is perfect for modeling walls or the floor. Furthermore the floor should always be designed without Physics node anyway, because otherwise it would fall under the action of gravity.
On the contrary, if a passive object needs to be pushed, kicked, dropped, etc. then it should have a Physics node. So for example, if you want to design a soccer game where the ball needs to be kicked and roll, then you will need to add a Physics node to the ball. Similarly, in a box pushing or stacking simulation, you will need to specify the Physics nodes for the boxes so that the friction and gravity forces are applied to these objects.
In robots
Articulated robot, humanoids, vehicles and so on, are built as hierarchies of Solid nodes (or subclasses of Solid). The contact and friction forces generated by legs or wheels are usually a central aspect of the simulation of robot locomotion. Similarly, the contact and friction forces of a grasping robotic hand or gripper is crucial for the simulation of such devices. Therefore the mechanical body parts of robots (eg., legs, wheels, arms, hands, etc) need in general to have Physics nodes.
|
|
In servos
When designing the robot tree structure, there is one important rule to remember about the Physics nodes: If a Solid node has a Physics node then its parent must also have a Physics node (1). A consequence of this rule is that, in a robot tree structure, only leaf nodes can have a NULL physics field. In addition top nodes (Robot, DifferentialWheels or Supervisor) do usually have Physics because this is required to allow any of their children to use the physics simulation.
Note that each Physics node adds a significant complexity to the world: as a consequence the simulation speed decreases. Therefore the number of Physics nodes should be kept as low as possible. Fortunately, even with a complex wheeled or articulated robot some of the physics fields can remain empty (NULL). This is better explained with an example. Let's assume that you want to design an articulated robot with two legs. Your robot model may look like this (very simplified):
Robot { |
Now suppose you would like to add a Camera to this robot. Let's also assume that the physical properties of this camera are not relevant for this simulation, say, because the mass of the camera is quite small and because we want to ignore potential collisions of the camera with other objects. In this case, you should leave the physics field of the camera empty. So the model with the camera would look like this:
Robot { |
Robot { |
Devices
Most device nodes work without Physics node. But a Physics node can optionally be used if one wishes to simulate the weight and inertia of the device. So it is usually recommended to leave the physics field of a device empty, unless it represents a significant mass or volume in the simulated robot. This is true for these devices: Accelerometer, Camera, Compass, DistanceSensor, Emitter, GPS, LED, LightSensor, Pen, and Receiver.
|
|