00001 /* -*- mode: C++ -*- 00002 * 00003 * Copyright (C) 2011 Austin Robot Technology 00004 * License: Modified BSD Software License Agreement 00005 * 00006 * $Id: ObserversConfig.h 1909 2011-12-05 23:31:31Z jack.oquin $ 00007 */ 00008 00020 #ifndef _OBSERVERS_CONFIG_H_ 00021 #define _OBSERVERS_CONFIG_H_ 00022 00023 #include <ros/ros.h> 00024 #include <tf/transform_listener.h> 00025 00026 namespace art_observers 00027 { 00028 00029 // Hand-written configuration class for observers. 00030 class ObserversConfig 00031 { 00032 public: 00034 ObserversConfig(): 00035 map_frame_id(std::string("/map")), 00036 robot_frame_id(std::string("vehicle")) 00037 {}; 00038 ObserversConfig(const ObserversConfig &that) 00039 { 00040 *this = that; 00041 }; 00042 ObserversConfig(ros::NodeHandle priv_nh) 00043 { 00044 // get configuration parameters 00045 priv_nh.param("map_frame_id", map_frame_id, std::string("/map")); 00046 priv_nh.param("robot_frame_id", robot_frame_id, std::string("vehicle")); 00047 00048 // apply tf_prefix to robot frame ID, if needed 00049 std::string tf_prefix = tf::getPrefixParam(priv_nh); 00050 robot_frame_id = tf::resolve(tf_prefix, robot_frame_id); 00051 00052 ROS_INFO_STREAM("map frame: " << map_frame_id 00053 << ", robot frame: " << robot_frame_id); 00054 }; 00055 00056 std::string map_frame_id; 00057 std::string robot_frame_id; 00058 }; 00059 00060 }; // namespace art_observers 00061 00062 #endif // _OBSERVERS_CONFIG_H_