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 }
psen_scan_v2::ConfigServerNode::nh_
ros::NodeHandle nh_
Definition: config_server_node.h:45
ros.h
config_server_node.h
ros::Publisher::publish
void publish(const boost::shared_ptr< M > &message) const
ros::NodeHandle::advertise
Publisher advertise(AdvertiseOptions &ops)
psen_scan_v2_standalone::configuration::xml_config_parsing::XMLConfigurationParserException
Definition: xml_configuration_parsing.h:36
psen_scan_v2::ConfigServerNode::zoneset_pub_
ros::Publisher zoneset_pub_
Definition: config_server_node.h:46
zoneset_configuration.h
psen_scan_v2
Root namespace for the ROS part.
Definition: active_zoneset_node.h:29
ROS_ERROR_STREAM_NAMED
#define ROS_ERROR_STREAM_NAMED(name, args)
zoneset_configuration_ros_conversion.h
ROS_WARN_STREAM_NAMED
#define ROS_WARN_STREAM_NAMED(name, args)
psen_scan_v2_standalone::configuration::xml_config_parsing::parseFile
ZoneSetConfiguration parseFile(const char *filename)
Definition: xml_configuration_parsing.cpp:487
xml_configuration_parsing.h
psen_scan_v2_standalone
Root namespace in which the software components to communicate with the scanner (firmware-version: 2)...
Definition: udp_client.h:41
psen_scan_v2::ConfigServerNode::ConfigServerNode
ConfigServerNode(ros::NodeHandle &nh, const char *config_file_path, const std::string &frame_id)
Definition: config_server_node.cpp:27
toRosMsg
psen_scan_v2::ZoneSet toRosMsg(const ZoneSetStandalone &zoneset, const std::string &frame_id, const ros::Time &stamp=ros::Time::now())
Definition: zoneset_configuration_ros_conversion.h:63
psen_scan_v2::DEFAULT_ZONESET_TOPIC
static const std::string DEFAULT_ZONESET_TOPIC
Definition: config_server_node.h:33
psen_scan_v2_standalone::protocol_layer::scanner_events
Contains the events needed to define and implement the scanner protocol.
Definition: scanner_events.h:30
ros::NodeHandle


psen_scan_v2
Author(s): Pilz GmbH + Co. KG
autogenerated on Sat Jun 22 2024 02:46:11