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_process_tutorials/robot_process_tutorials.h>
00038
00039 namespace robot_process_tutorials
00040 {
00041
00042 void RobotProcessTutorials::timerCallback()
00043 {
00044 ROS_INFO_STREAM(getNamespace() << " " << counter);
00045 counter++;
00046 }
00047
00048 void RobotProcessTutorials::heartbeatCallback(
00049 boost::shared_ptr<robot_process_msgs::State const> msg)
00050 {
00051 ROS_INFO_STREAM(getNamespace() << " State: " << unsigned(msg->state));
00052 }
00053
00054 bool RobotProcessTutorials::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 RobotProcessTutorials::onManagedCreate()
00063 {
00064 ROS_INFO("onManagedCreate");
00065
00066
00067
00068
00069
00070
00071
00072
00073 int context = 0;
00074 robot_process::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(&RobotProcessTutorials::timerCallback, this),
00094 1.0,
00095 false);
00096
00097 subscriber_manager.subscribe("/heartbeat", 1, &RobotProcessTutorials::heartbeatCallback, this);
00098 service_manager.advertiseService("/test", &RobotProcessTutorials::serviceCallback, this);
00099 }
00100
00101 void RobotProcessTutorials::onManagedTerminate()
00102 {
00103 ROS_INFO("onManagedTerminate");
00104 };
00105
00106 void RobotProcessTutorials::onManagedConfigure()
00107 {
00108 ROS_INFO("onManagedConfigure");
00109 }
00110
00111 void RobotProcessTutorials::onManagedUnconfigure()
00112 {
00113 ROS_INFO("onManagedUnconfigure");
00114 }
00115
00116 void RobotProcessTutorials::onManagedStart()
00117 {
00118 ROS_INFO("onManagedStart");
00119 }
00120
00121 void RobotProcessTutorials::onManagedStop()
00122 {
00123 ROS_INFO("onManagedStop");
00124 }
00125
00126 void RobotProcessTutorials::onManagedPause()
00127 {
00128 ROS_INFO("onManagedPause");
00129 }
00130
00131 void RobotProcessTutorials::onManagedResume()
00132 {
00133 ROS_INFO("onManagedResume");
00134 }
00135
00136 }