Kinematics#
Configure the kinematics sub-class by overriding dof
(C++
, Python
) and is_wheeled
(C++
, Python
) (for which the base class returns false
). You must also override feasible
(C++
, Python
) with the specific logic to map an arbitrary twist to a feasible twist. To add constrains on dynamics/acceleration, you can overrie feasible_from_current
(C++
, Python
): the base class implementation ignores the current twist and the time step and calls feasible
.
You should override
if the feasible maximal speed and angular speed are different than the base class max_speed
, and max_angular_speed
.
Virtual methods#
C++ method |
Python method |
override |
---|---|---|
must |
||
can |
||
must |
||
should |
||
can |
||
can |
Class skelethon#
#include "navground/core/kinematics.h"
namespace core = navground::core;
struct MyKinematics : public core::Kinematics {
// must override
// return the nearest feasible twist to value.
core::Twist2 feasible(const core::Twist2 &value) const override;
// can override
// return the nearest feasible twist to a target value from
// the current value in a time step, taking into account dynamic constraints.
// core::Twist2 feasible_from_current(const core::Twist2 &value, const core::Twist2 ¤t, ng_float time_step) const override;
// set to whether there are wheels or not
static constexpr bool IS_WHEELED = false;
// must override
// return whether we are using wheels
// should be a constant
bool is_wheeled() const override { return IS_WHEELED; }
// set the number of dof
static constexpr unsigned DOF = 2;
// must override
// return the number of degree of freedom
// should be a constant
unsigned dof() const override { return DOF; }
// should override
float get_max_angular_speed() const override;
// should override
float get_max_speed() const override;
};
from navground import core
class MyKinematics(core.PyKinematics):
# set to whether there are wheels or not
IS_WHEELED = False
# set the number of dof
DOF = 2
# MUST override
# return the nearest feasible twist to value
def feasible(self, twist: core.Twist2) -> core.Twist2:
...
# CAN override
# return the nearest feasible twist to a target value from
# the current value in a time step, taking into account dynamic constraints.
# def feasible_from_current(self, twist: core.Twist2) -> core.Twist2: ...
# SHOULD override
# return whether we are using wheels
# should be a constant
def is_wheeled(self) -> bool:
return self.IS_WHEELED
# MUST override
# return the number of degree of freedom
# should be a constant
def dof(self) -> int:
return self.DOF
# CAN override
# return the number of degree of freedom
# should be a constant
# def get_max_angular_speed(self) -> float: ...
# CAN override
# return the number of degree of freedom
# should be a constant
# def get_max_speed(self) -> float: ...