SMACC2
Loading...
Searching...
No Matches
smacc2_client_library
cl_px4_mr
src
cl_px4_mr
client_behaviors
cb_ascend_to_altitude.cpp
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
#include <
cl_px4_mr/client_behaviors/cb_ascend_to_altitude.hpp
>
22
23
#include <algorithm>
24
25
namespace
cl_px4_mr
26
{
27
28
CbAscendToAltitude::CbAscendToAltitude
(
29
FlightPatternAscendParams
params,
PathFollowerParams
follower)
30
:
CbPx4PathFollowerBase
(follower), params_(params)
31
{
32
}
33
34
CbAscendToAltitude::CbAscendToAltitude
(
float
altitudeAgl,
float
climbRate)
35
:
CbPx4PathFollowerBase
(
PathFollowerParams
{})
36
{
37
params_
.
altitudeAgl
= altitudeAgl;
38
params_
.
climbRate
= climbRate;
39
}
40
41
std::vector<NedPoint>
CbAscendToAltitude::buildPath
(
const
NedPoint
& current)
42
{
43
// vertical move: speed = climb rate, keep heading, no prepend (path already
44
// starts at the current position), leash sized for the climb rate
45
followerParams_
.
groundSpeed
= std::max(
params_
.
climbRate
, 0.1f);
46
followerParams_
.
leash
= std::max(
followerParams_
.
leash
, 2.0f *
followerParams_
.
groundSpeed
);
47
followerParams_
.
yawMode
=
YawMode::HOLD_ENTRY
;
48
followerParams_
.
prependCurrentPosition
=
false
;
49
followerParams_
.
arrivalZTol
= std::min(
followerParams_
.
arrivalZTol
,
params_
.
tolerance
);
50
51
RCLCPP_INFO(
52
getLogger
(),
"CbAscendToAltitude: %.1f m AGL -> %.1f m AGL at %.1f m/s"
, -current.
z
,
53
params_
.
altitudeAgl
,
followerParams_
.
groundSpeed
);
54
return
generateFlightPatternAscend
(
params_
, current);
55
}
56
57
}
// namespace cl_px4_mr
cb_ascend_to_altitude.hpp
cl_px4_mr::CbAscendToAltitude::CbAscendToAltitude
CbAscendToAltitude(FlightPatternAscendParams params={}, PathFollowerParams follower={})
Definition
cb_ascend_to_altitude.cpp:28
cl_px4_mr::CbAscendToAltitude::buildPath
std::vector< NedPoint > buildPath(const NedPoint ¤t) override
Definition
cb_ascend_to_altitude.cpp:41
cl_px4_mr::CbAscendToAltitude::params_
FlightPatternAscendParams params_
Definition
cb_ascend_to_altitude.hpp:53
cl_px4_mr::CbPx4PathFollowerBase
Definition
cb_px4_path_follower_base.hpp:77
cl_px4_mr::CbPx4PathFollowerBase::followerParams_
PathFollowerParams followerParams_
Definition
cb_px4_path_follower_base.hpp:103
smacc2::ISmaccClientBehavior::getLogger
virtual rclcpp::Logger getLogger() const
Definition
smacc_client_behavior_base.cpp:43
cl_px4_mr
Definition
cl_px4_mr.hpp:30
cl_px4_mr::generateFlightPatternAscend
std::vector< NedPoint > generateFlightPatternAscend(const FlightPatternAscendParams &p, const NedPoint ¤t)
Definition
pattern_generators.cpp:32
cl_px4_mr::YawMode::HOLD_ENTRY
@ HOLD_ENTRY
cl_px4_mr::FlightPatternAscendParams
Definition
pattern_generators.hpp:73
cl_px4_mr::FlightPatternAscendParams::tolerance
float tolerance
Definition
pattern_generators.hpp:76
cl_px4_mr::FlightPatternAscendParams::altitudeAgl
float altitudeAgl
Definition
pattern_generators.hpp:74
cl_px4_mr::FlightPatternAscendParams::climbRate
float climbRate
Definition
pattern_generators.hpp:75
cl_px4_mr::NedPoint
Definition
geo_utils.hpp:52
cl_px4_mr::NedPoint::z
float z
Definition
geo_utils.hpp:55
cl_px4_mr::PathFollowerParams
Definition
cb_px4_path_follower_base.hpp:43
cl_px4_mr::PathFollowerParams::yawMode
YawMode yawMode
Definition
cb_px4_path_follower_base.hpp:52
cl_px4_mr::PathFollowerParams::prependCurrentPosition
bool prependCurrentPosition
Definition
cb_px4_path_follower_base.hpp:54
cl_px4_mr::PathFollowerParams::groundSpeed
float groundSpeed
Definition
cb_px4_path_follower_base.hpp:44
cl_px4_mr::PathFollowerParams::arrivalZTol
float arrivalZTol
Definition
cb_px4_path_follower_base.hpp:51
cl_px4_mr::PathFollowerParams::leash
float leash
Definition
cb_px4_path_follower_base.hpp:49
Generated by
1.12.0