Easy Navigation
Toggle main menu visibility
Loading...
Searching...
No Matches
easynav_localizer
include
easynav_localizer
fault_injection
FaultyLocalizer.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_LOCALIZER__FAULT_INJECTION__FAULTYLOCALIZER_HPP_
19
#define EASYNAV_LOCALIZER__FAULT_INJECTION__FAULTYLOCALIZER_HPP_
20
21
#include <string>
22
23
#include "nav_msgs/msg/odometry.hpp"
24
25
#include "easynav_core/LocalizerMethodBase.hpp"
26
27
namespace
easynav
28
{
29
44
class
FaultyLocalizer
:
public
LocalizerMethodBase
45
{
46
public
:
48
void
on_initialize
()
override
;
49
51
void
update_rt
(
NavState
& nav_state)
override
;
52
54
void
update
([[maybe_unused]]
NavState
& nav_state)
override
{}
55
56
private
:
57
void
publish(
NavState
& nav_state,
double
x,
double
y,
double
yaw);
58
59
std::string fault_ {
"none"
};
60
int
fault_after_ {0};
61
double
x_ {0.0};
62
double
y_ {0.0};
63
double
yaw_ {0.0};
64
double
hang_time_ {1.0};
65
double
jump_distance_ {1.0};
66
67
int
updates_ {0};
68
nav_msgs::msg::Odometry pose_;
69
};
70
71
}
// namespace easynav
72
73
#endif
// EASYNAV_LOCALIZER__FAULT_INJECTION__FAULTYLOCALIZER_HPP_
easynav::FaultyLocalizer
Localizer that misbehaves on purpose, to test how EasyNav copes with it.
Definition
FaultyLocalizer.hpp:45
easynav::FaultyLocalizer::update
void update(NavState &nav_state) override
Nothing: everything happens in update_rt().
Definition
FaultyLocalizer.hpp:54
easynav::FaultyLocalizer::update_rt
void update_rt(NavState &nav_state) override
Localizes or injects the fault.
Definition
FaultyLocalizer.cpp:62
easynav::FaultyLocalizer::on_initialize
void on_initialize() override
Reads the parameters; throws on an unknown fault.
Definition
FaultyLocalizer.cpp:33
easynav::NavState
A generic, type-safe, thread-safe blackboard to hold runtime state.
Definition
NavState.hpp:87
easynav
Definition
CircularBuffer.hpp:24
Generated by
1.18.0