Easy Navigation
Loading...
Searching...
No Matches
ParameterFreezer.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_SYSTEM__SAFETY__PARAMETERFREEZER_HPP_
19#define EASYNAV_SYSTEM__SAFETY__PARAMETERFREEZER_HPP_
20
21#include <atomic>
22#include <map>
23#include <mutex>
24#include <string>
25#include <vector>
26
27#include "rclcpp/rclcpp.hpp"
28
30
31namespace easynav::safety
32{
33
42{
43public:
45 void freeze(const Nodes & nodes);
46
48 [[nodiscard]] bool is_frozen() const {return !handles_.empty();}
49
51 void accept_new_parameters(bool accept) {accept_new_ = accept;}
52
53private:
55 std::map<std::string, std::map<std::string, rclcpp::ParameterValue>> frozen_;
56 std::mutex mutex_;
57 std::atomic<bool> accept_new_ {true};
58 std::vector<rclcpp::node_interfaces::OnSetParametersCallbackHandle::SharedPtr> handles_;
59};
60
61} // namespace easynav::safety
62
63#endif // EASYNAV_SYSTEM__SAFETY__PARAMETERFREEZER_HPP_
Fingerprint (dump and SHA-256) of the EasyNav configuration.
Rejects any change to the parameters of a set of nodes.
Definition ParameterFreezer.hpp:42
void accept_new_parameters(bool accept)
Whether parameters not frozen yet may be declared (on by default).
Definition ParameterFreezer.hpp:51
bool is_frozen() const
Whether anything was frozen.
Definition ParameterFreezer.hpp:48
void freeze(const Nodes &nodes)
Freezes the current values of nodes. Called again, refreezes them.
Definition ParameterFreezer.cpp:27
Definition CommandGuard.hpp:36
std::map< std::string, rclcpp_lifecycle::LifecycleNode::SharedPtr > Nodes
EasyNav nodes by name.
Definition ConfigurationFingerprint.hpp:30
std::mutex Singleton< C >::mutex_
Definition Singleton.hpp:80