uos_rotunit_snapshotter.h
Go to the documentation of this file.
00001 /*
00002  * UOS-ROS packages - Robot Operating System code by the University of Osnabrück
00003  * Copyright (C) 2015 University of Osnabrück
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018  *
00019  * uos_rotunit_snapshotter.h
00020  *
00021  * Created on: 26.02.2015
00022  *      Authors: Sebastian Puetz <spuetz@uni-osnabrueck.de>
00023  */
00024 
00025 #ifndef UOS_ROTUNIT_SNAPSHOTTER_H
00026 #define UOS_ROTUNIT_SNAPSHOTTER_H
00027 
00028 #include <ros/ros.h>
00029 #include <ros/topic.h>
00030 
00031 #include <sensor_msgs/JointState.h>
00032 
00033 #include <string>
00034 #include <laser_assembler/AssembleScans2.h>
00035 
00036 #include <uos_rotunit_snapshotter/RotunitSnapshotAction.h>
00037 #include <actionlib/server/simple_action_server.h>
00038 
00039 #include <boost/asio.hpp>
00040 #include <boost/thread/mutex.hpp>
00041 #include <boost/thread/thread.hpp>
00042 
00043 #define MAX_STEP_SIZE M_PI / 8.0
00044 
00045 typedef actionlib::SimpleActionServer<uos_rotunit_snapshotter::RotunitSnapshotAction> Server;
00046 
00047   class RotunitSnapshotter
00048   {
00049     public:
00050       RotunitSnapshotter(ros::NodeHandle& nh, std::string);
00051 
00052     private:
00053       int getIndex(const sensor_msgs::JointState::ConstPtr &jointState);
00054       bool checkIfFinished(double rot, ros::Time stamp);
00055       ros::Time begin_stamp;
00056       ros::Time end_stamp;
00057       double begin_angle;
00058       double end_angle;
00059 
00060       bool started_;
00061       bool finished_;
00062       boost::mutex mutex_;
00063       boost::condition_variable condition_;
00064       double previous_rot;
00065       double residual_rot;
00066       double destination_rot;
00067       double rotation_angle;
00068       bool continuous;
00069 
00070       std::string action_name_;
00071 
00072       void rotCallback(const sensor_msgs::JointState::ConstPtr &jointState);
00073       void makeSnapshot(const uos_rotunit_snapshotter::RotunitSnapshotGoalConstPtr& goal);
00074       double norm2PI(double angle);
00075 
00076       ros::NodeHandle nh_;
00077       ros::ServiceClient client_;
00078       ros::Publisher cloud_pub_;
00079       ros::Publisher snapshot_pub_;
00080       ros::Subscriber state_sub_;
00081       Server server_;
00082       uos_rotunit_snapshotter::RotunitSnapshotResult result_;
00083   };
00084 
00085   #endif /* uos_rotunit_snapshotter.h */


uos_rotunit_snapshotter
Author(s):
autogenerated on Fri Aug 28 2015 13:31:06