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 
27 template <class StartType, class GoalType>
28 class BaseCmd : public MotionCmd
29 {
30 public:
32  : MotionCmd()
33  {}
34 
35  virtual ~BaseCmd() = default;
36 
37 public:
38  virtual planning_interface::MotionPlanRequest toRequest() const override;
39 
40  void setStartConfiguration(StartType start);
41  void setGoalConfiguration(GoalType goal);
42 
43  StartType& getStartConfiguration();
44  const StartType& getStartConfiguration() const;
45 
46  GoalType& getGoalConfiguration();
47  const GoalType& getGoalConfiguration() const;
48 
49 private:
50  virtual std::string getPlannerId() const = 0;
51 
52 protected:
53  GoalType goal_;
54  StartType start_;
55 
56 };
57 
58 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
59 template <class StartType, class GoalType>
61 {
62  start_ = start;
63 }
64 
65 template <class StartType, class GoalType>
67 {
68  goal_ = goal;
69 }
70 
71 template <class StartType, class GoalType>
73 {
74  return start_;
75 }
76 
77 template <class StartType, class GoalType>
79 {
80  return start_;
81 }
82 
83 template <class StartType, class GoalType>
85 {
86  return goal_;
87 }
88 
89 template <class StartType, class GoalType>
91 {
92  return goal_;
93 }
94 
95 template <class StartType, class GoalType>
97 {
99  req.planner_id = getPlannerId();
100  req.group_name = this->planning_group_;
101 
102  req.max_velocity_scaling_factor = this->vel_scale_;
103  req.max_acceleration_scaling_factor = this->acc_scale_;
104 
105  req.start_state = this->start_.toMoveitMsgsRobotState();
106  req.goal_constraints.push_back(this->goal_.toGoalConstraints());
107 
108  return req;
109 }
110 
111 }
112 
113 #endif // BASECMD_H
Base class for commands storing all general information of a command.
Definition: motioncmd.h:31
void setGoalConfiguration(GoalType goal)
Definition: basecmd.h:66
virtual std::string getPlannerId() const =0
void setStartConfiguration(StartType start)
Definition: basecmd.h:60
moveit_msgs::MotionPlanRequest MotionPlanRequest
virtual planning_interface::MotionPlanRequest toRequest() const override
Definition: basecmd.h:96


pilz_industrial_motion_testutils
Author(s):
autogenerated on Mon Apr 6 2020 03:17:28