00001 /****************************************************************************** 00002 * * 00003 * parameter_pa_node.cpp * 00004 * ===================== * 00005 * * 00006 ******************************************************************************* 00007 * * 00008 * github repository * 00009 * https://github.com/TUC-ProAut/ros_parameter * 00010 * * 00011 * Chair of Automation Technology, Technische Universität Chemnitz * 00012 * https://www.tu-chemnitz.de/etit/proaut * 00013 * * 00014 ******************************************************************************* 00015 * * 00016 * New BSD License * 00017 * * 00018 * Copyright (c) 2015-2018, Peter Weissig, Technische Universität Chemnitz * 00019 * All rights reserved. * 00020 * * 00021 * Redistribution and use in source and binary forms, with or without * 00022 * modification, are permitted provided that the following conditions are met: * 00023 * * Redistributions of source code must retain the above copyright * 00024 * notice, this list of conditions and the following disclaimer. * 00025 * * Redistributions in binary form must reproduce the above copyright * 00026 * notice, this list of conditions and the following disclaimer in the * 00027 * documentation and/or other materials provided with the distribution. * 00028 * * Neither the name of the Technische Universität Chemnitz nor the * 00029 * names of its contributors may be used to endorse or promote products * 00030 * derived from this software without specific prior written permission. * 00031 * * 00032 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * 00033 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * 00034 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * 00035 * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * 00036 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * 00037 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * 00038 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * 00039 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * 00040 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * 00041 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * 00042 * DAMAGE. * 00043 * * 00044 ******************************************************************************/ 00045 00046 // local headers 00047 #include "parameter_pa/parameter_pa_node.h" 00048 #include "parameter_pa/parameter_pa_ros.h" 00049 00050 // standard headers 00051 #include <string> 00052 #include <math.h> 00053 00054 //**************************[main]********************************************* 00055 int main(int argc, char **argv) { 00056 00057 ros::init(argc, argv, "pcd_filter_pa_node"); 00058 cParameterPaNode pcd_filter; 00059 00060 ros::spin(); 00061 00062 return 0; 00063 } 00064 00065 //**************************[cParameterPaNode]********************************* 00066 cParameterPaNode::cParameterPaNode() { 00067 00068 cParameterPaRos paramloader; 00069 std::string str_service = paramloader.resolveRessourcename("~/"); 00070 00071 // service for path substitution 00072 ser_path_ = nh_.advertiseService( str_service + "substitutePath", 00073 &cParameterPaNode::substitutePathCallbackSrv, this); 00074 // service for ressource name substitution 00075 ser_ressource_ = nh_.advertiseService( 00076 str_service + "substituteRessource", 00077 &cParameterPaNode::substituteNameCallbackSrv, this); 00078 } 00079 00080 //**************************[~cParameterPaNode]******************************** 00081 cParameterPaNode::~cParameterPaNode() { 00082 00083 } 00084 00085 //**************************[substitutePathCallbackSrv]************************* 00086 bool cParameterPaNode::substitutePathCallbackSrv( 00087 parameter_pa::ParameterPaString::Request &req, 00088 parameter_pa::ParameterPaString::Response &res) { 00089 00090 std::string str = req.in_string; 00091 res.ok = cParameterPaRos::replaceFindpack(str); 00092 res.out_string = str; 00093 00094 return true; 00095 } 00096 00097 //**************************[substituteNameCallbackSrv]************************* 00098 bool cParameterPaNode::substituteNameCallbackSrv( 00099 parameter_pa::ParameterPaString::Request &req, 00100 parameter_pa::ParameterPaString::Response &res) { 00101 00102 res.out_string = cParameterPaRos::resolveRessourcename(req.in_string); 00103 res.ok = true; 00104 00105 return true; 00106 }