common.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (Apache License)
3  *
4  * Copyright (c) 2018 Plus One Robotics
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #ifndef COMMON_H
20 #define COMMON_H
21 
22 #include <iostream>
23 
24 namespace packml_sm
25 {
26 // This magic function allows iostream (i.e. ROS_##_STREAM) macros to print out
27 // enumerations
28 // see: http://stackoverflow.com/questions/11421432/how-can-i-output-the-value-of-an-enum-class-in-c11
29 template <typename T>
30 std::ostream& operator<<(typename std::enable_if<std::is_enum<T>::value, std::ostream>::type& stream, const T& e)
31 {
32  return stream << static_cast<typename std::underlying_type<T>::type>(e);
33 }
34 
35 enum class StatesEnum
36 {
37  UNDEFINED = 0,
38  OFF = 1,
39  STOPPED = 2,
40  STARTING = 3,
41  IDLE = 4,
42  SUSPENDED = 5,
43  EXECUTE = 6,
44  STOPPING = 7,
45  ABORTING = 8,
46  ABORTED = 9,
47  HOLDING = 10,
48  HELD = 11,
49 
50  RESETTING = 100,
51  SUSPENDING = 101,
52  UNSUSPENDING = 102,
53  CLEARING = 103,
54  UNHOLDING = 104,
55  COMPLETING = 105,
56  COMPLETE = 106,
57 
58  // Super states that encapsulate multiple substates with a common transition
59  // Not explicitly used in the standard but helpful for consutrcting the state
60  // machine.
61  ABORTABLE = 200,
62  STOPPABLE = 201
63 };
64 
65 enum class ModeEnum
66 {
67  UNDEFINED = 0,
68  AUTOMATIC = 1,
69  SEMI_AUTOMATIC = 2,
70  MANUAL = 3,
71  IDLE = 4,
72  SETUP = 11
73 };
74 
75 enum class CmdEnum
76 {
77  UNDEFINED = 0,
78  CLEAR = 1,
79  START = 2,
80  STOP = 3,
81  HOLD = 4,
82  ABORT = 5,
83  RESET = 6,
84  ESTOP = 7,
85 
86  SUSPEND = 100,
87  UNSUSPEND = 101,
88  UNHOLD = 102
89 };
90 }
91 
92 #endif // COMMON_H
StatesEnum
Definition: common.h:35
ModeEnum
Definition: common.h:65


packml_sm
Author(s): Shaun Edwards
autogenerated on Fri Jul 12 2019 03:30:55