AutoAPMS
Streamlining behaviors in ROS 2
Loading...
Searching...
No Matches
mission_config.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_mission/mission_config.hpp"
16
17#include <filesystem>
18
19#include "ament_index_cpp/get_resource.hpp"
20#include "auto_apms_util/exceptions.hpp"
21#include "auto_apms_util/resource.hpp"
22#include "auto_apms_util/string.hpp"
23
24namespace auto_apms_mission
25{
26
27MissionConfigResourceIdentity::MissionConfigResourceIdentity(const std::string & identity)
28: BehaviorResourceIdentity(identity, _AUTO_APMS_MISSION__DEFAULT_BEHAVIOR_CATEGORY__MISSION)
29{
30}
31
32MissionConfigResourceIdentity::MissionConfigResourceIdentity(const char * identity)
33: MissionConfigResourceIdentity(std::string(identity))
34{
35}
36
37const std::string MissionConfig::YAML_KEY_BRINGUP = "BRINGUP";
38const std::string MissionConfig::YAML_KEY_MISSION = "MISSION";
39const std::string MissionConfig::YAML_KEY_CONTINGENCY = "CONTINGENCY";
40const std::string MissionConfig::YAML_KEY_EMERGENCY = "EMERGENCY";
41const std::string MissionConfig::YAML_KEY_SHUTDOWN = "SHUTDOWN";
42
43MissionConfig MissionConfig::fromResource(const MissionConfigResourceIdentity & identity)
44{
45 MissionConfigResource resource(identity);
46 return fromFile(resource.build_request_file_path_);
47}
48
49} // namespace auto_apms_mission
Mission design utilities incorporating behavior trees to model the complexity of arbitrary operations...
static MissionConfig fromResource(const MissionConfigResourceIdentity &identity)
Create a mission configuration from an installed resource.