Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include <robot_activity_tutorials/robot_activity_tutorials.h>
00038
00039 namespace robot_activity_tutorials
00040 {
00041
00042 void RobotActivityTutorials::timerCallback()
00043 {
00044 ROS_INFO_STREAM(getNamespace() << " " << counter);
00045 counter++;
00046 }
00047
00048 void RobotActivityTutorials::heartbeatCallback(
00049 boost::shared_ptr<robot_activity_msgs::State const> msg)
00050 {
00051 ROS_INFO_STREAM(getNamespace() << " State: " << unsigned(msg->state));
00052 }
00053
00054 bool RobotActivityTutorials::serviceCallback(
00055 std_srvs::Empty::Request& request,
00056 std_srvs::Empty::Response& response)
00057 {
00058 ROS_INFO_STREAM(getNamespace() << " Service called, returning true");
00059 return true;
00060 }
00061
00062 void RobotActivityTutorials::onManagedCreate()
00063 {
00064 ROS_INFO("onManagedCreate");
00065
00066
00067
00068
00069
00070
00071
00072
00073 int context = 0;
00074 robot_activity::IsolatedAsyncTimer::LambdaCallback cb = [ = ]() mutable
00075 {
00076 ROS_INFO_STREAM(getNamespace() << " " << context);
00077 context++;
00078 };
00079
00080
00081
00082
00083
00084 registerIsolatedTimer(cb, 1.0, true);
00085
00086
00087
00088
00089
00090
00091
00092 registerIsolatedTimer(
00093 std::bind(&RobotActivityTutorials::timerCallback, this),
00094 1.0,
00095 false);
00096
00097 subscriber_manager.subscribe("/heartbeat", 1, &RobotActivityTutorials::heartbeatCallback, this);
00098 service_manager.advertiseService("/test", &RobotActivityTutorials::serviceCallback, this);
00099 }
00100
00101 void RobotActivityTutorials::onManagedTerminate()
00102 {
00103 ROS_INFO("onManagedTerminate");
00104 }
00105
00106 bool RobotActivityTutorials::onManagedConfigure()
00107 {
00108 ROS_INFO("onManagedConfigure");
00109 return true;
00110 }
00111
00112 bool RobotActivityTutorials::onManagedUnconfigure()
00113 {
00114 ROS_INFO("onManagedUnconfigure");
00115 return true;
00116 }
00117
00118 bool RobotActivityTutorials::onManagedStart()
00119 {
00120 ROS_INFO("onManagedStart");
00121 return true;
00122 }
00123
00124 bool RobotActivityTutorials::onManagedStop()
00125 {
00126 ROS_INFO("onManagedStop");
00127 return true;
00128 }
00129
00130 bool RobotActivityTutorials::onManagedPause()
00131 {
00132 ROS_INFO("onManagedPause");
00133 return true;
00134 }
00135
00136 bool RobotActivityTutorials::onManagedResume()
00137 {
00138 ROS_INFO("onManagedResume");
00139 return true;
00140 }
00141
00142 }