Easy Navigation
Loading...
Searching...
No Matches
FaultyController.hpp
Go to the documentation of this file.
1// Copyright 2026 Intelligent Robotics Lab
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
17
18#ifndef EASYNAV_CONTROLLER__FAULT_INJECTION__FAULTYCONTROLLER_HPP_
19#define EASYNAV_CONTROLLER__FAULT_INJECTION__FAULTYCONTROLLER_HPP_
20
21#include <string>
22
23#include "geometry_msgs/msg/twist_stamped.hpp"
24
25#include "easynav_core/ControllerMethodBase.hpp"
26
27namespace easynav
28{
29
44class FaultyController : public ControllerMethodBase
45{
46public:
48 void on_initialize() override;
49
51 void update_rt(NavState & nav_state) override;
52
53private:
54 void command(NavState & nav_state, double linear, double angular);
55
56 std::string fault_ {"none"};
57 int fault_after_ {0};
58 double linear_vel_ {0.5};
59 double angular_vel_ {0.0};
60 double hang_time_ {1.0};
61
62 int updates_ {0};
63 geometry_msgs::msg::TwistStamped cmd_vel_;
64};
65
66} // namespace easynav
67
68#endif // EASYNAV_CONTROLLER__FAULT_INJECTION__FAULTYCONTROLLER_HPP_
Controller that misbehaves on purpose, to test how EasyNav copes with it.
Definition FaultyController.hpp:45
void update_rt(NavState &nav_state) override
Commands the constant velocity or injects the fault.
Definition FaultyController.cpp:58
void on_initialize() override
Reads the parameters; throws on an unknown fault.
Definition FaultyController.cpp:33
A generic, type-safe, thread-safe blackboard to hold runtime state.
Definition NavState.hpp:87
Definition CircularBuffer.hpp:24