SMACC2
Loading...
Searching...
No Matches
smacc2_client_library
cl_px4_mr
include
cl_px4_mr
client_behaviors
cb_yaw_scan.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
#pragma once
16
17
#include <
cl_px4_mr/client_behaviors/cb_px4_client_behavior_base.hpp
>
18
19
#include <atomic>
20
#include <chrono>
21
#include <cmath>
22
#include <
smacc2/smacc.hpp
>
23
24
namespace
cl_px4_mr
25
{
26
27
class
CpTrajectorySetpoint;
28
class
CpVehicleLocalPosition;
29
30
// Continuous behavior: hold the entry position while the heading sweeps
31
// sinusoidally around a base heading. Never posts success - the state machine
32
// must provide the exit event (timer orthogonal, mission event, keyboard).
33
// On exit, one final setpoint restores the base heading, so the vehicle always
34
// returns to it regardless of where in the sweep the state change lands.
35
// Posts failure only if local position is invalid at entry.
36
class
CbYawScan
:
public
CbPx4ClientBehaviorBase
37
{
38
public
:
39
CbYawScan
(
40
float
amplitude = 0.6f,
float
period = 6.0f,
41
float
baseHeading = std::numeric_limits<float>::quiet_NaN());
42
43
void
onEntry
()
override
;
44
void
onExit
()
override
;
45
void
update
()
override
;
46
47
private
:
48
float
amplitude_
;
49
float
period_
;
50
float
baseHeading_
;
51
52
float
holdX_
= 0.0f;
53
float
holdY_
= 0.0f;
54
float
holdZ_
= 0.0f;
55
float
elapsed_
= 0.0f;
56
std::atomic<bool>
active_
{
false
};
57
std::chrono::steady_clock::time_point
lastUpdateTime_
;
58
};
59
60
}
// namespace cl_px4_mr
cb_px4_client_behavior_base.hpp
cl_px4_mr::CbPx4ClientBehaviorBase
Definition
cb_px4_client_behavior_base.hpp:62
cl_px4_mr::CbYawScan
Definition
cb_yaw_scan.hpp:37
cl_px4_mr::CbYawScan::lastUpdateTime_
std::chrono::steady_clock::time_point lastUpdateTime_
Definition
cb_yaw_scan.hpp:57
cl_px4_mr::CbYawScan::holdZ_
float holdZ_
Definition
cb_yaw_scan.hpp:54
cl_px4_mr::CbYawScan::baseHeading_
float baseHeading_
Definition
cb_yaw_scan.hpp:50
cl_px4_mr::CbYawScan::onEntry
void onEntry() override
Definition
cb_yaw_scan.cpp:30
cl_px4_mr::CbYawScan::holdX_
float holdX_
Definition
cb_yaw_scan.hpp:52
cl_px4_mr::CbYawScan::update
void update() override
Definition
cb_yaw_scan.cpp:85
cl_px4_mr::CbYawScan::elapsed_
float elapsed_
Definition
cb_yaw_scan.hpp:55
cl_px4_mr::CbYawScan::onExit
void onExit() override
Definition
cb_yaw_scan.cpp:74
cl_px4_mr::CbYawScan::holdY_
float holdY_
Definition
cb_yaw_scan.hpp:53
cl_px4_mr::CbYawScan::CbYawScan
CbYawScan(float amplitude=0.6f, float period=6.0f, float baseHeading=std::numeric_limits< float >::quiet_NaN())
Definition
cb_yaw_scan.cpp:25
cl_px4_mr::CbYawScan::amplitude_
float amplitude_
Definition
cb_yaw_scan.hpp:48
cl_px4_mr::CbYawScan::period_
float period_
Definition
cb_yaw_scan.hpp:49
cl_px4_mr::CbYawScan::active_
std::atomic< bool > active_
Definition
cb_yaw_scan.hpp:56
cl_px4_mr
Definition
cl_px4_mr.hpp:30
smacc.hpp
Generated by
1.12.0