Go to the documentation of this file.00001
00018 #ifndef Q_MOC_RUN
00019 #include <ros/ros.h>
00020 #include <ros/init.h>
00021 #endif
00022 #include <Optimization/abstract_optimizer.h>
00023 #include <Transformation/transformationfile_manager_XML.h>
00024
00025
00026
00027
00028
00029
00030
00031 std::vector<Transformation_Data> readTransformationFile(string fileName)
00032 {
00033 std::vector<Transformation_Data> data;
00034 ROS_INFO_STREAM("Reading file " << fileName << "...");
00035 std::ifstream infile(fileName);
00036 if (infile.good())
00037 {
00038 TransformationFile_Manager_XML fileManager(fileName);
00039 try
00040 {
00041 data = fileManager.readFromFile();
00042 }
00043 catch (...)
00044 {
00045 ROS_ERROR("Could not read file.");
00046 }
00047 }
00048 else
00049 {
00050 ROS_ERROR("File does not exist.");
00051 }
00052 return data;
00053 }
00054
00055
00056 int main(int argc, char *argv[])
00057 {
00058 char *arg[0];
00059 int x = 0;
00060 ROS_INFO("Init ROS");
00061 ros::init(x, arg, "optimizer");
00062 if (argc > 0)
00063 {
00064 **++argv;
00065 std::string fileName = *argv;
00066 std::vector<Transformation_Data> transformationData = readTransformationFile(fileName);
00067 ROS_INFO_STREAM("Got " << transformationData.size() << " datasets.");
00068 }
00069 else
00070 {
00071 ROS_ERROR("No data file specified.");
00072 }
00073 return 0;
00074 }
00075
00076
00077
00078
00079