Skip to main content

Adding Objectives

note

Since Lively is still in beta, the design is subject to change and should not be considered final!

Lively can be greatly extended through the development of additional objectives. In order to add your own new objectives, there are three files you will have to modify. In the example below, an additional CenterOfMassMatchObjective is created. Because the robot state already includes a vector representing the center-of-mass of the robot, it is straightforward to create a new objectives of CenterOfMassMatch, which could be useful in cases where the robot’s balance must be maintained, or as a way to center the robot near its base. The changes are made in src/lib.rs, src/objectives/objective.rs, and src/objectives/core/matching.rs.

note
    ...
m.add_class::<objectives::core::bounding::PositionBoundingObjective>()?;
m.add_class::<objectives::core::bounding::OrientationBoundingObjective>()?;
m.add_class::<objectives::core::bounding::JointBoundingObjective>()?;
// An example of additional objectives (CenterOfMassMatchingObjective)
m.add_class::<objectives::core::matching::CenterOfMassMatchObjective>()?;
// ------------------------------------------------------------------
m.add_class::<objectives::core::matching::PositionMatchObjective>()?;
m.add_class::<objectives::core::matching::OrientationMatchObjective>()?;
m.add_class::<objectives::core::matching::JointMatchObjective>()?;
m.add_class::<objectives::core::matching::DistanceMatchObjective>()?;
...