-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpy_mpc.cpp
More file actions
35 lines (32 loc) · 2.01 KB
/
py_mpc.cpp
File metadata and controls
35 lines (32 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include "mpc/mpc_core.h"
namespace py = pybind11;
PYBIND11_MODULE(py_mpc, m) {
py::enum_<mpc_type>(m, "mpc_type")
.value("MPC_TYPE_CTE", MPC_TYPE_CTE)
.value("MPC_TYPE_ACC", MPC_TYPE_ACC)
.value("MPC_TYPE_NLOPT", MPC_TYPE_NLOPT)
.value("MPC_TYPE_NLOPT_POS", MPC_TYPE_NLOPT_POS)
.export_values();
py::class_<JackalMPCCore>(m, "JackalMPCCore")
.def(py::init<>())
.def(py::init<const mpc_type &>())
.def("load_params", &JackalMPCCore::load_params)
.def("set_odom", (void (JackalMPCCore::*)(const Eigen::Vector3d &)) &JackalMPCCore::set_odom)
.def("set_odom", (void (JackalMPCCore::*)(const std::vector<double> &)) &JackalMPCCore::set_odom)
.def("set_goal", (void (JackalMPCCore::*)(const Eigen::Vector2d &)) &JackalMPCCore::set_goal)
.def("set_goal", (void (JackalMPCCore::*)(const std::vector<double> &)) &JackalMPCCore::set_goal)
.def("set_obstacle", (void (JackalMPCCore::*)(const Eigen::Vector3d &)) &JackalMPCCore::set_obstacle)
.def("set_obstacle", (void (JackalMPCCore::*)(const std::vector<double> &)) &JackalMPCCore::set_obstacle)
.def("set_reference", (void (JackalMPCCore::*)(const Eigen::MatrixXd &)) &JackalMPCCore::set_reference)
.def("set_reference", (void (JackalMPCCore::*)(const std::vector<double> &)) &JackalMPCCore::set_reference)
.def("get_mpc_results", &JackalMPCCore::get_mpc_results)
.def("set_dist_map", (bool (JackalMPCCore::*)(py::dict grid_dict)) &JackalMPCCore::set_dist_map)
.def("set_dist_map", (void (JackalMPCCore::*)(const std::shared_ptr<distmap::DistanceMap> &dist_map)) &JackalMPCCore::set_dist_map)
.def("get_dist_map_data", &JackalMPCCore::get_dist_map_data)
.def("set_mpc_type", &JackalMPCCore::set_mpc_type)
.def("getHorizon", &JackalMPCCore::getHorizon)
.def("solve", &JackalMPCCore::solve)
.def("evaluateHFunction", &JackalMPCCore::evaluateHFunction);
}