rawlog_play.cpp
Go to the documentation of this file.
00001 /* +---------------------------------------------------------------------------+
00002    | rawlog_play                                                               |
00003    |   Copyright (C) 2010-2011  University of Malaga                           |
00004    |                                                                           |
00005    |    This software was written by the Machine Perception and Intelligent    |
00006    |      Robotics Lab, University of Malaga (Spain).                          |
00007    |    Contact: Jose-Luis Blanco  <jlblanco@ctima.uma.es>                     |
00008    |                                                                           |
00009    | rawlog_play is free software: you can redistribute it and/or modify       |
00010    |     it under the terms of the GNU General Public License as published by  |
00011    |     the Free Software Foundation, either version 3 of the License, or     |
00012    |     (at your option) any later version.                                   |
00013    |                                                                           |
00014    |   rawlog_play is distributed in the hope that it will be useful,          |
00015    |     but WITHOUT ANY WARRANTY; without even the implied warranty of        |
00016    |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         |
00017    |     GNU General Public License for more details.                          |
00018    |                                                                           |
00019    |     You should have received a copy of the GNU General Public License     |
00020    |     along with rawlog_play.  If not, see <http://www.gnu.org/licenses/>.  |
00021    |                                                                           |
00022    +---------------------------------------------------------------------------+ */
00023 
00024 /* Author: Jose Luis Blanco     */
00025 
00061 #include <ros/ros.h>
00062 #include <list>
00063 #include <sstream>
00064 
00065 #include <std_msgs/String.h>
00066 
00067 // My own services:
00068 #include <rawlog_play/SetRawlogFile.h>
00069 #include <rawlog_play/Play.h>
00070 #include <rawlog_play/Pause.h>
00071 #include <rawlog_play/Resume.h>
00072 
00073 // mrpt<->ros converter classes
00074 #include <mrpt_bridge/laser_scan.h>
00075 
00076 #include <mrpt/utils/CFileGZInputStream.h>
00077 
00078 using namespace std;
00079 using namespace mrpt::utils;
00080 
00081 
00082 /*************************************************
00083                         Global vars
00084 *************************************************/
00085 string              rawlog_fil;
00086 CFileGZInputStream  rawlog_fil_stream;
00087 
00088 /*************************************************
00089  Service: SetRawlogFile
00090 *************************************************/
00091 bool srv_setrawlogfile(rawlog_play::SetRawlogFile::Request  &req,
00092          rawlog_play::SetRawlogFile::Response &res )
00093 {
00094 //  ROS_INFO("sending back response: [%ld]", (long int)res.sum);
00095   return true;
00096 }
00097 
00098 
00099 /*************************************************
00100                    main
00101 *************************************************/
00102 int main(int argc, char **argv)
00103 {
00104         // Initialize ROS
00105         ros::init(argc, argv, "rawlog_play");
00106 
00107         // Read parameters
00108         ros::NodeHandle private_nh_("~");
00109         if (!private_nh_.getParam(string("rawlog_file"),rawlog_fil))
00110         {
00111                 // None provided.
00112         }
00113 
00114         // NodeHandle is the main access point to communications with the ROS system.
00115         ros::NodeHandle node;
00116 
00117         // Create services:
00118         ros::ServiceServer srv1 = node.advertiseService("set_rawlog_file", srv_setrawlogfile);
00119 
00120 
00121         // The list of published topics:
00122         std::list<ros::Publisher> pub_topics;
00123         pub_topics.push_back( node.advertise<std_msgs::String>("chatter", 1000) );
00124 
00125         ros::Rate loop_rate(1000);  // max. loop rate in Hz
00126 
00127         while (ros::ok())
00128         {
00129                 std_msgs::String msg;
00130 
00131                 std::stringstream ss;
00132                 ss << "hello world ";
00133                 msg.data = ss.str();
00134 
00135                 ROS_INFO("%s", msg.data.c_str());
00136 
00137                 pub_topics.begin()->publish(msg);
00138 
00139                 // End of loop.
00140                 ros::spinOnce();
00141                 loop_rate.sleep();
00142         }
00143 
00144 
00145         return 0; // all ok.
00146 }


rawlog_play
Author(s):
autogenerated on Sat Jul 26 2014 10:39:05