sick_tim3xx_common.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2013, Osnabrück University
00003  * All rights reserved.
00004  * 
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions are met:
00007  * 
00008  *     * Redistributions of source code must retain the above copyright
00009  *       notice, this list of conditions and the following disclaimer.
00010  *     * Redistributions in binary form must reproduce the above copyright
00011  *       notice, this list of conditions and the following disclaimer in the
00012  *       documentation and/or other materials provided with the distribution.
00013  *     * Neither the name of Osnabrück University nor the names of its
00014  *       contributors may be used to endorse or promote products derived from
00015  *       this software without specific prior written permission.
00016  * 
00017  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00021  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00022  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00023  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00024  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00025  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00026  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00027  * POSSIBILITY OF SUCH DAMAGE.
00028  *
00029  *  Created on: 24.05.2012
00030  *
00031  *      Authors:
00032  *         Jochen Sprickerhof <jochen@sprickerhof.de>
00033  *         Martin Günther <mguenthe@uos.de>
00034  *
00035  * Based on the TiM communication example by SICK AG.
00036  *
00037  */
00038 
00039 #ifndef SICK_TIM3XX_COMMON_H_
00040 #define SICK_TIM3XX_COMMON_H_
00041 
00042 #include <stdio.h>
00043 #include <stdlib.h>
00044 #include <string.h>
00045 #include <vector>
00046 
00047 #include <ros/ros.h>
00048 #include <sensor_msgs/LaserScan.h>
00049 #include <std_msgs/String.h>
00050 
00051 #include <diagnostic_updater/diagnostic_updater.h>
00052 #include <diagnostic_updater/publisher.h>
00053 
00054 #include <dynamic_reconfigure/server.h>
00055 #include <sick_tim3xx/SickTim3xxConfig.h>
00056 #include <sick_tim3xx/abstract_parser.h>
00057 
00058 namespace sick_tim3xx
00059 {
00060 
00061 class SickTim3xxCommon
00062 {
00063 public:
00064   SickTim3xxCommon(AbstractParser* parser);
00065   virtual ~SickTim3xxCommon();
00066   virtual int init();
00067   int loopOnce();
00068   void check_angle_range(SickTim3xxConfig &conf);
00069   void update_config(sick_tim3xx::SickTim3xxConfig &new_config, uint32_t level = 0);
00070 
00071   double get_expected_frequency() const { return expectedFrequency_; }
00072 
00073 protected:
00074   virtual int init_device() = 0;
00075   virtual int init_scanner();
00076   virtual int stop_scanner();
00077   virtual int close_device() = 0;
00078 
00080 
00084   virtual int sendSOPASCommand(const char* request, std::vector<unsigned char> * reply) = 0;
00085 
00087 
00092   virtual int get_datagram(unsigned char* receiveBuffer, int bufferSize, int* actual_length) = 0;
00093 
00094 protected:
00095   diagnostic_updater::Updater diagnostics_;
00096 
00097 private:
00098   // ROS
00099   ros::NodeHandle nh_;
00100   ros::Publisher pub_;
00101   ros::Publisher datagram_pub_;
00102   bool publish_datagram_;
00103 
00104   // Diagnostics
00105   diagnostic_updater::DiagnosedPublisher<sensor_msgs::LaserScan>* diagnosticPub_;
00106   double expectedFrequency_;
00107 
00108   // Dynamic Reconfigure
00109   SickTim3xxConfig config_;
00110   dynamic_reconfigure::Server<sick_tim3xx::SickTim3xxConfig> dynamic_reconfigure_server_;
00111 
00112   // Parser
00113   AbstractParser* parser_;
00114 };
00115 
00116 } /* namespace sick_tim3xx */
00117 #endif /* SICK_TIM3XX_COMMON_H_ */


sick_tim3xx
Author(s): Jochen Sprickerhof , Martin Günther
autogenerated on Fri Jul 25 2014 06:50:00