SMACC2
Loading...
Searching...
No Matches
smacc2_client_library
cl_px4_mr
include
cl_px4_mr
client_behaviors
cb_load_kml_mission.hpp
Go to the documentation of this file.
1
// Copyright 2026 RobosoftAI Inc.
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
// http://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
/*****************************************************************************************************************
16
*
17
* Authors: Brett Aldrich
18
*
19
******************************************************************************************************************/
20
21
#pragma once
22
23
#include <
cl_px4_mr/client_behaviors/cb_px4_client_behavior_base.hpp
>
24
#include <
cl_px4_mr/utils/geo_utils.hpp
>
25
#include <
smacc2/smacc.hpp
>
26
27
#include <string>
28
#include <vector>
29
30
namespace
cl_px4_mr
31
{
32
33
class
CpKmlMissionLoader;
34
35
// Loads the mission backbone (first LineString) from an ABSOLUTE KML path into
36
// CpKmlMissionLoader. The config file is a convenience: if it is absent or
37
// unparseable and a fallback backbone was supplied, the fallback is stored
38
// instead and the behavior still succeeds (with a WARN). Failure is posted
39
// only when nothing usable is available.
40
class
CbLoadKmlMission
:
public
CbPx4ClientBehaviorBase
41
{
42
public
:
43
explicit
CbLoadKmlMission
(
44
std::string absoluteKmlPath, std::vector<GeoPoint> fallbackBackbone = {});
45
46
void
setFilePath
(
const
std::string & absoluteKmlPath) {
path_
= absoluteKmlPath; }
47
void
setFallback
(std::vector<GeoPoint> fallbackBackbone)
48
{
49
fallback_
= std::move(fallbackBackbone);
50
}
51
52
template
<
typename
TOrthogonal,
typename
TSourceObject>
53
void
onStateOrthogonalAllocation
()
54
{
55
this->
requiresComponent
(
kmlLoader_
,
smacc2::ComponentRequirement::SOFT
);
56
CbPx4ClientBehaviorBase::onStateOrthogonalAllocation<TOrthogonal, TSourceObject>
();
57
}
58
59
void
onEntry
()
override
;
60
void
onExit
()
override
;
61
62
private
:
63
CpKmlMissionLoader
*
kmlLoader_
=
nullptr
;
64
std::string
path_
;
65
std::vector<GeoPoint>
fallback_
;
66
};
67
68
}
// namespace cl_px4_mr
cb_px4_client_behavior_base.hpp
cl_px4_mr::CbLoadKmlMission
Definition
cb_load_kml_mission.hpp:41
cl_px4_mr::CbLoadKmlMission::setFilePath
void setFilePath(const std::string &absoluteKmlPath)
Definition
cb_load_kml_mission.hpp:46
cl_px4_mr::CbLoadKmlMission::onStateOrthogonalAllocation
void onStateOrthogonalAllocation()
Definition
cb_load_kml_mission.hpp:53
cl_px4_mr::CbLoadKmlMission::onEntry
void onEntry() override
Definition
cb_load_kml_mission.cpp:27
cl_px4_mr::CbLoadKmlMission::kmlLoader_
CpKmlMissionLoader * kmlLoader_
Definition
cb_load_kml_mission.hpp:63
cl_px4_mr::CbLoadKmlMission::CbLoadKmlMission
CbLoadKmlMission(std::string absoluteKmlPath, std::vector< GeoPoint > fallbackBackbone={})
Definition
cb_load_kml_mission.cpp:21
cl_px4_mr::CbLoadKmlMission::onExit
void onExit() override
Definition
cb_load_kml_mission.cpp:64
cl_px4_mr::CbLoadKmlMission::path_
std::string path_
Definition
cb_load_kml_mission.hpp:64
cl_px4_mr::CbLoadKmlMission::fallback_
std::vector< GeoPoint > fallback_
Definition
cb_load_kml_mission.hpp:65
cl_px4_mr::CbLoadKmlMission::setFallback
void setFallback(std::vector< GeoPoint > fallbackBackbone)
Definition
cb_load_kml_mission.hpp:47
cl_px4_mr::CbPx4ClientBehaviorBase
Definition
cb_px4_client_behavior_base.hpp:62
cl_px4_mr::CbPx4ClientBehaviorBase::onStateOrthogonalAllocation
void onStateOrthogonalAllocation()
Definition
cb_px4_client_behavior_base.hpp:65
cl_px4_mr::CpKmlMissionLoader
Definition
cp_kml_mission_loader.hpp:48
smacc2::ISmaccClientBehavior::requiresComponent
void requiresComponent(SmaccComponentType *&storage, ComponentRequirement requirementType=ComponentRequirement::SOFT)
Definition
smacc_client_behavior_impl.hpp:73
geo_utils.hpp
cl_px4_mr
Definition
cl_px4_mr.hpp:30
smacc2::ComponentRequirement::SOFT
@ SOFT
smacc.hpp
Generated by
1.12.0