moveit2
The MoveIt Motion Planning Framework for ROS 2.
trajopt_interface.cpp
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2019, PickNik Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of PickNik Inc. nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 /* Author: Omid Heidari */
36 
39 
40 #include <moveit_msgs/MotionPlanRequest.h>
41 
42 #include <trajopt_sco/sco_common.hpp>
43 #include <trajopt_sco/optimizers.hpp>
44 #include <trajopt_sco/solver_interface.hpp>
45 
46 #include <trajopt/trajectory_costs.hpp>
47 
48 #include <ros/ros.h>
49 #include <rosparam_shortcuts/rosparam_shortcuts.h>
50 
51 #include <limits>
52 #include <vector>
53 #include <Eigen/Geometry>
54 #include <unordered_map>
55 
58 
59 namespace trajopt_interface
60 {
61 TrajOptInterface::TrajOptInterface(const ros::NodeHandle& nh) : nh_(nh), name_("TrajOptInterface")
62 {
63  trajopt_problem_ = std::make_shared<TrajOptProblem>();
65 
66  // TODO: callbacks should be defined by the user
68 }
69 
70 bool TrajOptInterface::solve(const planning_scene::PlanningSceneConstPtr& planning_scene,
72  moveit_msgs::MotionPlanDetailedResponse& res)
73 {
74  ROS_INFO(" ======================================= From trajopt_interface, solve is called");
76 
77  if (!planning_scene)
78  {
79  ROS_ERROR_STREAM_NAMED(name_, "No planning scene initialized.");
80  res.error_code.val = moveit_msgs::MoveItErrorCodes::FAILURE;
81  return false;
82  }
83 
84  ROS_INFO(" ======================================= Extract current state information");
85  ros::WallTime start_time = ros::WallTime::now();
86  moveit::core::RobotModelConstPtr robot_model = planning_scene->getRobotModel();
87  bool robot_model_ok = static_cast<bool>(robot_model);
88  if (!robot_model_ok)
89  ROS_ERROR_STREAM_NAMED(name_, "robot model is not loaded properly");
90  auto current_state = std::make_shared<moveit::core::RobotState>(robot_model);
91  *current_state = planning_scene->getCurrentState();
92  const moveit::core::JointModelGroup* joint_model_group = current_state->getJointModelGroup(req.group_name);
93  if (joint_model_group == nullptr)
94  ROS_ERROR_STREAM_NAMED(name_, "joint model group is empty");
95  std::vector<std::string> group_joint_names = joint_model_group->getActiveJointModelNames();
96  int dof = group_joint_names.size();
97  std::vector<double> current_joint_values;
98  current_state->copyJointGroupPositions(joint_model_group, current_joint_values);
99 
100  // Current state is different from star state in general
101  ROS_INFO(" ======================================= Extract start state information");
102  trajopt::DblVec start_joint_values = extractStartJointValues(req, group_joint_names);
103 
104  // check the start state for being empty or joint limit violiation
105  if (start_joint_values.empty())
106  {
107  ROS_ERROR_STREAM_NAMED(name_, "Start_state is empty");
108  res.error_code.val = moveit_msgs::MoveItErrorCodes::INVALID_ROBOT_STATE;
109  return false;
110  }
111 
112  if (not joint_model_group->satisfiesPositionBounds(start_joint_values.data()))
113  {
114  ROS_ERROR_STREAM_NAMED(name_, "Start state violates joint limits");
115  res.error_code.val = moveit_msgs::MoveItErrorCodes::INVALID_ROBOT_STATE;
116  return false;
117  }
118 
119  ROS_INFO(" ======================================= Create ProblemInfo");
120  ProblemInfo problem_info(planning_scene, req.group_name);
121 
122  setProblemInfoParam(problem_info);
123 
124  ROS_INFO(" ======================================= Populate init info, hard-coded");
125  // TODO: init info should be defined by user. To this end, we need to add seed trajectories to MotionPlanRequest.
126  // JOINT_INTERPOLATED: data is the current joint values
127  // GIVEN_TRAJ: data is the joint values of the current state copied to all timesteps
128  Eigen::VectorXd current_joint_values_eigen(dof);
129  for (int joint_index = 0; joint_index < dof; ++joint_index)
130  {
131  current_joint_values_eigen(joint_index) = current_joint_values[joint_index];
132  }
133 
134  if (problem_info.init_info.type == InitInfo::JOINT_INTERPOLATED)
135  {
136  problem_info.init_info.data = current_joint_values_eigen;
137  }
138  else if (problem_info.init_info.type == InitInfo::GIVEN_TRAJ)
139  {
140  problem_info.init_info.data = current_joint_values_eigen.transpose().replicate(problem_info.basic_info.n_steps, 1);
141  }
142 
143  ROS_INFO(" ======================================= Create Constraints");
144  if (req.goal_constraints.empty())
145  {
146  ROS_ERROR_STREAM_NAMED("trajopt_planner", "No goal constraints specified!");
147  res.error_code.val = moveit_msgs::MoveItErrorCodes::INVALID_GOAL_CONSTRAINTS;
148  return false;
149  }
150 
151  ROS_INFO(" ======================================= Cartesian Constraints");
152  if (!req.goal_constraints[0].position_constraints.empty() && !req.goal_constraints[0].orientation_constraints.empty())
153  {
154  CartPoseTermInfoPtr cart_goal_pos = std::make_shared<CartPoseTermInfo>();
155 
156  // TODO: Feed cart_goal_pos with request information and the needed param to the setup.yaml file
157  // TODO: Multiple Cartesian constraints
158 
159  // Add the constraint to problem_info
160  problem_info.cnt_infos.push_back(cart_goal_pos);
161  }
162  else if (req.goal_constraints[0].position_constraints.empty() &&
163  !req.goal_constraints[0].orientation_constraints.empty())
164  {
165  ROS_ERROR_STREAM_NAMED("trajopt_planner", "position constraint is not defined");
166  res.error_code.val = moveit_msgs::MoveItErrorCodes::INVALID_GOAL_CONSTRAINTS;
167  return false;
168  }
169  else if (!req.goal_constraints[0].orientation_constraints.empty() &&
170  req.goal_constraints[0].orientation_constraints.empty())
171  {
172  ROS_ERROR_STREAM_NAMED("trajopt_planner", "orientation constraint is not defined");
173  res.error_code.val = moveit_msgs::MoveItErrorCodes::INVALID_GOAL_CONSTRAINTS;
174  return false;
175  }
176 
177  ROS_INFO(" ======================================= Constraints from request goal_constraints");
178  for (auto goal_cnt : req.goal_constraints)
179  {
180  JointPoseTermInfoPtr joint_pos_term = std::make_shared<JointPoseTermInfo>();
181  // When using MotionPlanning Display in RViz, the created request has no name for the constriant
182  setJointPoseTermInfoParams(joint_pos_term, (goal_cnt.name != "") ? goal_cnt.name : "goal_tmp");
183 
184  trajopt::DblVec joint_goal_constraints;
185  for (const moveit_msgs::JointConstraint& joint_goal_constraint : goal_cnt.joint_constraints)
186  {
187  joint_goal_constraints.push_back(joint_goal_constraint.position);
188  }
189  joint_pos_term->targets = joint_goal_constraints;
190  problem_info.cnt_infos.push_back(joint_pos_term);
191  }
192 
193  ROS_INFO(" ======================================= Constraints from request start_state");
194  // add the start pos from request as a constraint
195  auto joint_start_pos = std::make_shared<JointPoseTermInfo>();
196 
197  joint_start_pos->targets = start_joint_values;
198  setJointPoseTermInfoParams(joint_start_pos, "start_pos");
199  problem_info.cnt_infos.push_back(joint_start_pos);
200 
201  ROS_INFO(" ======================================= Velocity Constraints, hard-coded");
202  // TODO: should be defined by user, its parameters should be added to setup.yaml
203  auto joint_vel = std::make_shared<JointVelTermInfo>();
204 
205  joint_vel->coeffs = std::vector<double>(dof, 5.0);
206  joint_vel->targets = std::vector<double>(dof, 0.0);
207  joint_vel->first_step = 0;
208  joint_vel->last_step = problem_info.basic_info.n_steps - 1;
209  joint_vel->name = "joint_vel";
210  joint_vel->term_type = trajopt_interface::TT_COST;
211  problem_info.cost_infos.push_back(joint_vel);
212 
213  ROS_INFO(" ======================================= Visibility Constraints");
214  if (!req.goal_constraints[0].visibility_constraints.empty())
215  {
216  // TODO: Add visibility constraint
217  }
218 
219  ROS_DEBUG_STREAM_NAMED(name_, "trajopt_param.improve_ratio_threshold: " << params_.improve_ratio_threshold);
220  ROS_DEBUG_STREAM_NAMED(name_, "trajopt_param.min_trust_box_size: " << params_.min_trust_box_size);
221  ROS_DEBUG_STREAM_NAMED(name_, "trajopt_param.min_approx_improve: " << params_.min_approx_improve);
222  ROS_DEBUG_STREAM_NAMED(name_, "trajopt_param.params_.min_approx_improve_frac: " << params_.min_approx_improve_frac);
223  ROS_DEBUG_STREAM_NAMED(name_, "trajopt_param.max_iter: " << params_.max_iter);
224  ROS_DEBUG_STREAM_NAMED(name_, "trajopt_param.trust_shrink_ratio: " << params_.trust_shrink_ratio);
225  ROS_DEBUG_STREAM_NAMED(name_, "trajopt_param.trust_expand_ratio: " << params_.trust_expand_ratio);
226  ROS_DEBUG_STREAM_NAMED(name_, "trajopt_param.cnt_tolerance: " << params_.cnt_tolerance);
227  ROS_DEBUG_STREAM_NAMED(name_, "trajopt_param.max_merit_coeff_increases: " << params_.max_merit_coeff_increases);
228  ROS_DEBUG_STREAM_NAMED(name_, "trajopt_param.merit_coeff_increase_ratio: " << params_.merit_coeff_increase_ratio);
229  ROS_DEBUG_STREAM_NAMED(name_, "trajopt_param.max_time: " << params_.max_time);
230  ROS_DEBUG_STREAM_NAMED(name_, "trajopt_param.merit_error_coeff: " << params_.merit_error_coeff);
231  ROS_DEBUG_STREAM_NAMED(name_, "trajopt_param.trust_box_size: " << params_.trust_box_size);
232  ROS_DEBUG_STREAM_NAMED(name_, "problem_info.basic_info.n_steps: " << problem_info.basic_info.n_steps);
233  ROS_DEBUG_STREAM_NAMED(name_, "problem_info.basic_info.dt_upper_lim: " << problem_info.basic_info.dt_upper_lim);
234  ROS_DEBUG_STREAM_NAMED(name_, "problem_info.basic_info.dt_lower_lim: " << problem_info.basic_info.dt_lower_lim);
235  ROS_DEBUG_STREAM_NAMED(name_, "problem_info.basic_info.start_fixed: " << problem_info.basic_info.start_fixed);
236  ROS_DEBUG_STREAM_NAMED(name_, "problem_info.basic_info.use_time: " << problem_info.basic_info.use_time);
237  ROS_DEBUG_STREAM_NAMED(name_, "problem_info.basic_info.convex_solver: " << problem_info.basic_info.convex_solver);
238 
239  std::string problem_info_type;
240  switch (problem_info.init_info.type)
241  {
243  problem_info_type = "STATIONARY";
244  break;
246  problem_info_type = "JOINT_INTERPOLATED";
247  break;
249  problem_info_type = "GIVEN_TRAJ";
250  break;
251  }
252  ROS_DEBUG_STREAM_NAMED(name_, "problem_info.basic_info.type: " << problem_info_type);
253  ROS_DEBUG_STREAM_NAMED(name_, "problem_info.basic_info.dt: " << problem_info.init_info.dt);
254 
255  ROS_INFO(" ======================================= Construct problem");
256  trajopt_problem_ = ConstructProblem(problem_info);
257 
258  ROS_INFO_STREAM_NAMED("num_cost", trajopt_problem_->getNumCosts());
259  ROS_INFO_STREAM_NAMED("num_constraints", trajopt_problem_->getNumConstraints());
260 
261  ROS_INFO(" ======================================= TrajOpt Optimization");
262  sco::BasicTrustRegionSQP opt(trajopt_problem_);
263 
264  opt.setParameters(params_);
265  opt.initialize(trajopt::trajToDblVec(trajopt_problem_->GetInitTraj()));
266 
267  // Add all callbacks
268  for (const sco::Optimizer::Callback& callback : optimizer_callbacks_)
269  {
270  opt.addCallback(callback);
271  }
272 
273  // Optimize
274  ros::WallTime create_time = ros::WallTime::now();
275  opt.optimize();
276 
277  ROS_INFO(" ======================================= TrajOpt Solution");
278  trajopt::TrajArray opt_solution = trajopt::getTraj(opt.x(), trajopt_problem_->GetVars());
279 
280  // assume that the trajectory is now optimized, fill in the output structure:
281  ROS_INFO_STREAM_NAMED("num_rows", opt_solution.rows());
282  ROS_INFO_STREAM_NAMED("num_cols", opt_solution.cols());
283 
284  res.trajectory.resize(1);
285  res.trajectory[0].joint_trajectory.joint_names = group_joint_names;
286  res.trajectory[0].joint_trajectory.header = req.start_state.joint_state.header;
287 
288  // fill in the entire trajectory
289  res.trajectory[0].joint_trajectory.points.resize(opt_solution.rows());
290  for (int i = 0; i < opt_solution.rows(); ++i)
291  {
292  res.trajectory[0].joint_trajectory.points[i].positions.resize(opt_solution.cols());
293  for (size_t j = 0; j < opt_solution.cols(); ++j)
294  {
295  res.trajectory[0].joint_trajectory.points[i].positions[j] = opt_solution(i, j);
296  }
297  // Further filtering is required to set valid timestamps accounting for velocity and acceleration constraints.
298  res.trajectory[0].joint_trajectory.points[i].time_from_start = ros::Duration(0.0);
299  }
300 
301  res.error_code.val = moveit_msgs::MoveItErrorCodes::SUCCESS;
302  res.processing_time.push_back((ros::WallTime::now() - start_time).toSec());
303 
304  ROS_INFO(" ======================================= check if final state is within goal tolerances");
305  kinematic_constraints::JointConstraint joint_cnt(planning_scene->getRobotModel());
306  moveit::core::RobotState last_state(*current_state);
307  last_state.setJointGroupPositions(req.group_name, res.trajectory[0].joint_trajectory.points.back().positions);
308 
309  for (int jn = 0; jn < res.trajectory[0].joint_trajectory.points.back().positions.size(); ++jn)
310  {
311  ROS_INFO_STREAM_NAMED("joint_value", res.trajectory[0].joint_trajectory.points.back().positions[jn]
312  << " " << req.goal_constraints.back().joint_constraints[jn].position);
313  }
314 
315  bool constraints_are_ok = true;
316  int joint_cnt_index = 0;
317  for (const moveit_msgs::JointConstraint& constraint : req.goal_constraints.back().joint_constraints)
318  {
319  ROS_INFO("index %i: jc.configure(constraint)=> %d, jc.decide(last_state).satisfied=> %d, tolerance %f",
320  joint_cnt_index, joint_cnt.configure(constraint), joint_cnt.decide(last_state).satisfied,
321  constraint.tolerance_above);
322  constraints_are_ok = constraints_are_ok and joint_cnt.configure(constraint);
323  constraints_are_ok = constraints_are_ok and joint_cnt.decide(last_state).satisfied;
324  if (not constraints_are_ok)
325  {
326  ROS_ERROR_STREAM_NAMED("trajopt_planner", "Goal constraints are violated: " << constraint.joint_name);
327  res.error_code.val = moveit_msgs::MoveItErrorCodes::GOAL_CONSTRAINTS_VIOLATED;
328  return false;
329  }
330  joint_cnt_index = joint_cnt_index + 1;
331  }
332 
333  ROS_INFO(" ==================================== Response");
334  res.trajectory_start = req.start_state;
335 
336  ROS_INFO(" ==================================== Debug Response");
337  ROS_INFO_STREAM_NAMED("group_name", res.group_name);
338  ROS_INFO_STREAM_NAMED("start_traj_name_size", res.trajectory_start.joint_state.name.size());
339  ROS_INFO_STREAM_NAMED("start_traj_position_size", res.trajectory_start.joint_state.position.size());
340  ROS_INFO_STREAM_NAMED("traj_name_size", res.trajectory[0].joint_trajectory.joint_names.size());
341  ROS_INFO_STREAM_NAMED("traj_point_size", res.trajectory[0].joint_trajectory.points.size());
342  return true;
343 }
344 
346 {
347  sco::BasicTrustRegionSQPParameters params;
348  params_ = params;
349 }
350 
351 void TrajOptInterface::setTrajOptParams(sco::BasicTrustRegionSQPParameters& params)
352 {
353  nh_.param("trajopt_param/improve_ratio_threshold", params.improve_ratio_threshold, 0.25);
354  nh_.param("trajopt_param/min_trust_box_size", params.min_trust_box_size, 1e-4);
355  nh_.param("trajopt_param/min_approx_improve", params.min_approx_improve, 1e-4);
356  nh_.param("trajopt_param/min_approx_improve_frac", params.min_approx_improve_frac, -static_cast<double>(INFINITY));
357  nh_.param("trajopt_param/max_iter", params.max_iter, 100.0);
358  nh_.param("trajopt_param/trust_shrink_ratio", params.trust_shrink_ratio, 0.1);
359 
360  nh_.param("trajopt_param/trust_expand_ratio", params.trust_expand_ratio, 1.5);
361  nh_.param("trajopt_param/cnt_tolerance", params.cnt_tolerance, 1e-4);
362  nh_.param("trajopt_param/max_merit_coeff_increases", params.max_merit_coeff_increases, 5.0);
363  nh_.param("trajopt_param/merit_coeff_increase_ratio", params.merit_coeff_increase_ratio, 10.0);
364  nh_.param("trajopt_param/max_time", params.max_time, static_cast<double>(INFINITY));
365  nh_.param("trajopt_param/merit_error_coeff", params.merit_error_coeff, 10.0);
366  nh_.param("trajopt_param/trust_box_size", params.trust_box_size, 1e-1);
367 }
368 
370 {
371  nh_.param("problem_info/basic_info/n_steps", problem_info.basic_info.n_steps, 20);
372  nh_.param("problem_info/basic_info/dt_upper_lim", problem_info.basic_info.dt_upper_lim, 2.0);
373  nh_.param("problem_info/basic_info/dt_lower_lim", problem_info.basic_info.dt_lower_lim, 100.0);
374  nh_.param("problem_info/basic_info/start_fixed", problem_info.basic_info.start_fixed, true);
375  nh_.param("problem_info/basic_info/use_time", problem_info.basic_info.use_time, false);
376  int convex_solver_index;
377  nh_.param("problem_info/basic_info/convex_solver", convex_solver_index, 1);
378  switch (convex_solver_index)
379  {
380  case 1:
381  problem_info.basic_info.convex_solver = sco::ModelType::AUTO_SOLVER;
382  break;
383  case 2:
384  problem_info.basic_info.convex_solver = sco::ModelType::BPMPD;
385  break;
386  case 3:
387  problem_info.basic_info.convex_solver = sco::ModelType::OSQP;
388  break;
389  case 4:
390  problem_info.basic_info.convex_solver = sco::ModelType::QPOASES;
391  break;
392  case 5:
393  problem_info.basic_info.convex_solver = sco::ModelType::GUROBI;
394  break;
395  }
396 
397  nh_.param("problem_info/init_info/dt", problem_info.init_info.dt, 0.5);
398  int type_index;
399  nh_.param("problem_info/init_info/type", type_index, 1);
400  switch (type_index)
401  {
402  case 1:
403  problem_info.init_info.type = InitInfo::STATIONARY;
404  break;
405  case 2:
407  break;
408  case 3:
409  problem_info.init_info.type = InitInfo::GIVEN_TRAJ;
410  break;
411  }
412 }
413 
414 void TrajOptInterface::setJointPoseTermInfoParams(JointPoseTermInfoPtr& jp, std::string name)
415 {
416  int term_type_index;
417  std::string term_type_address = "joint_pos_term_info/" + name + "/term_type";
418  nh_.param(term_type_address, term_type_index, 1);
419 
420  switch (term_type_index)
421  {
422  case 1:
423  jp->term_type = TT_COST;
424  break;
425  case 2:
426  jp->term_type = TT_CNT;
427  break;
428  case 3:
429  jp->term_type = TT_USE_TIME;
430  break;
431  }
432 
433  nh_.getParam("joint_pos_term_info/" + name + "/first_timestep", jp->first_step);
434  nh_.getParam("joint_pos_term_info/" + name + "/last_timestep", jp->last_step);
435  nh_.getParam("joint_pos_term_info/" + name + "/name", jp->name);
436 }
437 
439  const std::vector<std::string>& group_joint_names)
440 {
441  std::unordered_map<std::string, double> all_joints;
442  trajopt::DblVec start_joint_vals;
443 
444  for (int joint_index = 0; joint_index < req.start_state.joint_state.position.size(); ++joint_index)
445  {
446  all_joints[req.start_state.joint_state.name[joint_index]] = req.start_state.joint_state.position[joint_index];
447  }
448 
449  for (auto joint_name : group_joint_names)
450  {
451  ROS_INFO(" joint position from start state, name: %s, value: %f", joint_name.c_str(), all_joints[joint_name]);
452  start_joint_vals.push_back(all_joints[joint_name]);
453  }
454 
455  return start_joint_vals;
456 }
457 
458 void callBackFunc(sco::OptProb* opt_prob, sco::OptResults& opt_res)
459 {
460  // TODO: Create the actual implementation
461 }
462 
463 } // namespace trajopt_interface
Class for handling single DOF joint constraints.
ConstraintEvaluationResult decide(const moveit::core::RobotState &state, bool verbose=false) const override
Decide whether the constraint is satisfied in the indicated state.
bool configure(const moveit_msgs::msg::JointConstraint &jc)
Configure the constraint based on a moveit_msgs::msg::JointConstraint.
bool satisfiesPositionBounds(const double *state, double margin=0.0) const
const std::vector< std::string > & getActiveJointModelNames() const
Get the names of the active joints in this group. These are the names of the joints returned by getJo...
Representation of a robot's state. This includes position, velocity, acceleration and effort.
Definition: robot_state.h:90
void setJointGroupPositions(const std::string &joint_group_name, const double *gstate)
Given positions for the variables that make up a group, in the order found in the group (including va...
Definition: robot_state.h:605
void setProblemInfoParam(ProblemInfo &problem_info)
TrajOptInterface(const ros::NodeHandle &nh=ros::NodeHandle("~"))
bool solve(const planning_scene::PlanningSceneConstPtr &planning_scene, const planning_interface::MotionPlanRequest &req, moveit_msgs::MotionPlanDetailedResponse &res)
sco::BasicTrustRegionSQPParameters params_
The ROS node handle.
void setJointPoseTermInfoParams(JointPoseTermInfoPtr &jp, std::string name)
void setTrajOptParams(sco::BasicTrustRegionSQPParameters &param)
Configure everything using the param server.
trajopt::DblVec extractStartJointValues(const planning_interface::MotionPlanRequest &req, const std::vector< std::string > &group_joint_names)
std::vector< sco::Optimizer::Callback > optimizer_callbacks_
moveit_msgs::msg::MotionPlanRequest MotionPlanRequest
This namespace includes the central class for representing planning contexts.
name
Definition: setup.py:7
void callBackFunc(sco::OptProb *opt_prob, sco::OptResults &opt_res)
TrajOptProblemPtr ConstructProblem(const ProblemInfo &)
bool satisfied
Whether or not the constraint or constraints were satisfied.
int n_steps
Number of time steps (rows) in the optimization matrix.
double dt_upper_lim
The upper limit of 1/dt values allowed in the optimization.
double dt_lower_lim
The lower limit of 1/dt values allowed in the optimization.
bool use_time
If true, the last column in the optimization matrix will be 1/dt.
bool start_fixed
If true, first time step is fixed with a joint level constraint If this is false, the starting point ...
trajopt::TrajArray data
Data used during initialization. Use depends on the initialization selected. This data will be used t...
Type type
Specifies the type of initialization to use.
double dt
Default value the final column of the optimization is initialized too if time is being used.
std::vector< TermInfoPtr > cnt_infos
std::vector< TermInfoPtr > cost_infos