00001 /********************************************************************* 00002 * 00003 * Software License Agreement (BSD License) 00004 * 00005 * Copyright (c) 2018, University of Luxembourg 00006 * All rights reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions 00010 * are met: 00011 * 00012 * * Redistributions of source code must retain the above copyright 00013 * notice, this list of conditions and the following disclaimer. 00014 * * Redistributions in binary form must reproduce the above 00015 * copyright notice, this list of conditions and the following 00016 * disclaimer in the documentation and/or other materials provided 00017 * with the distribution. 00018 * * Neither the name of University of Luxembourg nor the names of its 00019 * contributors may be used to endorse or promote products derived 00020 * from this software without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00023 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00024 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00025 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00026 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00027 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00028 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00029 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00030 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00031 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00032 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00033 * POSSIBILITY OF SUCH DAMAGE. 00034 * 00035 * Author: Maciej Zurad 00036 *********************************************************************/ 00044 #ifndef ROBOT_ACTIVITY_MANAGED_ROBOT_ACTIVITY_H 00045 #define ROBOT_ACTIVITY_MANAGED_ROBOT_ACTIVITY_H 00046 00047 #include <ros/ros.h> 00048 #include <ros/console.h> 00049 #include <ros/callback_queue.h> 00050 00051 #include <std_srvs/Empty.h> 00052 #include <robot_activity_msgs/State.h> 00053 #include <robot_activity_msgs/Error.h> 00054 00055 #include <robot_activity/robot_activity.h> 00056 #include <robot_activity/resource/resource_manager.h> 00057 00058 namespace robot_activity 00059 { 00060 00071 class ManagedRobotActivity : public RobotActivity 00072 { 00073 public: 00077 using RobotActivity::RobotActivity; 00078 00082 virtual ~ManagedRobotActivity(); 00083 00084 protected: 00088 resource::SubscriberManager subscriber_manager; 00089 00093 resource::ServiceServerManager service_manager; 00094 00095 private: 00100 void onCreate() final; 00101 00106 void onTerminate() final; 00107 00114 bool onConfigure() final; 00115 00122 bool onUnconfigure() final; 00123 00133 bool onStart() final; 00134 00144 bool onStop() final; 00145 00155 bool onPause() final; 00156 00166 bool onResume() final; 00167 00172 virtual void onManagedCreate() = 0; 00173 00178 virtual void onManagedTerminate() = 0; 00179 00189 virtual bool onManagedConfigure() = 0; 00190 00200 virtual bool onManagedUnconfigure() = 0; 00201 00211 virtual bool onManagedStart() = 0; 00212 00222 virtual bool onManagedStop() = 0; 00223 00233 virtual bool onManagedPause() = 0; 00234 00244 virtual bool onManagedResume() = 0; 00245 }; 00246 00247 } // namespace robot_activity 00248 00249 #endif // ROBOT_ACTIVITY_MANAGED_ROBOT_ACTIVITY_H