SMACC2
Loading...
Searching...
No Matches
smacc2_client_library
cl_px4_mr
include
cl_px4_mr
client_behaviors
cb_figure_eight.hpp
Go to the documentation of this file.
1
// Copyright 2025 Robosoft 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
#pragma once
16
17
#include <chrono>
18
#include <
cl_px4_mr/client_behaviors/cb_px4_client_behavior_base.hpp
>
19
#include <cmath>
20
#include <
smacc2/smacc.hpp
>
21
22
namespace
cl_px4_mr
23
{
24
25
class
CpTrajectorySetpoint;
26
27
struct
FigureEightParams
28
{
29
float
centerX
= 0.0f;
// NED north, m
30
float
centerY
= 0.0f;
// NED east, m
31
float
altitude
= 5.0f;
// m above the NED origin
32
float
size
= 5.0f;
// m from the centre to a lobe tip
33
float
speed
= 0.5f;
// rate of the curve parameter, rad/s
34
int
numLoops
= 1;
35
};
36
37
class
CbFigureEight
:
public
CbPx4ClientBehaviorBase
38
{
39
public
:
40
explicit
CbFigureEight
(
const
FigureEightParams
& params);
41
42
// Override the centre before onEntry (e.g. from the owning state's
43
// runtimeConfigure when the centre is only known at runtime).
44
void
setCenter
(
float
centerX,
float
centerY)
45
{
46
centerX_
= centerX;
47
centerY_
= centerY;
48
}
49
// Rotate the lobe axis (NED yaw, radians; default 0 = lobes north-south).
50
void
setHeading
(
float
headingRad) {
heading_
= headingRad; }
51
52
void
onEntry
()
override
;
53
void
onExit
()
override
;
54
void
update
()
override
;
55
56
private
:
57
float
centerX_
;
58
float
centerY_
;
59
float
altitude_
;
60
float
size_
;
61
float
speed_
;
62
int
numLoops_
;
63
float
heading_
= 0.0f;
64
65
float
t_
= 0.0f;
66
std::chrono::steady_clock::time_point
lastUpdateTime_
;
67
};
68
69
}
// namespace cl_px4_mr
cb_px4_client_behavior_base.hpp
cl_px4_mr::CbFigureEight
Definition
cb_figure_eight.hpp:38
cl_px4_mr::CbFigureEight::setCenter
void setCenter(float centerX, float centerY)
Definition
cb_figure_eight.hpp:44
cl_px4_mr::CbFigureEight::speed_
float speed_
Definition
cb_figure_eight.hpp:61
cl_px4_mr::CbFigureEight::CbFigureEight
CbFigureEight(const FigureEightParams ¶ms)
Definition
cb_figure_eight.cpp:21
cl_px4_mr::CbFigureEight::heading_
float heading_
Definition
cb_figure_eight.hpp:63
cl_px4_mr::CbFigureEight::update
void update() override
Definition
cb_figure_eight.cpp:52
cl_px4_mr::CbFigureEight::size_
float size_
Definition
cb_figure_eight.hpp:60
cl_px4_mr::CbFigureEight::numLoops_
int numLoops_
Definition
cb_figure_eight.hpp:62
cl_px4_mr::CbFigureEight::altitude_
float altitude_
Definition
cb_figure_eight.hpp:59
cl_px4_mr::CbFigureEight::onExit
void onExit() override
Definition
cb_figure_eight.cpp:50
cl_px4_mr::CbFigureEight::lastUpdateTime_
std::chrono::steady_clock::time_point lastUpdateTime_
Definition
cb_figure_eight.hpp:66
cl_px4_mr::CbFigureEight::setHeading
void setHeading(float headingRad)
Definition
cb_figure_eight.hpp:50
cl_px4_mr::CbFigureEight::centerX_
float centerX_
Definition
cb_figure_eight.hpp:57
cl_px4_mr::CbFigureEight::centerY_
float centerY_
Definition
cb_figure_eight.hpp:58
cl_px4_mr::CbFigureEight::onEntry
void onEntry() override
Definition
cb_figure_eight.cpp:31
cl_px4_mr::CbFigureEight::t_
float t_
Definition
cb_figure_eight.hpp:65
cl_px4_mr::CbPx4ClientBehaviorBase
Definition
cb_px4_client_behavior_base.hpp:62
cl_px4_mr
Definition
cl_px4_mr.hpp:31
smacc.hpp
cl_px4_mr::FigureEightParams
Definition
cb_figure_eight.hpp:28
cl_px4_mr::FigureEightParams::numLoops
int numLoops
Definition
cb_figure_eight.hpp:34
cl_px4_mr::FigureEightParams::centerY
float centerY
Definition
cb_figure_eight.hpp:30
cl_px4_mr::FigureEightParams::size
float size
Definition
cb_figure_eight.hpp:32
cl_px4_mr::FigureEightParams::altitude
float altitude
Definition
cb_figure_eight.hpp:31
cl_px4_mr::FigureEightParams::centerX
float centerX
Definition
cb_figure_eight.hpp:29
cl_px4_mr::FigureEightParams::speed
float speed
Definition
cb_figure_eight.hpp:33
Generated by
1.12.0