SMACC2
Loading...
Searching...
No Matches
cb_follow_ned_path.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
24
25#include <vector>
26
27namespace cl_px4_mr
28{
29
30// Streams a caller-supplied NED polyline through the carrot follower: one
31// continuous, leashed flight along a route of arbitrary vertices (a cave
32// passage, a survey line, a retrace of an earlier route) instead of a chain
33// of CbGoToLocation states or CbFollowWaypoints' setpoint jumps.
34//
35// The route is given at construction or via setPath() from the owning state's
36// runtimeConfigure (state machine thread, before onEntry). reachedCount() is
37// the number of route vertices the carrot has passed; a state reads it in its
38// onExit (state machine thread, updates barred) to record how far the vehicle
39// got, e.g. to retrace only the traversed prefix on an abort.
41{
42public:
43 explicit CbFollowNedPath(std::vector<NedPoint> path = {}, PathFollowerParams follower = {});
44
45 void setPath(std::vector<NedPoint> path);
46 const std::vector<NedPoint> & path() const { return path_; }
47
48 // route vertices passed by the carrot, 0..path().size(); == path().size()
49 // once the path completed
50 size_t reachedCount() const;
51
52protected:
53 std::vector<NedPoint> buildPath(const NedPoint & /*current*/) override { return path_; }
54 const char * behaviorName() const override { return "CbFollowNedPath"; }
55
56private:
57 std::vector<NedPoint> path_;
58};
59
60} // namespace cl_px4_mr
CbFollowNedPath(std::vector< NedPoint > path={}, PathFollowerParams follower={})
const std::vector< NedPoint > & path() const
const char * behaviorName() const override
void setPath(std::vector< NedPoint > path)
std::vector< NedPoint > path_
std::vector< NedPoint > buildPath(const NedPoint &) override