utils.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (Apache License)
3  *
4  * Copyright (c) 2017 Shaun Edwards
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 #include <packml_msgs/Status.h>
20 #include "packml_sm/common.h"
21 
22 namespace packml_msgs
23 {
24 bool isStandardState(int state)
25 {
26  switch (state)
27  {
28  case State::ABORTED:
29  case State::ABORTING:
30  case State::CLEARING:
31  case State::COMPLETE:
32  case State::COMPLETING:
33  case State::EXECUTE:
34  case State::HELD:
35  case State::HOLDING:
36  case State::IDLE:
37  case State::OFF:
38  case State::RESETTING:
39  case State::STARTING:
40  case State::STOPPED:
41  case State::STOPPING:
42  case State::SUSPENDED:
43  case State::SUSPENDING:
44  case State::UNHOLDING:
45  case State::UNSUSPENDING:
46  return true;
47  break;
48  default:
49  return false;
50  break;
51  }
52 }
53 
54 Status initStatus(std::string node_name)
55 {
56  Status status;
57  status.header.frame_id = node_name;
58  status.state.val = packml_msgs::State::UNDEFINED;
59  status.sub_state = packml_msgs::State::UNDEFINED;
60  status.mode.val = packml_msgs::Mode::UNDEFINED;
61  // TODO: need better definition on errors
62  status.error = 0;
63  status.sub_error = 0;
64  return status;
65 }
66 
67 } // namespace packml_msgs
68 
69 #ifndef UTILS_H
70 #define UTILS_H
71 
72 #endif // UTILS_H
Status initStatus(std::string node_name)
Definition: utils.h:54
bool isStandardState(int state)
Definition: utils.h:24


packml_msgs
Author(s): Shaun Edwards
autogenerated on Fri Jul 12 2019 03:30:52