polynomial_smoother.cpp
Go to the documentation of this file.
1 
28 #include <ros/console.h>
29 #include <Eigen/Geometry>
36 #include <XmlRpcException.h>
37 
39 
40 namespace stomp_moveit
41 {
42 namespace update_filters
43 {
44 
45 const double JOINT_LIMIT_MARGIN = 0.00001;
46 
47 PolynomialSmoother::PolynomialSmoother():
48  name_("ExponentialSmoother")
49 {
50  // TODO Auto-generated constructor stub
51 
52 }
53 
54 PolynomialSmoother::~PolynomialSmoother()
55 {
56  // TODO Auto-generated destructor stub
57 }
58 
59 bool PolynomialSmoother::initialize(moveit::core::RobotModelConstPtr robot_model_ptr,
60  const std::string& group_name,const XmlRpc::XmlRpcValue& config)
61 {
62  group_name_ = group_name;
63  robot_model_ = robot_model_ptr;
64 
65  return configure(config);
66 }
67 
68 bool PolynomialSmoother::configure(const XmlRpc::XmlRpcValue& config)
69 {
70  using namespace XmlRpc;
71 
72  try
73  {
74  XmlRpcValue params = config;
75  poly_order_ = static_cast<int>(params["poly_order"]);
76  }
77  catch(XmlRpc::XmlRpcException& e)
78  {
79  ROS_ERROR("%s failed to load parameters, %s",getName().c_str(),e.getMessage().c_str());
80  return false;
81  }
82 
83  return true;
84 }
85 
86 bool PolynomialSmoother::setMotionPlanRequest(const planning_scene::PlanningSceneConstPtr& planning_scene,
87  const moveit_msgs::MotionPlanRequest &req,
88  const stomp_core::StompConfiguration &config,
89  moveit_msgs::MoveItErrorCodes& error_code)
90 {
91  error_code.val = error_code.SUCCESS;
92  return true;
93 }
94 
95 bool PolynomialSmoother::filter(std::size_t start_timestep,
96  std::size_t num_timesteps,
97  int iteration_number,
98  const Eigen::MatrixXd& parameters,
99  Eigen::MatrixXd& updates,
100  bool& filtered)
101 {
102  using namespace Eigen;
103  using namespace moveit::core;
104  using namespace utils::polynomial;
105 
106  filtered = false;
107  Eigen::MatrixXd parameters_updates = parameters + updates;
108  if(applyPolynomialSmoothing(robot_model_,group_name_,parameters_updates,poly_order_,JOINT_LIMIT_MARGIN))
109  {
110  updates = parameters_updates - parameters;
111  filtered = true;
112  }
113  else
114  {
115  ROS_ERROR("Unable to polynomial smooth trajectory!");
116  return false;
117  }
118 
119  return true;
120 }
121 
122 
123 } /* namespace update_filters */
124 } /* namespace stomp_moveit */
const std::string & getMessage() const
This is a constrained polynomial trajectory smoother.
std::string getName(void *handle)
Interface class which applies filtering methods to the update parameters before it is added onto the ...
This defines a polynomial smoother update filter.
PLUGINLIB_EXPORT_CLASS(test_moveit_controller_manager::TestMoveItControllerManager, moveit_controller_manager::MoveItControllerManager)
#define ROS_ERROR(...)


stomp_moveit
Author(s): Jorge Nicho
autogenerated on Fri May 8 2020 03:35:47