Goals
There are a variety of different "goal" types that can be provided. Think of these as settings that you would like to achieve (e.g. a PositionMatch objective accepts a Translation goal).
Translation
A 3-vector representing coordinates that is used by the PositionMatch, PositionMirroring objectives.
- Javascript
- Python
- Rust
let goal = {Translation:[1.0,0.0,0.5]}
goal = Translation(x:1.0,y:0.0,z:0.5);
let goal = Translation3::new(0.0,0.0,0.0);
Rotation
A Quaternion representing rotation that is used by the OrientationMatch, OrientationMirroring objectives.
- Javascript
- Python
- Rust
let goal = {Rotation:[0.707,0.0,0.0,0.707]} // [x, y, z, w] ordering
goal = Rotation(w:0.707,x:0.0,y:0.0,z:0.707)
let goal = UnitQuaternion::from_quaternion(Quaternion::new(0.0,0.0,-0.7069999677447771,0.7072135784958345));
Scalar
A float value that is used by the JointMatch, JointMirroring, DistanceMatch, JointLiveliness, and RelativeMotionLiveliness objectives.
- Javascript
- Python
- Rust
let goal = {Scalar:0.5}
goal = 0.5
let goal = 0.5;
Size
A 3-vector representing scale of a 3D shape that is used by the PositionLiveliness, OrientationLiveliness, OriginPositionLiveliness objectives.
- Javascript
- Python
- Rust
let goal = {Size:[1.0,0.1,0.5]}
goal = Size(x:1.0,y:0.1,z:0.5)
let goal = Vector3::new(1.0,0.1,0.5);
Ellipse
A structure designating a rotated ellipsoid, with Translation, Rotation, and Size components. The ellipse goal is used by the PositionBounding objective.
- Javascript
- Python
- Rust
let goal = {Ellipse: {
pose: {translation: [1.0,0.0,0.4], rotation: [0.707,0.0,0.0,0.707]}, // [x, y, z, w] ordering for quaternion
size: [0.1,0.1,0.2]}}
goal = Ellipse(
translation=Translation(x:1.0,y:0.0,z:0.4),
rotation=Rotation(w:0.707,x:0.0,y:0.0,z:0.707),
size=Size(x:0.1,y:0.1,z:0.2)
)
let pose = Isometry3::from_parts(
Translation3::new(
0.0,
0.0,
0.0,
),
UnitQuaternion::from_quaternion(Quaternion::new(
0.0,
0.0,
-0.7069999677447771,
0.7072135784958345,
)),
);
let goal = Ellipse::new(pose, Vector3::new(0.1,0.1,0.2));
RotationRange
A structure including a center Rotation, as well as a float value indicating allowed delta in radians from that rotation. The RotationRange goal is used by the RotationBounding objective.
- Javascript
- Python
- Rust
let goal = {RotationRange: {rotation: [0.707,0.0,0.0,0.707], // [x, y, z, w] ordering for quaternion
delta:0.4}}
goal = RotationRange(rotation=Rotation(w:0.707,x:0.0,y:0.0,z:0.707),delta=0.4)
let rotation = (
UnitQuaternion::from_quaternion(Quaternion::new(
0.0,
0.0,
-0.7069999677447771,
0.7072135784958345,
)),
);
let goal = RotationRange::new(rotation,0.4);
ScalarRange
A structure including a center float value, and float value representing allowed delta from that value. The ScalarRange goal is used by the JointBounding objective.
- Javascript
- Python
- Rust
let goal = {ScalarRange: {value:0.0,delta:0.4}}
goal = ScalarRange(value=0.0,delta=0.4)
let goal = ScalarRange::new(0.0,0.4);
Import
There is no need to import for Javascript.
- Python
- Rust
from lively import Translation #Rotation, Scalar, Size, Ellipse, RotationRange, ScalarRange
use lively::utils::goals::Goal;