20 #include <boost/variant.hpp> 28 class ToReqVisitor :
public boost::static_visitor<planning_interface::MotionPlanRequest>
34 return cmd.toRequest();
53 pilz_msgs::MotionSequenceRequest req;
55 std::vector<std::string> group_names;
56 for (
const auto&
cmd : cmds_)
58 pilz_msgs::MotionSequenceItem item;
61 if ( std::find(group_names.begin(), group_names.end(), item.req.group_name) != group_names.end() )
65 item.req.start_state = moveit_msgs::RobotState();
69 group_names.emplace_back(item.req.group_name);
72 item.blend_radius =
cmd.second;
73 req.items.push_back(item);
80 const size_t orig_n {
size()};
81 if (start > orig_n || end > orig_n)
84 msg.append(
"Parameter start=").append(std::to_string(start));
85 msg.append(
" and end=").append(std::to_string(end));
86 msg.append(
" must not be greater then the number of #commands=");
87 msg.append(std::to_string(
size()));
88 throw std::invalid_argument(msg);
90 cmds_.erase(cmds_.begin()+start, cmds_.begin()+end);
94 cmds_.at(
size()-1).second = 0.;
100 return boost::apply_visitor(
ToBaseVisitor(), cmds_.at(index_cmd).first);
Visitor transforming the stored command into a MotionPlanRequest.
Base class for commands storing all general information of a command.
std::size_t size(custom_string const &s)
MotionCmd & operator()(T &cmd) const
void erase(const size_t start, const size_t end)
Deletes all commands from index 'start' to index 'end'.
T & getCmd(const size_t index_cmd)
planning_interface::MotionPlanRequest operator()(T &cmd) const
moveit_msgs::MotionPlanRequest MotionPlanRequest
pilz_msgs::MotionSequenceRequest toRequest() const
Visitor returning not the specific command type but the base type.