SMACC2
Loading...
Searching...
No Matches
cb_assisted_teleop.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 <nav2_msgs/action/assisted_teleop.hpp>
19
20namespace cl_nav2z
21{
22
23// Collision-guarded teleoperation via the Nav2 behavior server's
24// AssistedTeleop action: incoming teleop velocity commands are projected
25// through the local costmap and scaled/zeroed before a collision. A positive
26// time allowance bounds the session (the server reports expiry as an abort
27// with the TIMEOUT code, which this wrapper maps to EvCbSuccess - the window
28// running its course is the normal ending). A zero allowance disables the
29// server-side timeout: the session runs until the state exits, which cancels
30// the action through the behavior base.
32 nav2_msgs::action::AssistedTeleop>
33{
34public:
35 explicit CbAssistedTeleop(std::chrono::seconds timeAllowance = std::chrono::seconds(30));
36
37 void onEntry() override;
38
39protected:
40 // The server reports time-allowance expiry as an abort (error code TIMEOUT)
41 // - but for this action the window running its course IS the normal ending,
42 // so map it to success. Genuine failures (TF_ERROR, rejection) keep failing.
43 void onActionAbort(const WrappedResult & result) override;
44
45private:
46 std::chrono::seconds timeAllowance_;
47};
48
49} // namespace cl_nav2z
CbAssistedTeleop(std::chrono::seconds timeAllowance=std::chrono::seconds(30))
void onActionAbort(const WrappedResult &result) override
std::chrono::seconds timeAllowance_