1#include "state_representation_bindings.hpp" 
    3#include <state_representation/State.hpp> 
    6void state_type(py::module_& m) {
 
    7  py::enum_<StateType>(m, 
"StateType")
 
    8      .value(
"NONE", StateType::NONE)
 
    9      .value(
"STATE", StateType::STATE)
 
   10      .value(
"SPATIAL_STATE", StateType::SPATIAL_STATE)
 
   11      .value(
"CARTESIAN_STATE", StateType::CARTESIAN_STATE)
 
   12      .value(
"CARTESIAN_POSE", StateType::CARTESIAN_POSE)
 
   13      .value(
"CARTESIAN_TWIST", StateType::CARTESIAN_TWIST)
 
   14      .value(
"CARTESIAN_ACCELERATION", StateType::CARTESIAN_ACCELERATION)
 
   15      .value(
"CARTESIAN_WRENCH", StateType::CARTESIAN_WRENCH)
 
   16      .value(
"JOINT_STATE", StateType::JOINT_STATE)
 
   17      .value(
"JOINT_POSITIONS", StateType::JOINT_POSITIONS)
 
   18      .value(
"JOINT_VELOCITIES", StateType::JOINT_VELOCITIES)
 
   19      .value(
"JOINT_ACCELERATIONS", StateType::JOINT_ACCELERATIONS)
 
   20      .value(
"JOINT_TORQUES", StateType::JOINT_TORQUES)
 
   21      .value(
"JACOBIAN", StateType::JACOBIAN)
 
   22      .value(
"PARAMETER", StateType::PARAMETER)
 
   23      .value(
"GEOMETRY_SHAPE", StateType::GEOMETRY_SHAPE)
 
   24      .value(
"GEOMETRY_ELLIPSOID", StateType::GEOMETRY_ELLIPSOID)
 
   25      .value(
"TRAJECTORY", StateType::TRAJECTORY)
 
   26      .value(
"DIGITAL_IO_STATE", StateType::DIGITAL_IO_STATE)
 
   27      .value(
"ANALOG_IO_STATE", StateType::ANALOG_IO_STATE)
 
   31void state(py::module_& m) {
 
   32  py::class_<State, std::shared_ptr<State>> c(m, 
"State");
 
   33  c.def_property_readonly_static(
"__array_priority__", [](py::object) { 
return 10000; });
 
   35  c.def(py::init(), 
"Empty constructor");
 
   36  c.def(py::init<const std::string&>(), 
"Constructor with name specification", 
"name"_a);
 
   37  c.def(py::init<const State&>(), 
"Copy constructor from another State", 
"state"_a);
 
   41  c.def(
"get_age", &
State::get_age, 
"Get the age of the state, i.e. the time since last modification");
 
   47  c.def(
"is_deprecated", &State::is_deprecated<std::micro>, 
"Check if the state is deprecated given a certain time delay with microsecond precision");
 
   49  c.def(
"is_incompatible", &
State::is_incompatible, 
"Check if the state is compatible for operations with the state given as argument", 
"state"_a);
 
   50  c.def(
"reset", &
State::reset, 
"Reset the state to be empty with no data");
 
   52  c.def(
"__copy__", [](
const State &state) {
 
   55  c.def(
"__deepcopy__", [](
const State &state, py::dict) {
 
   58  c.def(
"__repr__", [](
const State& state) {
 
   59    std::stringstream buffer;
 
   63  c.def(
"__bool__", [](
const State& state) {
 
   65  }, py::is_operator());
 
   68void bind_state(py::module_& m) {
 
Abstract class to represent a state.
 
void reset_timestamp()
Reset the timestamp attribute to now.
 
const std::string & get_name() const
Getter of the name attribute.
 
virtual void set_name(const std::string &name)
Setter of the name attribute.
 
const StateType & get_type() const
Getter of the type attribute.
 
const std::chrono::time_point< std::chrono::steady_clock > & get_timestamp() const
Getter of the timestamp attribute.
 
virtual void reset()
Reset the object to a post-construction state.
 
virtual bool is_incompatible(const State &state) const
Check if the state is incompatible for operations with the state given as argument.
 
double get_age() const
Get the age of the state, i.e. the time since the last modification.
 
bool is_empty() const
Getter of the empty attribute.