Go to the documentation of this file.00001 #ifdef DOXYGEN_SHOULD_SKIP_THIS
00002
00021 #endif // DOXYGEN_SHOULD_SKIP_THIS
00022
00023 #include <string>
00024 #include <stdio.h>
00025 #include <execinfo.h>
00026 #include <signal.h>
00027 #include <stdlib.h>
00028 #include <unistd.h>
00029
00030 #include <ros/ros.h>
00031
00032 #include <grasp_planning_graspit_ros/LogBindingROS.h>
00033 #include <grasp_planning_graspit_ros/GraspItServices.h>
00034
00035
00039 void print_trace(void)
00040 {
00041 void *array[10];
00042 size_t size;
00043 char **strings;
00044 size_t i;
00045
00046 size = backtrace(array, 10);
00047 strings = backtrace_symbols(array, size);
00048
00049 printf("Obtained %zd stack frames.\n", size);
00050
00051 for (i = 0; i < size; i++)
00052 printf("%s\n", strings[i]);
00053
00054 free(strings);
00055 }
00056
00057
00058 void handler(int sig)
00059 {
00060 print_trace();
00061 ros::shutdown();
00062 exit(1);
00063 }
00064
00065 int main(int argc, char **argv)
00066 {
00067 signal(SIGSEGV, handler);
00068 signal(SIGABRT, handler);
00069
00070 ros::init(argc, argv, "grasp_planning_graspit_service", ros::init_options::AnonymousName);
00071
00072 bool useRosLogging = true;
00073 if (useRosLogging)
00074 {
00075 PRINT_INIT_ROS();
00076 }
00077 else
00078 {
00079 PRINT_INIT_STD();
00080 }
00081
00082 GraspIt::GraspItServices s;
00083 s.start();
00084
00085 ros::spin();
00086
00087 PRINTMSG("Quitting services.");
00088 }