HLManager.hpp
Go to the documentation of this file.
00001 /*********************************************************************
00002 * Software License Agreement (BSD License)
00003 *
00004 *  Copyright (c) 2010, LABUST, UNIZG-FER
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
00009 *  are met:
00010 *
00011 *   * Redistributions of source code must retain the above copyright
00012 *     notice, this list of conditions and the following disclaimer.
00013 *   * Redistributions in binary form must reproduce the above
00014 *     copyright notice, this list of conditions and the following
00015 *     disclaimer in the documentation and/or other materials provided
00016 *     with the distribution.
00017 *   * Neither the name of the LABUST nor the names of its
00018 *     contributors may be used to endorse or promote products derived
00019 *     from this software without specific prior written permission.
00020 *
00021 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024 *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027 *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028 *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029 *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030 *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031 *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032 *  POSSIBILITY OF SUCH DAMAGE.
00033 *
00034 *  Created on: 06.05.2013.
00035 *  Author: Dula Nad
00036 *********************************************************************/
00037 #ifndef HLMANAGER_HPP_
00038 #define HLMANAGER_HPP_
00039 #include <navcon_msgs/SetHLMode.h>
00040 #include <navcon_msgs/HLMessage.h>
00041 
00042 #include <std_msgs/Bool.h>
00043 #include <geometry_msgs/PointStamped.h>
00044 #include <auv_msgs/NavSts.h>
00045 #include <sensor_msgs/NavSatFix.h>
00046 #include <sensor_msgs/Imu.h>
00047 #include <tf/transform_broadcaster.h>
00048 
00049 #include <ros/ros.h>
00050 #include <boost/thread/mutex.hpp>
00051 
00052 #include <map>
00053 #include <string>
00054 
00055 namespace labust
00056 {
00057         namespace control
00058         {
00068                 class HLManager
00069                 {
00070                         enum {bArt=0, cArt};
00071                         enum {stop=0, manual,
00072                                 gotoPoint, stationKeeping, circle, heading, headingSurge, vtManual, lastMode};
00073 
00074                         typedef std::map<std::string,bool> ControllerMap;
00075 
00076                 public:
00080                         HLManager();
00084                         void onInit();
00088                         void start();
00089 
00090                 private:
00094                         void onVehicleEstimates(const auv_msgs::NavSts::ConstPtr& estimate);
00098                         bool setHLMode(navcon_msgs::SetHLMode::Request& req, navcon_msgs::SetHLMode::Response& resp);
00102                         void onLaunch(const std_msgs::Bool::ConstPtr& isLaunched);
00106                         void onGPSData(const sensor_msgs::NavSatFix::ConstPtr& fix);
00110                         void onVTTwist(const geometry_msgs::TwistStamped::ConstPtr& twist);
00114                         void onImuMeas(const sensor_msgs::Imu::ConstPtr& imu);
00118                         void safetyTest();
00122                         void bArtStep();
00126                         void step();
00130                         void calculateBArtPoint(double heading);
00134                         void disableControllerMap();
00138                         bool fullStop();
00142                         bool configureControllers();
00143 
00147                         ros::NodeHandle nh,ph;
00151                         ros::Time lastEst, launchTime, lastFix;
00155                         bool launchDetected;
00159                         double timeout;
00163                         int32_t mode, type;
00167                         geometry_msgs::PointStamped point;
00171                         auv_msgs::NavSts stateHat, trackPoint;
00175                         sensor_msgs::NavSatFix fix;
00179                         bool fixValidated;
00180 
00184                         double safetyRadius, safetyDistance, safetyTime, safetyTime2, gyroYaw;
00188                         double circleRadius, turnDir, s;
00192                         tf::TransformBroadcaster broadcaster;
00196                         double originLat, originLon;
00197 
00201                         ros::Publisher refPoint, refTrack, openLoopSurge, curMode, refHeading,
00202                         hlMessagePub, sfPub;
00206                         ros::Subscriber state, launch, gpsData, virtualTargetTwist, imuMeas;
00210                         ros::ServiceServer modeServer;
00214                         ControllerMap controllers;
00218                         navcon_msgs::HLMessage hlDiagnostics;
00219                 };
00220         }
00221 }
00222 /* HLMANAGER_HPP_ */
00223 #endif


labust_control
Author(s): Gyula Nagy
autogenerated on Fri Feb 7 2014 11:36:43