lowLevelConfigure.hpp
Go to the documentation of this file.
00001 /*********************************************************************
00002  * lowLevelConfigure.hpp
00003  *
00004  *  Created on: Mar 7, 2014
00005  *      Author: Filip Mandic
00006  *
00007  ********************************************************************/
00008 
00009 /*********************************************************************
00010 * Software License Agreement (BSD License)
00011 *
00012 *  Copyright (c) 2014, LABUST, UNIZG-FER
00013 *  All rights reserved.
00014 *
00015 *  Redistribution and use in source and binary forms, with or without
00016 *  modification, are permitted provided that the following conditions
00017 *  are met:
00018 *
00019 *   * Redistributions of source code must retain the above copyright
00020 *     notice, this list of conditions and the following disclaimer.
00021 *   * Redistributions in binary form must reproduce the above
00022 *     copyright notice, this list of conditions and the following
00023 *     disclaimer in the documentation and/or other materials provided
00024 *     with the distribution.
00025 *   * Neither the name of the LABUST nor the names of its
00026 *     contributors may be used to endorse or promote products derived
00027 *     from this software without specific prior written permission.
00028 *
00029 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00030 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00031 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00032 *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00033 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00034 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00035 *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00036 *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00037 *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00038 *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00039 *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00040 *  POSSIBILITY OF SUCH DAMAGE.
00041 *********************************************************************/
00042 
00043 #ifndef LOWLEVELCONFIGURE_HPP_
00044 #define LOWLEVELCONFIGURE_HPP_
00045 
00046 #include <ros/ros.h>
00047 #include <auv_msgs/Bool6Axis.h>
00048 #include <navcon_msgs/ConfigureVelocityController.h>
00049 #include <labust_mission/utils.hpp>
00050 
00051 
00052 namespace labust {
00053 
00054 /*************************************************************
00055  *** Class definition
00056  ************************************************************/
00057 
00058         class LowLevelConfigure {
00059 
00060         public:
00061 
00062                 LowLevelConfigure();
00063 
00064                 /*************************************************************
00065                  *** Class functions
00066                  ************************************************************/
00067 
00068                 void LL_VELconfigure(bool enable, int x, int y, int z, int pitch, int roll, int yaw);
00069 
00070                 void AXESconfigure(auv_msgs::Bool6Axis& nu_bool);
00071 
00072                 /*************************************************************
00073                  *** Class variables
00074                  ************************************************************/
00075 
00076                 auv_msgs::Bool6Axis nuAxis;
00077                 navcon_msgs::ConfigureVelocityController velConConf;
00078 
00079                 ros::ServiceClient clientConfigureAxes;
00080                 ros::ServiceClient clientConfigureVelocitiyController;
00081         };
00082 
00083         LowLevelConfigure::LowLevelConfigure(){
00084 
00085                 ros::NodeHandle nh;
00086 
00087                 nuAxis.x = false;
00088                 nuAxis.y = false;
00089                 nuAxis.z = false;
00090                 nuAxis.pitch = false;
00091                 nuAxis.roll = false;
00092                 nuAxis.yaw = false;
00093 
00094                 for( int i = 0; i<=5; i++){
00095                         velConConf.request.desired_mode[i] = 0;
00096                 }
00097 
00098                 clientConfigureAxes = nh.serviceClient<navcon_msgs::ConfigureAxes>("ConfigureAxes");
00099                 clientConfigureVelocitiyController = nh.serviceClient<navcon_msgs::ConfigureVelocityController>("ConfigureVelocityController");
00100         }
00101 
00102 
00103         /*
00104          * Low-level velocity controller configure
00105          */
00106         void LowLevelConfigure::LL_VELconfigure(bool enable, int x, int y, int z, int roll, int pitch, int yaw){
00107 
00108                 if(enable){
00109                         // Provjeriti je li potreban reset svih ili u if dodati.
00110                         nuAxis.x = false;
00111                         nuAxis.y = false;
00112                         nuAxis.z = false;
00113                         nuAxis.pitch = false;
00114                         nuAxis.roll = false;
00115                         nuAxis.yaw = false;
00116 
00117                         if(velConConf.request.desired_mode[0] = x){ nuAxis.x = true;}
00118                         if(velConConf.request.desired_mode[1] = y){nuAxis.y = true;}
00119                         if(velConConf.request.desired_mode[2] = z){nuAxis.z = true;}
00120                         if(velConConf.request.desired_mode[3] = roll){nuAxis.roll = true;}
00121                         if(velConConf.request.desired_mode[4] = pitch){ nuAxis.pitch = true;}
00122                         if(velConConf.request.desired_mode[5] = yaw){nuAxis.yaw = true;}
00123 
00124                         /*** AXESconfigure(nuAxis); *** Deprecated ***/
00125                         utilities::callService<navcon_msgs::ConfigureVelocityController>(clientConfigureVelocitiyController,velConConf);
00126                 } else {
00127 
00128                         /* Disable all degrees of freedom */
00129                         for( int i = 0; i<=5; i++){
00130                                 velConConf.request.desired_mode[i] = 0;
00131                         }
00132 
00133                         nuAxis.x = false;
00134                         nuAxis.y = false;
00135                         nuAxis.z = false;
00136                         nuAxis.pitch = false;
00137                         nuAxis.roll = false;
00138                         nuAxis.yaw = false;
00139 
00140                         /*** AXESconfigure(nuAxis); *** Deprecated ***/
00141                         utilities::callService<navcon_msgs::ConfigureVelocityController>(clientConfigureVelocitiyController,velConConf);
00142                 }
00143         }
00144 
00145         /*
00146          * Configure axes to control DEPRECATED
00147          */
00148 
00149 /*      void LowLevelConfigure::AXESconfigure(auv_msgs::Bool6Axis& nu_bool){
00150 
00151                 navcon_msgs::ConfigureAxes nu_cfg;
00152                 nu_cfg.request.disable_axis = nu_bool;
00153                 utilities::callService<navcon_msgs::ConfigureAxes>(clientConfigureAxes, nu_cfg);
00154         }*/
00155 
00156 }
00157 
00158 #endif /* LOWLEVELCONFIGURE_HPP_ */


labust_mission
Author(s): Filip Mandic
autogenerated on Fri Aug 28 2015 11:23:04