37 #include <boost/python.hpp> 38 #include <robot_controllers/diff_drive_limiter.h> 39 #include <robot_controllers_msgs/DiffDriveLimiterParams.h> 41 namespace bp = boost::python;
43 using robot_controllers::DiffDriveLimiter;
44 using robot_controllers_msgs::DiffDriveLimiterParams;
49 bp::tuple
limit(
double desired_linear_velocity,
50 double desired_angular_velocity,
51 double last_linear_velocity,
52 double last_angular_velocity,
53 double safety_scaling,
56 double limited_linear_velocity, limited_angular_velocity;
57 DiffDriveLimiter::limit(&limited_linear_velocity,
58 &limited_angular_velocity,
59 desired_linear_velocity,
60 desired_angular_velocity,
62 last_angular_velocity,
65 return bp::make_tuple(limited_linear_velocity, limited_angular_velocity);
70 double angular_velocity)
72 double left_velocity, right_velocity;
73 DiffDriveLimiter::calcWheelVelocities(&left_velocity,
77 return bp::make_tuple(left_velocity, right_velocity);
83 bp::class_<DiffDriveLimiterParams>(
"DiffDriveLimiterParams")
84 .def_readwrite(
"max_linear_velocity", &DiffDriveLimiterParams::max_linear_velocity)
85 .def_readwrite(
"max_linear_acceleration",
86 &DiffDriveLimiterParams::max_linear_acceleration)
87 .def_readwrite(
"max_angular_velocity", &DiffDriveLimiterParams::max_angular_velocity)
88 .def_readwrite(
"max_angular_acceleration",
89 &DiffDriveLimiterParams::max_angular_acceleration)
90 .def_readwrite(
"max_wheel_velocity", &DiffDriveLimiterParams::max_wheel_velocity)
91 .def_readwrite(
"track_width", &DiffDriveLimiterParams::track_width)
92 .def_readwrite(
"angular_velocity_limits_linear_velocity",
93 &DiffDriveLimiterParams::angular_velocity_limits_linear_velocity)
94 .def_readwrite(
"scale_to_wheel_velocity_limits",
95 &DiffDriveLimiterParams::scale_to_wheel_velocity_limits)
98 bp::class_<pyDiffDriveLimiter>(
"DiffDriveLimiter")
101 .add_property(
"params",
102 &pyDiffDriveLimiter::getParams,
103 &pyDiffDriveLimiter::setParams)
104 .def(
"setParams", &pyDiffDriveLimiter::setParams)
105 .def(
"getParams", &pyDiffDriveLimiter::getParams)
106 .def(
"getDefaultParams", &pyDiffDriveLimiter::getDefaultParams)
107 .staticmethod(
"getDefaultParams")
108 .def(
"validateParams", &pyDiffDriveLimiter::validateParams)
109 .staticmethod(
"validateParams")
bp::tuple calcWheelVelocities(double linear_velocity, double angular_velocity)
BOOST_PYTHON_MODULE(robot_controllers_python)
bp::tuple limit(double desired_linear_velocity, double desired_angular_velocity, double last_linear_velocity, double last_angular_velocity, double safety_scaling, double dt)