Read config from file.
This commit is contained in:
1 parent
c38407bbd8
commit
ef9c5f6656
5 files changed
+77
-6
No files matched your search
+5
-5
@@ -18,17 +18,17 @@ namespace j7s
|
||||
|
||||
ZenohBridge::ZenohBridge(const rclcpp::NodeOptions & options) : Node("zenoh_bridge", options)
|
||||
{
|
||||
// Should this be from a file?
|
||||
// TODO: static inline Config from_file(const std::string &path, ZResult *err = nullptr)
|
||||
auto config = zenoh::Config::create_default();
|
||||
m_zenohSession = std::make_shared<zenoh::Session>(std::move(config));
|
||||
|
||||
const auto emptyVector = std::vector<std::string>();
|
||||
const auto zenohSourceNames =
|
||||
this->declare_parameter<std::vector<std::string>>("zenoh_sources", emptyVector);
|
||||
const auto rosSourceNames =
|
||||
this->declare_parameter<std::vector<std::string>>("ros_sources", emptyVector);
|
||||
|
||||
const auto zenohConfigPath = this->declare_parameter<std::string>("zenoh_config_path");
|
||||
auto config = zenoh::Config::from_file(zenohConfigPath);
|
||||
m_zenohSession = std::make_shared<zenoh::Session>(std::move(config));
|
||||
|
||||
|
||||
// Make all the zenoh subs.
|
||||
for (const auto & source : zenohSourceNames)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Copyright 2026 James Pace
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
//
|
||||
// This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
// defined by the Mozilla Public License, v. 2.0.
|
||||
//
|
||||
#include <fmt/core.h>
|
||||
#include "zenoh.hxx"
|
||||
|
||||
|
||||
int main(int, char **)
|
||||
{
|
||||
const auto config = zenoh::Config::create_default();
|
||||
const auto configJson = config.to_string();
|
||||
std::cout << configJson << std::endl;
|
||||
}
|
||||
Reference in new issue
Block a user