arm_sim_controller.h
Go to the documentation of this file.
00001 //=================================================================================================
00002 // Copyright (c) 2012, Àngel Santamaria-Navarro, IRI-UPC-CSIC
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 //     * Redistributions of source code must retain the above copyright
00008 //       notice, this list of conditions and the following disclaimer.
00009 //     * Redistributions in binary form must reproduce the above copyright
00010 //       notice, this list of conditions and the following disclaimer in the
00011 //       documentation and/or other materials provided with the distribution.
00012 //     * Neither the name of the Mobile Robotics group,
00013 //       Institut de robòtica i infomàtica industrial (IRI), 
00014 //       nor the names of its contributors may be used to
00015 //       endorse or promote products derived from this software without
00016 //       specific prior written permission.
00017 //
00018 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00019 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00020 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00021 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
00022 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00023 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00024 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00025 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00026 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00027 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00028 //=================================================================================================
00029 
00030 #ifndef __GAZEBO_SIMPLE_ARM_PLUGIN_H__
00031 #define __GAZEBO_SIMPLE_ARM_PLUGIN_H__
00032 
00033 #include "gazebo/gazebo.hh"
00034 #include "common/Plugin.hh"
00035 
00036 #include <ros/callback_queue.h>
00037 #include <ros/ros.h>
00038 
00039 #include <sensor_msgs/JointState.h>
00040 
00041 #define NUM_JOINTS 5
00042 namespace gazebo
00043 {
00044   class SimpleArmPlugin : public ModelPlugin
00045   {
00046 public: 
00047   SimpleArmPlugin();
00048   virtual ~SimpleArmPlugin();
00049 
00050 protected:  
00051   virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
00052   virtual void Update();
00053   virtual void Reset();  
00054 
00055 private: 
00056 
00058   physics::ModelPtr model_;
00059   
00061   physics::JointPtr joints_[NUM_JOINTS];
00062 
00063   ros::NodeHandle* node_handle_;
00064   ros::CallbackQueue callback_queue_;
00065   ros::Subscriber joints_subscriber_;
00066   
00067   std::string namespace_;
00068   std::string joints_topic_;
00069   
00070 
00071   sensor_msgs::JointState jointsstates_;
00072   void JointsCallback(const sensor_msgs::JointStateConstPtr&);
00073   
00075   common::Time prevUpdateTime_;
00076   
00077   common::PID jointPIDs_[NUM_JOINTS];
00078   double jointPositions_[NUM_JOINTS];
00079   double jointVelocities_[NUM_JOINTS];
00080   double jointMaxEfforts_[NUM_JOINTS];
00081 
00083   event::ConnectionPtr updateConnection_;
00084   
00085   };
00086 }
00087 #endif


arm_sim_controller
Author(s): Àngel Santamaria Navarro
autogenerated on Fri Dec 6 2013 22:15:43