blueprints.sites module#
- class blueprints.sites.BaseSite[source]#
Bases:
SiteType,MoveableThing,ColoredThing,NodeThingSites are used to make a models sensitive. If a
blueprints.sensors.BaseSensoris 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 inBaseSite.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 propertiesx,yandz.alpha (
int | float, optional) – (Improper) euler angle of rotation around the x-axis in radian. Changing this value also changes theeulerproperty.beta (
int | float, optional) – (Improper) euler angle of rotation around the y-axis in radian. Changing this value also changes theeulerproperty.gamma (
int | float, optional) – (Improper) euler angle of rotation around the z-axis in radian. Changing this value also changes theeulerproperty.color (
blue.ColorType) – The color of the Site. For a detailed description see :class:`Color `sensors (
blue.SensorType | list[blue.SensorType] | None, optional) – Thesensorsargument mus either be a list ofsensors.BaseSensoror a singlesensors.BaseSensor.actuators (
blue.ActuatorType | list[blue.ActuatorType] | None, optional) – Theactuatorsargument mus either be a list ofactuators.BaseActuatoror a singleactuators.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 anglesalpha,betaandgamma.**kwargs – Description
material (MaterialType | None)
- property ref_actuators: ViewType#
Ref Actuators contain
blueprints.actuators.BaseActuatorthat are attach to anotherSiteto 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:
- property type: str#
This is a derived attribute, which is used to specify the
typeattribute in the mujocositetag.- Returns:
The type is the lower case name of the Site class.
- Return type:
str
- class blueprints.sites.Capsule[source]#
Bases:
CapsuleSiteType,BaseSite,BaseTubeCapsules 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 seeblueprints.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,headis the first argument given.- Type:
np.ndarra
- tail#
The second end of this Geoms. If it was defined by the
blueprints.tube.BaseTube()constructor,tailis 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 propertiesx,yandz.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 theeulerproperty.beta (
int | float | None, optional) – (Improper) euler angle of rotation around the y-axis in radian. Changing this value also changes theeulerproperty.gamma (
int | float | None, optional) – (Improper) euler angle of rotation around the z-axis in radian. Changing this value also changes theeulerproperty.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 anglesalpha,betaandgamma.**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,BaseTubeCylinders 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 seeblueprints.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,headis the first argument given.- Type:
np.ndarra
- tail#
The second end of this Geoms. If it was defined by the
blueprints.tube.BaseTube()constructor,tailis 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 propertiesx,yandz.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 theeulerproperty.beta (
int | float | None, optional) – (Improper) euler angle of rotation around the y-axis in radian. Changing this value also changes theeulerproperty.gamma (
int | float | None, optional) – (Improper) euler angle of rotation around the z-axis in radian. Changing this value also changes theeulerproperty.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 anglesalpha,betaandgamma.**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,BaseSiteBoxes 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 seeblueprints.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,headis the first argument given.- Type:
np.ndarra
- tail#
The second end of this Geoms. If it was defined by the
blueprints.tube.BaseTube()constructor,tailis 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 propertiesx,yandz.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 theeulerproperty.beta (
int | float | None, optional) – (Improper) euler angle of rotation around the y-axis in radian. Changing this value also changes theeulerproperty.gamma (
int | float | None, optional) – (Improper) euler angle of rotation around the z-axis in radian. Changing this value also changes theeulerproperty.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 anglesalpha,betaandgamma.**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,BaseSiteSpheres 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 propertiesx,yandz.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 theeulerproperty.beta (
int | float | None, optional) – (Improper) euler angle of rotation around the y-axis in radian. Changing this value also changes theeulerproperty.gamma (
int | float | None, optional) – (Improper) euler angle of rotation around the z-axis in radian. Changing this value also changes theeulerproperty.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 anglesalpha,betaandgamma.**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,BaseSiteEllipsoids are defined with via
x_radius,y_radiusandz_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 propertiesx,yandz.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 theeulerproperty.beta (
int | float | None, optional) – (Improper) euler angle of rotation around the y-axis in radian. Changing this value also changes theeulerproperty.gamma (
int | float | None, optional) – (Improper) euler angle of rotation around the z-axis in radian. Changing this value also changes theeulerproperty.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 anglesalpha,betaandgamma.**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.