Bases: ars.model.simulator.SimulatedPhysicsObject
Class encapsulating the physics, collision and graphical objects representing a body.
All the public attributes of the physics object (_body) are accessible as if they were from this class, by using a trick with __getattr__. This avoids code duplication and frequent changes to the interface.
For example, the call sim_body.get_linear_velocity() works if method sim_body._body.get_linear_velocity exists.
There are some exceptions such as the getters and setters of position and rotation because the base class SimulatedPhysicsObject defines those abstract methods (some other non-abstract methods use them) and requires its subclasses to implement them. Otherwise we get “TypeError: Can’t instantiate abstract class SimulatedBody with abstract methods”.
Get the position of the body.
Returns: | position |
---|---|
Return type: | 3-sequence of floats |
Get the orientation of the body.
Returns: | rotation matrix |
---|---|
Return type: | 9-sequence of floats |
Bases: ars.model.simulator.SimulatedObject
Get the pose (3D position and rotation) of the object.
Returns: | pose |
---|---|
Return type: | ars.utils.geometry.Transform |
Get the position of the object.
Returns: | position |
---|---|
Return type: | 3-sequence of floats |
Get the orientation of the object.
Returns: | rotation matrix |
---|---|
Return type: | 9-sequence of floats |
Rotate the object by applying a rotation matrix defined by the given axis and angle
Set the pose (3D position and rotation) of the object.
Parameters: | pose (ars.utils.geometry.Transform) – |
---|
Set the orientation of the object.
Parameters: | pos (3-sequence of floats) – position |
---|
Bases: object
Adds a “ball and socket” joint between obj1 and obj2, at the specified anchor. If anchor is None, it will be set equal to the position of obj2.
Create the basic simulation objects needed for physics and collision such as a contact group (holds temporary contact joints generated during collisions), a simulation ‘world’ (where physics objects are processed) and a collision space (the same thing for geoms and their intersections).
Parameters: | gravity (3 floats tuple.) – Gravity acceleration. |
---|
Create a plane geom to simulate a floor. It won’t be used explicitly later (space object has a reference to it)
Add sim_object to the internal dictionary of simulated objects.
If its name equals an already registered key, it will be modified using its string representation, for example:
>>> add_object(sim_object)
sphere/<ars.model.simulator.SimulatedBody object at 0x3a4bed0>
Parameters: | sim_object (SimulatedObject) – object to add |
---|---|
Returns: | name/key of the object |
Return type: | string |
Adds a rotary joint between obj1 and obj2, at the specified anchor and with the given axis. If anchor is None, it will be set equal to the position of obj2
Add a jo.Slider joint between obj1 and obj2.
The only movement allowed is translation along axis.
Returns: | the name under which the slider was stored, which could be different from the given name |
---|
Return a list with all the bodies included in the simulation.
Returns: | list of SimulatedBody objects |
---|
This module contains string values defining different signals related to the ars.model.simulator package.