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 #include "CollisionInterface.h"
00020
00021 #define STD_CONFIG_FILENAME "bla.xml"
00022
00023 #include <ros/ros.h>
00024
00025 using namespace cop;
00026
00027
00028 int main(int argc, char* argv[])
00029 {
00030 #ifndef USE_YARP_COMM
00031 std::string nodename = "cop";
00032 if(argc > 2)
00033 nodename = argv[2];
00034 ros::init(argc, argv, nodename);
00035 #endif
00036 try
00037 {
00038 if(argc > 0)
00039 {
00040 XMLTag* config = NULL;
00041 if(argc > 1)
00042 config = XMLTag::ReadFromFile(argv[1]);
00043 else
00044 config = XMLTag::ReadFromFile(STD_CONFIG_FILENAME);
00045 if(config == NULL)
00046 config = new XMLTag("config");
00047
00048
00049 printf("Init start:\n");
00050 ros::NodeHandle nh;
00051 cop_world copWorld(config, nodename);
00052 CollisionInterface collision(copWorld, nh);
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 printf("Inited\n");
00074 #ifdef USE_YARP_COMM
00075 copWorld.StartListeningYarpPort((char*)"/tracking/in");
00076 #else
00077 if(copWorld.s_visFinder != NULL)
00078 {
00079 if(copWorld.s_visFinder->CountAlgorithms() == 0)
00080 printf("Warning: no algorithm loaded\n");
00081 copWorld.StartNodeSubscription((char*)"in");
00082
00083 printf("Returned successfully\n");
00084 #endif
00085 if(g_stopall == true)
00086 {
00087 if(argc > 1)
00088 {
00089 copWorld.SaveCop(STD_CONFIG_FILENAME);
00090 exit(0);
00091 }
00092 else
00093 {
00094 copWorld.SaveCop(STD_CONFIG_FILENAME);
00095 exit(0);
00096 }
00097 }
00098 }
00099 else
00100 {
00101 ROS_ERROR("cop: Loading of main modules failed. Check the configuration and the folder cop is executed in!");
00102 }
00103 }
00104 }
00105 catch(char* text)
00106 {
00107 printf("Error in cop_main: %s\n", text);
00108 return 1;
00109
00110 }
00111
00112
00113
00114
00115
00116 printf("exiting %s\n", argv[0]);
00117 return 0;
00118 }
00119