utils.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (Apache License)
00003  *
00004  * Copyright (c) 2017 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 #include <packml_msgs/Status.h>
00020 
00021 namespace packml_msgs
00022 {
00023 
00024 bool isStandardState(int state)
00025 {
00026 
00027   switch (state)  {
00028   case State::ABORTED:
00029   case State::ABORTING:
00030   case State::CLEARING:
00031   case State::COMPLETE:
00032   case State::COMPLETING:
00033   case State::EXECUTE:
00034   case State::HELD:
00035   case State::HOLDING:
00036   case State::IDLE:
00037   case State::OFF:
00038   case State::RESETTING:
00039   case State::STARTING:
00040   case State::STOPPED:
00041   case State::STOPPING:
00042   case State::SUSPENDED:
00043   case State::SUSPENDING:
00044   case State::UNHOLDING:
00045   case State::UNSUSPENDING:
00046     return true;
00047     break;
00048   default:
00049     return false;
00050     break;
00051   }
00052 }
00053 
00054 Status initStatus(std::string node_name)
00055 {
00056   Status status;
00057   status.header.frame_id = node_name;
00058   status.state.val = packml_msgs::State::UNDEFINED;
00059   status.sub_state = packml_msgs::State::UNDEFINED;
00060   status.mode.val = packml_msgs::Mode::UNDEFINED;
00061   //TODO: need better definition on errors
00062   status.error = 0;
00063   status.sub_error = 0;
00064   return status;
00065 }
00066 
00067 
00068 
00069 
00070 } //namespace packml_msgs
00071 
00072 #ifndef UTILS_H
00073 #define UTILS_H
00074 
00075 #endif // UTILS_H


packml_msgs
Author(s): Shaun Edwards
autogenerated on Sat Jun 8 2019 20:13:31