LogWriter.h

Go to the documentation of this file.
00001 // This file is part of the SLAMDUNK visual SLAM evaluation framework.
00002 //
00003 // Copyright (C) 2009 by Jan Funke <jan.funke@inf.tu-dresden.de>
00004 //                   and Tobias Pietzsch <tobias.pietzsch@inf.tu-dresden.de>
00005 //
00006 // SLAMDUNK is free software; you can redistribute it and/or modify it under
00007 // the terms of the GNU General Public License as published by the Free
00008 // Software Foundation; either version 3 of the License, or (at your option)
00009 // any later version.
00010 //
00011 // SLAMDUNK is distributed in the hope that it will be useful, but WITHOUT ANY
00012 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00013 // FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00014 // details.
00015 //
00016 // You should have received a copy of the GNU General Public License along with
00017 // this software.  If not, write to the Free Software Foundation, 59 Temple
00018 // Place - Suite 330, Boston, MA 02111-1307, USA.
00019 
00020 #ifndef _LOGWRITER_H
00021 #define _LOGWRITER_H
00022 
00023 
00024 #include <string>
00025 #include <vector>
00026 #include <fstream>
00027 #include "SequenceReader.h"
00028 
00029 
00030 namespace vslam_evaluation {
00031 
00032 
00039 class LogWriter
00040 {
00041 public:
00046     LogWriter ();
00047 
00052     ~LogWriter ();
00053 
00054 
00061     void open (const std::string& output_directory_name);
00062 
00063 
00070     void copySetupFile (const SequenceReader& reader);
00071 
00072 
00089     void logFeatureInit (
00090             double timestamp,
00091             int feature_id,
00092             double image_position_u,
00093             double image_position_v,
00094             double relative_normal_x = 0,
00095             double relative_normal_y = 0,
00096             double relative_normal_z = 0);
00097 
00098 
00116     void logFeatureInitStereo (
00117             double timestamp,
00118             int feature_id,
00119             double image_position_u,
00120             double image_position_v,
00121             double image_position_d,
00122             double relative_normal_x = 0,
00123             double relative_normal_y = 0,
00124             double relative_normal_z = 0);
00125 
00126 
00143     void logMeasurement (
00144             double timestamp,
00145             int feature_id,
00146             double image_position_u,
00147             double image_position_v,
00148             std::string error = "");
00149 
00150 
00168     void logMeasurementStereo (
00169             double timestamp,
00170             int feature_id,
00171             double image_position_u,
00172             double image_position_v,
00173             double image_position_d,
00174             std::string error = "");
00175 
00176 
00190     void logPose (
00191             double timestamp,
00192             double camera_position_x,
00193             double camera_position_y,
00194             double camera_position_z,
00195             double camera_rotation_w,
00196             double camera_rotation_x,
00197             double camera_rotation_y,
00198             double camera_rotation_z
00199             );
00200 
00201 
00207     struct MapFeature
00208     {
00209         int feature_id; 
00210         double feature_position_x; 
00211         double feature_position_y; 
00212         double feature_position_z; 
00213         double feature_normal_x; 
00214         double feature_normal_y; 
00215         double feature_normal_z; 
00216 
00228         MapFeature (int id, double x, double y, double z, double normal_x = 0, double normal_y = 0, double normal_z = 0)
00229           : feature_id (id),
00230             feature_position_x (x),
00231             feature_position_y (y),
00232             feature_position_z (z),
00233             feature_normal_x (normal_x),
00234             feature_normal_y (normal_y),
00235             feature_normal_z (normal_z)
00236         {}
00237     };
00238 
00239 
00246     void logMap (
00247         double timestamp,
00248         const std::vector <MapFeature>& map);
00249 
00250 
00251     struct MapAnchor
00252     {
00253         double timestamp;
00254         double camera_position_x;
00255         double camera_position_y;
00256         double camera_position_z;
00257         double camera_rotation_w;
00258         double camera_rotation_x;
00259         double camera_rotation_y;
00260         double camera_rotation_z;
00261 
00262         MapAnchor (double ts, double x, double y, double z, double qw, double qx, double qy, double qz)
00263           : timestamp (ts),
00264             camera_position_x (x),
00265             camera_position_y (y),
00266             camera_position_z (z),
00267             camera_rotation_w (qw),
00268             camera_rotation_x (qx),
00269             camera_rotation_y (qy),
00270             camera_rotation_z (qz)
00271         {}
00272     };
00273 
00274 
00275     void logAnchorMap (
00276         double timestamp,
00277         const std::vector <MapAnchor>& map);
00278 
00279 
00283     void finish ();
00284 
00285 private:
00286     std::ofstream feature_inits_;
00287     std::ofstream measurements_;
00288     std::ofstream poses_;
00289     std::ofstream maps_;
00290     std::ofstream anchor_maps_;
00291 
00292     std::string output_directory_name_;
00293 };
00294 
00295 
00296 } // namespace vslam_evaluation
00297 
00298 
00299 #endif // _LOGWRITER_H
00300 

Generated on Mon Jan 11 13:11:57 2010 for VSLAM API by  doxygen 1.5.6