control_mode_attitude.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2012, UC Regents
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 University of California 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 #ifndef CONTROL_MODE_ATTITUDE_H
00035 #define CONTROL_MODE_ATTITUDE_H
00036 
00037 #include "flyer_controller/joystick_modes.h"
00038 #include "flyer_controller/attitude_controller.h"
00039 #include <math.h>
00040 #include <algorithm>
00041 #include <tf/transform_datatypes.h>
00042 
00043 #define DEG2RAD (M_PI/180.0)
00044 #define RAD2DEG (180.0/M_PI)
00045 
00046 using namespace flyer_controller;
00047 using namespace std;
00048 using namespace ControlModeTypes;
00049 
00050 namespace flyer_controller
00051 {
00052 class ControlModeAttitude : public JoystickMode
00053 {
00054 private:
00055   // Parameters
00056   bool step_input_mode_enabled; //
00057   int step_input_joystick_roll_axis; // which joystick axis will trigger a roll axis step
00058   int step_input_joystick_pitch_axis; // which joystick axis will trigger a pitch axis step
00059   double step_input_magnitude; // [deg] size of step attitude input when one is commanded
00060 
00061   // Members
00062   AttitudeController att_control;
00063 
00064 public:
00065   ControlModeAttitude(string mode_name = "attitude") :
00066     JoystickMode(mode_name), att_control()
00067   {
00068   }
00069 
00070   void onInit();
00071 
00072 private:
00073   // Virtual methods from base class
00074   void outputControl();
00075 
00076 private:
00077   void applyStepInputs(control_mode_outputPtr& control_out);
00078   void reportStatusTimerCallback(const ros::TimerEvent& e);
00079   void controlModeCmdCallback(const control_mode_cmdConstPtr& msg);
00080 
00081 }; // class
00082 
00083 } // namespace
00084 
00085 #endif


flyer_controller
Author(s): Patrick Bouffard
autogenerated on Sun Jan 5 2014 11:37:53