00001 /* 00002 * Copyright (c) 2010 Oscar Martinez Mozos <omozos@googlemail.com> 00003 * Dejan Pangercic <pangercic -=- cs.tum.edu> (ROS maintaniner) 00004 * 00005 * All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions are met: 00009 * 00010 * * Redistributions of source code must retain the above copyright 00011 * notice, this list of conditions and the following disclaimer. 00012 * * Redistributions in binary form must reproduce the above copyright 00013 * notice, this list of conditions and the following disclaimer in the 00014 * documentation and/or other materials provided with the distribution. 00015 * 00016 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00017 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00018 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00019 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00020 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00021 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00022 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00023 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00024 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00025 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00026 * POSSIBILITY OF SUCH DAMAGE. 00027 * 00028 * 00029 */ 00030 00043 //standards 00044 #include <iostream> 00045 #include <float.h> 00046 00047 //ROS 00048 #include <ros/ros.h> 00049 #include <ros/node_handle.h> 00050 #include <sensor_msgs/LaserScan.h> 00051 00052 using namespace std; 00053 00054 00055 class TestNode 00056 { 00057 public: 00058 ros::NodeHandle nh_; 00059 //Subscribers/Publishers 00060 ros::Subscriber scan_; 00061 //Parameters 00062 string input_scan_topic_; 00063 int scan_id_; // identifier for the scans 00064 00065 00069 TestNode() : nh_("~") 00070 { 00071 nh_.param("input_scan_topic", input_scan_topic_, std::string("/shoulder_scan")); 00072 scan_ = nh_.subscribe<sensor_msgs::LaserScan>(input_scan_topic_, 10, &TestNode::scan_cb, this); 00073 } 00074 00078 ~TestNode() 00079 { 00080 } 00081 00086 void scan_cb(const sensor_msgs::LaserScan::ConstPtr &msg) 00087 { 00088 ROS_INFO("Intensities and Ranges size: %ld | %ld", msg->ranges.size(), msg->intensities.size()); 00089 } 00090 //end TestNode 00091 00092 }; 00093 00094 00095 /* ---[ */ 00096 int main (int argc, char** argv) 00097 { 00098 00099 ros::init (argc, argv, "test_node"); 00100 TestNode lg_node; 00101 ros::spin (); 00102 return (0); 00103 } 00104 /* ]--- */ 00105