Skip to content

Commit

Permalink
feat: add python bindings for utility functions
Browse files Browse the repository at this point in the history
  • Loading branch information
bpapaspyros committed Oct 17, 2024
1 parent 9856a27 commit cde9cda
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions python/source/state_representation/bind_joint_space.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ void joint_state_variable(py::module_& m) {
.value("TORQUES", JointStateVariable::TORQUES)
.value("ALL", JointStateVariable::ALL)
.export_values();

m.def("string_to_joint_state_variable", &state_representation::string_to_joint_state_variable, "Convert a string to a JointStateVariable enum (case insensitive)", "variable"_a);
m.def("joint_state_variable_to_string", &state_representation::joint_state_variable_to_string, "Convert JointStateVariable to a string", "variable"_a);
}

void joint_state(py::module_& m) {
Expand Down Expand Up @@ -105,6 +108,12 @@ void joint_state(py::module_& m) {
buffer << state;
return buffer.str();
});

c.def("multiply_state_variable", py::overload_cast<const Eigen::MatrixXd&, const JointStateVariable&>(&JointState::multiply_state_variable), "Setter of the variable value corresponding to the input", "matrix"_a, "state_variable_type"_a);
c.def("get_state_variable", &JointState::get_state_variable, "Getter of the variable value corresponding to the input", "state_variable_type"_a);
c.def("set_state_variable", py::overload_cast<const Eigen::VectorXd&, const JointStateVariable&>(&JointState::set_state_variable), "Setter of the variable value corresponding to the input", "new_value"_a, "state_variable_type"_a);
c.def("set_state_variable", py::overload_cast<const std::vector<double>&, const JointStateVariable&>(&JointState::set_state_variable), "Setter of the variable value corresponding to the input", "new_value"_a, "state_variable_type"_a);
c.def("set_state_variable", py::overload_cast<double, unsigned int, const JointStateVariable&>(&JointState::set_state_variable), "Setter of the variable value corresponding to the input", "new_value"_a, "joint_index"_a, "state_variable_type"_a);
}

void joint_positions(py::module_& m) {
Expand Down

0 comments on commit cde9cda

Please sign in to comment.