basecmd.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 Pilz GmbH & Co. KG
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef BASECMD_H
18 #define BASECMD_H
19 
20 #include <string>
21 
22 #include "motioncmd.h"
23 
25 {
26 template <class StartType, class GoalType>
27 class BaseCmd : public MotionCmd
28 {
29 public:
31  {
32  }
33 
34  virtual ~BaseCmd() = default;
35 
36 public:
37  virtual planning_interface::MotionPlanRequest toRequest() const override;
38 
39  void setStartConfiguration(StartType start);
40  void setGoalConfiguration(GoalType goal);
41 
42  StartType& getStartConfiguration();
43  const StartType& getStartConfiguration() const;
44 
45  GoalType& getGoalConfiguration();
46  const GoalType& getGoalConfiguration() const;
47 
48 private:
49  virtual std::string getPlannerId() const = 0;
50 
51 protected:
52  GoalType goal_;
53  StartType start_;
54 };
55 
56 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
57 template <class StartType, class GoalType>
59 {
60  start_ = start;
61 }
62 
63 template <class StartType, class GoalType>
65 {
66  goal_ = goal;
67 }
68 
69 template <class StartType, class GoalType>
71 {
72  return start_;
73 }
74 
75 template <class StartType, class GoalType>
77 {
78  return start_;
79 }
80 
81 template <class StartType, class GoalType>
83 {
84  return goal_;
85 }
86 
87 template <class StartType, class GoalType>
89 {
90  return goal_;
91 }
92 
93 template <class StartType, class GoalType>
95 {
97  req.planner_id = getPlannerId();
98  req.group_name = this->planning_group_;
99 
100  req.max_velocity_scaling_factor = this->vel_scale_;
101  req.max_acceleration_scaling_factor = this->acc_scale_;
102 
103  req.start_state = this->start_.toMoveitMsgsRobotState();
104  req.goal_constraints.push_back(this->goal_.toGoalConstraints());
105 
106  return req;
107 }
108 
109 } // namespace pilz_industrial_motion_testutils
110 
111 #endif // BASECMD_H
ROSCPP_DECL void start()
Base class for commands storing all general information of a command.
Definition: motioncmd.h:30
void setGoalConfiguration(GoalType goal)
Definition: basecmd.h:64
virtual std::string getPlannerId() const =0
void setStartConfiguration(StartType start)
Definition: basecmd.h:58
moveit_msgs::MotionPlanRequest MotionPlanRequest
virtual planning_interface::MotionPlanRequest toRequest() const override
Definition: basecmd.h:94


pilz_industrial_motion_testutils
Author(s):
autogenerated on Mon Feb 28 2022 23:13:36