SMACC2
Loading...
Searching...
No Matches
smacc2_client_library
cl_px4_mr
src
cl_px4_mr
client_behaviors
cb_sine_wave_vertical.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_sine_wave_vertical.hpp
>
22
23
namespace
cl_px4_mr
24
{
25
26
CbSineWaveVertical::CbSineWaveVertical
(
27
FlightPatternSineWaveVerticalParams
params,
PathFollowerParams
follower)
28
:
CbPx4PathFollowerBase
(follower), params_(params)
29
{
30
}
31
32
std::vector<NedPoint>
CbSineWaveVertical::buildPath
(
const
NedPoint
& current)
33
{
34
followerParams_
.
yawMode
=
YawMode::TANGENT
;
35
followerParams_
.
prependCurrentPosition
=
false
;
// path starts at the entry point
36
37
const
float
peakVerticalSpeed =
params_
.
amplitude
* 2.0f *
static_cast<
float
>
(M_PI) *
38
followerParams_
.
groundSpeed
/ std::max(
params_
.
wavelength
, 0.1f);
39
if
(peakVerticalSpeed > 2.0f)
40
{
41
RCLCPP_WARN(
42
getLogger
(),
43
"CbSineWaveVertical: peak vertical speed %.2f m/s exceeds typical PX4 limits - the flown "
44
"sine will flatten"
,
45
peakVerticalSpeed);
46
}
47
RCLCPP_INFO(
48
getLogger
(),
"CbSineWaveVertical: to (%.1f, %.1f), A=%.1f m, lambda=%.1f m"
,
params_
.
endX
,
49
params_
.
endY
,
params_
.
amplitude
,
params_
.
wavelength
);
50
return
generateFlightPatternSineWaveVertical
(
params_
, current);
51
}
52
53
}
// namespace cl_px4_mr
cb_sine_wave_vertical.hpp
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
cl_px4_mr::CbSineWaveVertical::params_
FlightPatternSineWaveVerticalParams params_
Definition
cb_sine_wave_vertical.hpp:51
cl_px4_mr::CbSineWaveVertical::buildPath
std::vector< NedPoint > buildPath(const NedPoint ¤t) override
Definition
cb_sine_wave_vertical.cpp:32
cl_px4_mr::CbSineWaveVertical::CbSineWaveVertical
CbSineWaveVertical(FlightPatternSineWaveVerticalParams params={}, PathFollowerParams follower={})
Definition
cb_sine_wave_vertical.cpp:26
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::generateFlightPatternSineWaveVertical
std::vector< NedPoint > generateFlightPatternSineWaveVertical(const FlightPatternSineWaveVerticalParams &p, const NedPoint ¤t)
Definition
pattern_generators.cpp:117
cl_px4_mr::YawMode::TANGENT
@ TANGENT
cl_px4_mr::FlightPatternSineWaveVerticalParams
Definition
pattern_generators.hpp:104
cl_px4_mr::FlightPatternSineWaveVerticalParams::wavelength
float wavelength
Definition
pattern_generators.hpp:109
cl_px4_mr::FlightPatternSineWaveVerticalParams::endX
float endX
Definition
pattern_generators.hpp:105
cl_px4_mr::FlightPatternSineWaveVerticalParams::amplitude
float amplitude
Definition
pattern_generators.hpp:108
cl_px4_mr::FlightPatternSineWaveVerticalParams::endY
float endY
Definition
pattern_generators.hpp:106
cl_px4_mr::NedPoint
Definition
geo_utils.hpp:52
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
Generated by
1.12.0