Easy Navigation
Loading...
Searching...
No Matches
VelocityMux.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__VELOCITYMUX_HPP_
19#define EASYNAV_CONTROLLER__VELOCITYMUX_HPP_
20
21#include "geometry_msgs/msg/twist_stamped.hpp"
22
24#include "easynav_core/SafetyChannel.hpp"
25#include "easynav_core/VelocityCommand.hpp"
26
27namespace easynav
28{
29
44{
45public:
47 enum class Choice {NONE, CONTROLLER, PAUSED, TAKEOVER, OVERRIDE, SAFETY_STOP, INHIBITED};
48
50 struct Selection
51 {
52 geometry_msgs::msg::TwistStamped cmd;
54 bool fresh {false};
55 bool smooth {true};
56 };
57
59 Selection select(NavState & nav_state);
60
62 void reset()
63 {
64 last_target_ = geometry_msgs::msg::TwistStamped();
65 last_choice_ = Choice::NONE;
66 }
67
68private:
69 geometry_msgs::msg::TwistStamped last_target_;
70 Choice last_choice_ {Choice::NONE};
71};
72
73} // namespace easynav
74
75#endif // EASYNAV_CONTROLLER__VELOCITYMUX_HPP_
A blackboard-like structure to hold the current state of the navigation system.
A generic, type-safe, thread-safe blackboard to hold runtime state.
Definition NavState.hpp:87
Decides, every RT cycle, which velocity command is sent to the robot.
Definition VelocityMux.hpp:44
Selection select(NavState &nav_state)
Takes this cycle's proposals from nav_state and selects the command.
Definition VelocityMux.cpp:32
Choice
Who the selected command comes from.
Definition VelocityMux.hpp:47
@ NONE
Definition VelocityMux.hpp:47
void reset()
Forgets the last target (e.g. on activation).
Definition VelocityMux.hpp:62
Definition CircularBuffer.hpp:24
This cycle's selection.
Definition VelocityMux.hpp:51
bool smooth
Whether it must go through the smoother.
Definition VelocityMux.hpp:55
geometry_msgs::msg::TwistStamped cmd
Target command.
Definition VelocityMux.hpp:52
Choice choice
Who it comes from.
Definition VelocityMux.hpp:53
bool fresh
A new command was proposed this cycle.
Definition VelocityMux.hpp:54