AutoAPMS
Resilient Robot Mission Management
Loading...
Searching...
No Matches
util.cpp
1// Copyright 2024 Robin Müller
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#include "auto_apms_simulation/util.hpp"
16
17namespace auto_apms_simulation
18{
19
20std::string toStr(ExecutionResultMsg result)
21{
22 std::string status_str;
23 switch (result.status) {
24 case result.SUCCESS:
25 status_str = "SUCCESS";
26 break;
27 case result.PRECONDITION_FAILURE:
28 status_str = "PRECONDITION_FAILURE";
29 break;
30 case result.PLANNING_FAILURE:
31 status_str = "PLANNING_FAILURE";
32 break;
33 case result.EXECUTION_FAILURE:
34 status_str = "EXECUTION_FAILURE";
35 break;
36 case result.POSTCONDITION_FAILURE:
37 status_str = "POSTCONDITION_FAILURE";
38 break;
39 case result.INVALID_ACTION:
40 status_str = "INVALID_ACTION";
41 break;
42 case result.CANCELED:
43 status_str = "CANCELED";
44 break;
45 default:
46 status_str = "UNKOWN";
47 }
48 return result.message + " (Result status: " + status_str + ").";
49}
50
51} // namespace auto_apms_simulation