common.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (Apache License)
00003  *
00004  * Copyright (c) 2016 Shaun Edwards
00005  *
00006  * Licensed under the Apache License, Version 2.0 (the "License");
00007  * you may not use this file except in compliance with the License.
00008  * You may obtain a copy of the License at
00009  *
00010  * http://www.apache.org/licenses/LICENSE-2.0
00011  *
00012  * Unless required by applicable law or agreed to in writing, software
00013  * distributed under the License is distributed on an "AS IS" BASIS,
00014  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015  * See the License for the specific language governing permissions and
00016  * limitations under the License.
00017  */
00018 
00019 #ifndef COMMON_H
00020 #define COMMON_H
00021 
00022 namespace packml_sm
00023 {
00024 
00025 //This magic function allows iostream (i.e. ROS_##_STREAM) macros to print out
00026 //enumerations
00027 //see: http://stackoverflow.com/questions/11421432/how-can-i-output-the-value-of-an-enum-class-in-c11
00028 template<typename T>
00029 std::ostream& operator<<(typename std::enable_if<std::is_enum<T>::value, std::ostream>::type& stream, const T& e)
00030 {
00031   return stream << static_cast<typename std::underlying_type<T>::type>(e);
00032 }
00033 
00034 enum class StatesEnum {
00035   UNDEFINED = 0,
00036   OFF = 1,
00037   STOPPED = 2,
00038   STARTING = 3,
00039   IDLE = 4,
00040   SUSPENDED = 5,
00041   EXECUTE = 6,
00042   STOPPING = 7,
00043   ABORTING = 8,
00044   ABORTED = 9,
00045   HOLDING = 10,
00046   HELD = 11,
00047 
00048   RESETTING = 100,
00049   SUSPENDING = 101,
00050   UNSUSPENDING = 102,
00051   CLEARING = 103,
00052   UNHOLDING = 104,
00053   COMPLETING = 105,
00054   COMPLETE = 106,
00055 
00056   // Super states that encapsulate multiple substates with a common transition
00057   // Not explicitly used in the standard but helpful for consutrcting the state
00058   // machine.
00059   ABORTABLE = 200,
00060   STOPPABLE = 201
00061 };
00062 
00063 enum class ModeEnum {
00064   UNDEFINED = 0,
00065   AUTOMATIC = 1,
00066   SEMI_AUTOMATIC = 2,
00067   MANUAL = 3,
00068   IDLE = 4,
00069   SETUP = 11
00070 };
00071 
00072 enum class CmdEnum {
00073   UNDEFINED = 0,
00074   CLEAR = 1,
00075   START = 2,
00076   STOP = 3,
00077   HOLD = 4,
00078   ABORT = 5,
00079   RESET = 6,
00080   ESTOP = 7,
00081 
00082   SUSPEND = 100,
00083   UNSUSPEND = 101,
00084   UNHOLD = 102
00085 };
00086 
00087 }
00088 
00089 #endif // COMMON_H


packml_sm
Author(s): Shaun Edwards
autogenerated on Sat Jun 8 2019 20:13:34