config_server_node.cpp
Go to the documentation of this file.
1 // Copyright (c) 2021 Pilz GmbH & Co. KG
2 //
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU Lesser General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public License
14 // along with this program. If not, see <https://www.gnu.org/licenses/>.
15 
16 #include <ros/ros.h>
17 
19 #include "psen_scan_v2/ZoneSetConfiguration.h"
23 
24 using namespace psen_scan_v2;
25 using namespace psen_scan_v2_standalone;
26 
27 ConfigServerNode::ConfigServerNode(ros::NodeHandle& nh, const char* config_file_path, const std::string& frame_id)
28  : nh_(nh)
29 {
30  try
31  {
32  auto zoneconfig = configuration::xml_config_parsing::parseFile(config_file_path);
33  zoneset_pub_ = nh_.advertise<::psen_scan_v2::ZoneSetConfiguration>(DEFAULT_ZONESET_TOPIC, 1, true /*latched*/);
34 
36  "ConfigurationServer",
37  "The configuration server doesn't verfiy that the provided configuration file matches the one on the connected "
38  "device! "
39  "Mismatching configurations can amongst other things lead to confusing errors in navigation and misleading "
40  "visualization. "
41  "You are using \"" +
42  std::string(config_file_path) + "\" please make sure that is the one you intented to use.");
43 
44  zoneset_pub_.publish(toRosMsg(zoneconfig, frame_id));
45  }
46  // LCOV_EXCL_START
48  {
49  ROS_ERROR_STREAM_NAMED("ConfigServerNode", e.what());
50  }
51  // LCOV_EXCL_STOP
52 }
#define ROS_ERROR_STREAM_NAMED(name, args)
ConfigServerNode(ros::NodeHandle &nh, const char *config_file_path, const std::string &frame_id)
Contains the events needed to define and implement the scanner protocol.
void publish(const boost::shared_ptr< M > &message) const
Root namespace in which the software components to communicate with the scanner (firmware-version: 2)...
Definition: udp_client.h:41
Root namespace for the ROS part.
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
static const std::string DEFAULT_ZONESET_TOPIC
psen_scan_v2::ZoneSet toRosMsg(const ZoneSetStandalone &zoneset, const std::string &frame_id, const ros::Time &stamp=ros::Time::now())
#define ROS_WARN_STREAM_NAMED(name, args)


psen_scan_v2
Author(s): Pilz GmbH + Co. KG
autogenerated on Sat Nov 5 2022 02:13:36