main.cpp
Go to the documentation of this file.
00001 
00008 #include <pen_gripper/pen_gripper.h>
00009 //#include "pen_gripper.cpp"
00010 
00011 int main(int argc, char** argv) {
00012 
00013         ros::init(argc, argv, "pen_gripper");
00014 
00015         // node handle
00016         ros::NodeHandle n;
00017 
00018         // pen gripper object
00019         PenGripper p(n);
00020 
00021         // to avoid tf errors
00022         ros::spinOnce();
00023         ros::Duration wait(3, 0);
00024         wait.sleep();
00025 
00026         // communication server with the world for the pen gripper
00027         ros::ServiceServer instr_srv = n.advertiseService(
00028                         "/alubsc/node_instr/pen_gripper", &PenGripper::handle_req, &p);
00029 
00030         ROS_INFO("The pen gripper is ready to serve...");
00031         p.status.request.message = "The pen gripper is ready to serve...";
00032         p.status_clt.call(p.status);
00033 
00034         while (ros::ok()) {
00035                 // active ?
00036                 if (!p.abort) {
00037                         p.take_start_position();
00038                         ros::spinOnce();
00039 //                      p.grip_pen();
00040 
00041                         p.success=true;
00042 //                      if (p.success) {
00043                                 p.status.request.message = "pen gripping has finished";
00044                                 p.status_clt.call(p.status);
00045                                 ROS_INFO("pen gripping has finished");
00046 //                      }
00047 //                      if (!p.success) {
00048 //                              ROS_INFO("there was an error during the process");
00049 //                              p.status.request.message =
00050 //                                              "there was an error during the process";
00051 //                              p.status_clt.call(p.status);
00052 //                      }
00053                         p.reset();
00054 
00055                 }
00056                 ros::spinOnce();
00057         }
00058         return 0;
00059 
00060 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends Defines


pen_gripper
Author(s): Richard Schneider
autogenerated on Wed Dec 26 2012 16:16:39