blueprints.sites module#

class blueprints.sites.BaseSite[source]#

Bases: SiteType, MoveableThing, ColoredThing, NodeThing

Sites are used to make a models sensitive. If a blueprints.sensors.BaseSensor is attached to the Site, it becomes sensitive to collisions of the Site with other physical Things. To do this Sites are not physical Things themselves in the sense, that they do not posses mass. For different Site shapes individual Site classes are available, with shape depended size attributes. All other attributes are specified in BaseSite.

Note

Though units are not bound to one specific system of measurements, it is highly recommended to use MKS, since all defaults are defined based on meters, kilograms and seconds and most mujoco models online also use the metric system. If you want to switch from the imperial to the metric system the following resource might be of interest to convert units from imperial to metric. If you insist on using imperial units, take a look at the following resource to convert units from metric to imperial.

__init__(pos=[0.0, 0.0, 0.0], alpha=0, beta=0, gamma=0, material=None, color=None, sensors=None, actuators=None, name=None, copy=True, x=None, y=None, z=None, quat=None, **kwargs)[source]#
Parameters:
  • pos (np.ndarray | list[int | float], optional) – Represents the position of the object. Changing this attribute also changes the properties x, y and z.

  • alpha (int | float, optional) – (Improper) euler angle of rotation around the x-axis in radian. Changing this value also changes the euler property.

  • beta (int | float, optional) – (Improper) euler angle of rotation around the y-axis in radian. Changing this value also changes the euler property.

  • gamma (int | float, optional) – (Improper) euler angle of rotation around the z-axis in radian. Changing this value also changes the euler property.

  • color (blue.ColorType) – The color of the Site. For a detailed description see :class:`Color `

  • sensors (blue.SensorType | list[blue.SensorType] | None, optional) – The sensors argument mus either be a list of sensors.BaseSensor or a single sensors.BaseSensor.

  • actuators (blue.ActuatorType | list[blue.ActuatorType] | None, optional) – The actuators argument mus either be a list of actuators.BaseActuator or a single actuators.BaseActuator.

  • name (str | None, optional) – The user specified name of the Site. In the case of a naming conflict the name is appended by an enumeration scheme.

  • copy (bool, optional) – This argument indicates whether the children should be copied before they are attached. If copy if set to False this will result in graph cycles if a parent of the Body is attached resulting in further errors.

  • x (int | float |np.int32 | np.int64 | np.float32 | np.float64 | None, optional) – If pos is not specified, this argument sets the X position coordinate.

  • y (int | float |np.int32 | np.int64 | np.float32 | np.float64 | None, optional) – If pos is not specified, this argument sets the Y position coordinate.

  • z (int | float |np.int32 | np.int64 | np.float32 | np.float64 | None, optional) – If pos is not specified, this argument sets the Z position coordinate.

  • quat (list [ int | float ] | np.ndarray | None, optional) – If set, the quaternion orientation overwrites the euler angles alpha, beta and gamma.

  • **kwargs – Description

  • material (MaterialType | None)

property ref_actuators: ViewType#

Ref Actuators contain blueprints.actuators.BaseActuator that are attach to another Site to which they apply force, using this Sites reference frame.

Returns:

A View of the Actuators that use the reference frame of this Site to apply force to another Site.

Return type:

blueprints.utils.view.View

property type: str#

This is a derived attribute, which is used to specify the type attribute in the mujoco site tag.

Returns:

The type is the lower case name of the Site class.

Return type:

str

property material#

Materials can be used to specify reflective properties of a Site, as well as to apply Textures to them.

Returns:

The Material of the Site

Return type:

blue.MaterialType

class blueprints.sites.Capsule[source]#

Bases: CapsuleSiteType, BaseSite, BaseTube

Capsules consist of a cylinder with two half spheres at its ends. It can either be constructed from its standard constructor for position, orientation, radius and length, or with the blueprints.tube.BaseTube() constructor. For a detailed description see blueprints.tube.BaseTube.

Standard constructor:#
>>> site = blue.sites.Capsule(alpha=TAU/8, length=3)
>>> site.head
array([ 0.          1.06066017 -1.06066017], dtype=np.float32)
>>> site.tail
array([ 0.         -1.06066017  1.06066017], dtype=np.float32)
From points constructor:#
>>> site = blue.sites.Capsule.from_points([0, -1, 4], [2, 1, 0], radius=0.5)
>>> site.pos
array([1. 0. 2.], dtype=np.float32)
>>> site.alpha, site.beta, site.gamma
-2.6779450445889874 0.420534335283965 0.6847192030022825
>>> site.length
4.898979485566356
head#

The first end of this Geoms. If it was defined by the blueprints.tube.BaseTube() constructor, head is the first argument given.

Type:

np.ndarra

tail#

The second end of this Geoms. If it was defined by the blueprints.tube.BaseTube() constructor, tail is the second argument given.

Type:

np.ndarra

__init__(pos=[0.0, 0.0, 0.0], radius=1, length=1, alpha=0.0, beta=0.0, gamma=0.0, material=None, color=None, name=None, x=None, y=None, z=None, quat=None, **kwargs)[source]#
Parameters:
  • pos (list[int | float] | np.ndarray | None, optional) – Represents the position of the object. Changing this attribute also changes the properties x, y and z.

  • radius (int | float, optional) – Represents the radius of the cylinder and the two half spheres.

  • length (int | float, optional) – The length of the cylinder.

  • alpha (int | float | None, optional) – (Improper) euler angle of rotation around the x-axis in radian. Changing this value also changes the euler property.

  • beta (int | float | None, optional) – (Improper) euler angle of rotation around the y-axis in radian. Changing this value also changes the euler property.

  • gamma (int | float | None, optional) – (Improper) euler angle of rotation around the z-axis in radian. Changing this value also changes the euler property.

  • color (blue.ColorType) – The color of the Site. For a detailed description see :class:`Color `

  • name (str | None, optional) – The user specified name might potentially be altered to avoid a naming conflict by appending an enumeration scheme.

  • x (int | float |np.int32 | np.int64 | np.float32 | np.float64 | None, optional) – If pos is not specified, this argument sets the X position coordinate.

  • y (int | float |np.int32 | np.int64 | np.float32 | np.float64 | None, optional) – If pos is not specified, this argument sets the Y position coordinate.

  • z (int | float |np.int32 | np.int64 | np.float32 | np.float64 | None, optional) – If pos is not specified, this argument sets the Z position coordinate.

  • quat (list [ int | float ] | np.ndarray | None, optional) – If set, the quaternion orientation overwrites the euler angles alpha, beta and gamma.

  • **kwargs – Keyword arguments are passed to super().__init__.

  • material (MaterialType | None)

property size: ndarray#

Note

In mujoco half lengths are used instead of true lengths of objects. This makes distance calculations easier, but we find that it is overall more confusing then beneficial which is why blueprints uses proper lengths. Conversion is handled in the background, such that users only need to specify true lengths.

Returns:

The size defines the radius and half length of the capsule.

Return type:

np.ndarray

class blueprints.sites.Cylinder[source]#

Bases: CylinderSiteType, BaseSite, BaseTube

Cylinders can either be constructed from their standard constructor for position, orientation, radius and length, or with the blueprints.tube.BaseTube() constructor. For a detailed description see blueprints.tube.BaseTube.

Standard constructor:#
>>> site = blue.sites.Cylinder(alpha=TAU/8, length=3)
>>> site.head
array([ 0.          1.06066017 -1.06066017], dtype=np.float32)
>>> site.tail
array([ 0.         -1.06066017  1.06066017], dtype=np.float32)
From points constructor:#
>>> site = blue.sites.Cylinder.from_points([0, -1, 4], [2, 1, 0], radius=0.5)
>>> site.pos
array([1. 0. 2.], dtype=np.float32)
>>> site.alpha, site.beta, site.gamma
-2.6779450445889874 0.420534335283965 0.6847192030022825
>>> site.length
4.898979485566356
head#

The first end of this Geoms. If it was defined by the blueprints.tube.BaseTube() constructor, head is the first argument given.

Type:

np.ndarra

tail#

The second end of this Geoms. If it was defined by the blueprints.tube.BaseTube() constructor, tail is the second argument given.

Type:

np.ndarra

__init__(pos=[0.0, 0.0, 0.0], radius=1, length=1, alpha=0.0, beta=0.0, gamma=0.0, material=None, color=None, name=None, x=None, y=None, z=None, quat=None, **kwargs)[source]#
Parameters:
  • pos (list[int | float] | np.ndarray | None, optional) – Represents the position of the object. Changing this attribute also changes the properties x, y and z.

  • radius (int | float, optional) – Represents the radius of the cylinder and the two half spheres.

  • length (int | float, optional) – The length of the cylinder.

  • alpha (int | float | None, optional) – (Improper) euler angle of rotation around the x-axis in radian. Changing this value also changes the euler property.

  • beta (int | float | None, optional) – (Improper) euler angle of rotation around the y-axis in radian. Changing this value also changes the euler property.

  • gamma (int | float | None, optional) – (Improper) euler angle of rotation around the z-axis in radian. Changing this value also changes the euler property.

  • color (blue.ColorType) – The color of the Site. For a detailed description see :class:`Color `

  • name (str | None, optional) – The user specified name might potentially be altered to avoid a naming conflict by appending an enumeration scheme.

  • x (int | float |np.int32 | np.int64 | np.float32 | np.float64 | None, optional) – If pos is not specified, this argument sets the X position coordinate.

  • y (int | float |np.int32 | np.int64 | np.float32 | np.float64 | None, optional) – If pos is not specified, this argument sets the Y position coordinate.

  • z (int | float |np.int32 | np.int64 | np.float32 | np.float64 | None, optional) – If pos is not specified, this argument sets the Z position coordinate.

  • quat (list [ int | float ] | np.ndarray | None, optional) – If set, the quaternion orientation overwrites the euler angles alpha, beta and gamma.

  • **kwargs – Keyword arguments are passed to super().__init__.

  • material (MaterialType | None)

property size: ndarray#

Note

In mujoco half lengths are used instead of true lengths of objects. This makes distance calculations easier, but we find that it is overall more confusing then beneficial which is why blueprints uses proper lengths. Conversion is handled in the background, such that users only need to specify true lengths.

Returns:

The size defines the radius and half length of the cylinder.

Return type:

np.ndarray

class blueprints.sites.Box[source]#

Bases: BoxSiteType, BaseSite

Boxes can either be constructed from their standard constructor for position, orientation, and x-, y-, z-length, or with the blueprints.tube.BaseTube() constructor. For a detailed description see blueprints.tube.BaseTube.

Standard constructor:#
>>> site = blue.sites.Box(x_length=2, y_length=4, z_length=1)
>>> site.head
array([ 0.   0.  -0.5], dtype=np.float32)
>>> site.tail
array([ 0.   0.   0.5], dtype=np.float32)
From points constructor:#
>>> site = blue.sites.Box.from_points([4, 0,-2], [2, 4, 0], radius=0.5)
>>> site.pos
array([ 3.   2.  -1.], dtype=np.float32)
>>> site.alpha, site.beta, site.gamma
-1.1071487177940904 -0.4205343352839653 0.20135792079032988
>>> site.x_length, site.y_length, site.z_length
0.5 0.5 4.898979485566356
head#

The first end of this Geoms. If it was defined by the blueprints.tube.BaseTube() constructor, head is the first argument given.

Type:

np.ndarra

tail#

The second end of this Geoms. If it was defined by the blueprints.tube.BaseTube() constructor, tail is the second argument given.

Type:

np.ndarra

__init__(pos=[0.0, 0.0, 0.0], size=None, x_length=1, y_length=1, z_length=1, alpha=0.0, beta=0.0, gamma=0.0, material=None, color=None, name=None, x=None, y=None, z=None, quat=None, **kwargs)[source]#
Parameters:
  • pos (list[int | float] | np.ndarray | None, optional) – Represents the position of the object. Changing this attribute also changes the properties x, y and z.

  • x_length (int | float, optional) – The true length of the Box along the x-axis.

  • y_length (int | float, optional) – The true length of the Box along the y-axis.

  • z_length (int | float, optional) – The true length of the Box along the z-axis.

  • alpha (int | float | None, optional) – (Improper) euler angle of rotation around the x-axis in radian. Changing this value also changes the euler property.

  • beta (int | float | None, optional) – (Improper) euler angle of rotation around the y-axis in radian. Changing this value also changes the euler property.

  • gamma (int | float | None, optional) – (Improper) euler angle of rotation around the z-axis in radian. Changing this value also changes the euler property.

  • color (blue.ColorType) – The color of the Site. For a detailed description see :class:`Color `

  • name (str | None, optional) – The user specified name might potentially be altered to avoid a naming conflict by appending an enumeration scheme.

  • x (int | float |np.int32 | np.int64 | np.float32 | np.float64 | None, optional) – If pos is not specified, this argument sets the X position coordinate.

  • y (int | float |np.int32 | np.int64 | np.float32 | np.float64 | None, optional) – If pos is not specified, this argument sets the Y position coordinate.

  • z (int | float |np.int32 | np.int64 | np.float32 | np.float64 | None, optional) – If pos is not specified, this argument sets the Z position coordinate.

  • quat (list [ int | float ] | np.ndarray | None, optional) – If set, the quaternion orientation overwrites the euler angles alpha, beta and gamma.

  • **kwargs – Keyword arguments are passed to super().__init__.

  • size (ndarray | list[int | float] | int | float | None)

  • material (MaterialType | None)

property size: ndarray#

Note

In mujoco half lengths are used instead of true lengths of objects. This makes distance calculations easier, but we find that it is overall more confusing then beneficial which is why blueprints uses proper lengths. Conversion is handled in the background, such that users only need to specify true lengths.

Returns:

The size defines the half lengths of the Box.

Return type:

np.ndarray

class blueprints.sites.Sphere[source]#

Bases: SphereSiteType, BaseSite

Spheres are defined via radius and position.

radius#

The radius of the sphere

Type:

float

__init__(pos=[0.0, 0.0, 0.0], radius=1, alpha=0.0, beta=0.0, gamma=0.0, material=None, color=None, name=None, x=None, y=None, z=None, quat=None, **kwargs)[source]#
Parameters:
  • pos (list[int | float] | np.ndarray | None, optional) – Represents the position of the object. Changing this attribute also changes the properties x, y and z.

  • radius (int | float, optional) – The radius of the Sphere.

  • alpha (int | float | None, optional) – (Improper) euler angle of rotation around the x-axis in radian. Changing this value also changes the euler property.

  • beta (int | float | None, optional) – (Improper) euler angle of rotation around the y-axis in radian. Changing this value also changes the euler property.

  • gamma (int | float | None, optional) – (Improper) euler angle of rotation around the z-axis in radian. Changing this value also changes the euler property.

  • color (blue.ColorType) – The color of the Site. For a detailed description see :class:`Color `

  • name (str | None, optional) – The user specified name might potentially be altered to avoid a naming conflict by appending an enumeration scheme.

  • x (int | float |np.int32 | np.int64 | np.float32 | np.float64 | None, optional) – If pos is not specified, this argument sets the X position coordinate.

  • y (int | float |np.int32 | np.int64 | np.float32 | np.float64 | None, optional) – If pos is not specified, this argument sets the Y position coordinate.

  • z (int | float |np.int32 | np.int64 | np.float32 | np.float64 | None, optional) – If pos is not specified, this argument sets the Z position coordinate.

  • quat (list [ int | float ] | np.ndarray | None, optional) – If set, the quaternion orientation overwrites the euler angles alpha, beta and gamma.

  • **kwargs – Keyword arguments are passed to super().__init__.

  • material (MaterialType | None)

property size: ndarray#

Note

In mujoco half lengths are used instead of true lengths of objects. This makes distance calculations easier, but we find that it is overall more confusing then beneficial which is why blueprints uses proper lengths. Conversion is handled in the background, such that users only need to specify true lengths.

Returns:

The only component of size is the radius, which is interpreted as meters by default parameters and convention.

Return type:

np.ndarray

class blueprints.sites.Ellipsoid[source]#

Bases: EllipsoidSiteType, BaseSite

Ellipsoids are defined with via x_radius, y_radius and z_radius. The surface of the Ellipsoid contains the solutions to the equation:

\(\left( \frac{x}{r_x} \right)^2 + \left( \frac{y}{r_y} \right)^2 + \left( \frac{z}{r_z} \right)^2 = 1\)

x_radius#

This attribute defines the radius for the X-axis.

Type:

float

y_radius#

This attribute defines the radius for the Y-axis.

Type:

float

z_radius#

This attribute defines the radius for the Z-axis.

Type:

float

__init__(pos=[0.0, 0.0, 0.0], x_radius=1, y_radius=1, z_radius=1, alpha=0.0, beta=0.0, gamma=0.0, material=None, color=None, name=None, x=None, y=None, z=None, quat=None, **kwargs)[source]#
Parameters:
  • pos (list[int | float] | np.ndarray | None, optional) – Represents the position of the object. Changing this attribute also changes the properties x, y and z.

  • x_radius (int | float, optional) – This attribute defines the radius for the X-axis.

  • y_radius (int | float, optional) – This attribute defines the radius for the Y-axis.

  • z_radius (int | float, optional) – This attribute defines the radius for the Z-axis.

  • alpha (int | float | None, optional) – (Improper) euler angle of rotation around the x-axis in radian. Changing this value also changes the euler property.

  • beta (int | float | None, optional) – (Improper) euler angle of rotation around the y-axis in radian. Changing this value also changes the euler property.

  • gamma (int | float | None, optional) – (Improper) euler angle of rotation around the z-axis in radian. Changing this value also changes the euler property.

  • color (blue.ColorType) – The color of the Site. For a detailed description see :class:`Color `

  • name (str | None, optional) – The user specified name might potentially be altered to avoid a naming conflict by appending an enumeration scheme.

  • x (int | float |np.int32 | np.int64 | np.float32 | np.float64 | None, optional) – If pos is not specified, this argument sets the X position coordinate.

  • y (int | float |np.int32 | np.int64 | np.float32 | np.float64 | None, optional) – If pos is not specified, this argument sets the Y position coordinate.

  • z (int | float |np.int32 | np.int64 | np.float32 | np.float64 | None, optional) – If pos is not specified, this argument sets the Z position coordinate.

  • quat (list [ int | float ] | np.ndarray | None, optional) – If set, the quaternion orientation overwrites the euler angles alpha, beta and gamma.

  • **kwargs – Keyword arguments are passed to super().__init__.

  • material (MaterialType | None)

property size: ndarray#

Note

In mujoco half lengths are used instead of true lengths of objects. This makes distance calculations easier, but we find that it is overall more confusing then beneficial which is why blueprints uses proper lengths. Conversion is handled in the background, such that users only need to specify true lengths.

Returns:

The components contain the x_radius, y_radius and z_radius attribute.

Return type:

np.ndarray

class blueprints.sites.Site[source]#

Bases: Sphere

Dummy class for Sphere

property type#

The type is the lower case name of the Sites class, in this case 'sphere'.

Return type:

str