controller.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2014-2015, Fetch Robotics Inc.
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  *
00008  *     * Redistributions of source code must retain the above copyright
00009  *       notice, this list of conditions and the following disclaimer.
00010  *     * Redistributions in binary form must reproduce the above copyright
00011  *       notice, this list of conditions and the following disclaimer in the
00012  *       documentation and/or other materials provided with the distribution.
00013  *     * Neither the name of the Fetch Robotics Inc. nor the names of its
00014  *       contributors may be used to endorse or promote products derived from
00015  *       this software without specific prior written permission.
00016  * 
00017  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED. IN NO EVENT SHALL FETCH ROBOTICS INC. BE LIABLE FOR ANY
00021  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00022  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00023  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00024  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00026  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 
00029 // Author: Michael Ferguson
00030 
00031 #ifndef ROBOT_CONTROLLERS_INTERFACE_CONTROLLER_H
00032 #define ROBOT_CONTROLLERS_INTERFACE_CONTROLLER_H
00033 
00034 #include <string>
00035 #include <vector>
00036 #include <boost/shared_ptr.hpp>
00037 #include <ros/ros.h>
00038 #include <robot_controllers_interface/handle.h>
00039 
00054 namespace robot_controllers
00055 {
00056 
00057 // Forward define
00058 class ControllerManager;
00059 
00066 class Controller : public Handle
00067 {
00068 public:
00072   Controller()
00073   {
00074   }
00075 
00077   virtual ~Controller()
00078   {
00079   }
00080 
00088   virtual int init(ros::NodeHandle& nh, ControllerManager* manager)
00089   {
00090     name_ = nh.getNamespace();
00091     // remove leading slash
00092     if (name_.at(0) == '/')
00093       name_.erase(0, 1);
00094     return 0;
00095   }
00096 
00102   virtual bool start() = 0;
00103 
00111   virtual bool stop(bool force) = 0;
00112 
00119   virtual bool reset() = 0;
00120 
00126   virtual void update(const ros::Time& time, const ros::Duration& dt) = 0;
00127 
00129   std::string getName()
00130   {
00131     return name_;
00132   }
00133 
00135   virtual std::string getType()
00136   {
00137     return "UnknownType";
00138   }
00139 
00141   virtual std::vector<std::string> getCommandedNames() = 0;
00142 
00144   virtual std::vector<std::string> getClaimedNames() = 0;
00145 
00146 private:
00147   std::string name_;
00148 };
00149 
00150 // Some typedefs
00151 typedef boost::shared_ptr<Controller> ControllerPtr;
00152 
00153 }  // namespace robot_controllers
00154 
00155 #endif  // ROBOT_CONTROLLERS_INTERFACE_CONTROLLER_H


robot_controllers_interface
Author(s): Michael Ferguson
autogenerated on Thu Jun 6 2019 21:50:24