odometry_params.h
Go to the documentation of this file.
00001 #include <ros/ros.h>
00002 
00003 #include <viso_stereo.h>
00004 #include <viso_mono.h>
00005 
00006 namespace viso2_ros
00007 {
00008 
00009 namespace odometry_params
00010 {
00011  
00013 void loadParams(const ros::NodeHandle& local_nh, Matcher::parameters& params)
00014 {
00015   local_nh.getParam("nms_n",                  params.nms_n);
00016   local_nh.getParam("nms_tau",                params.nms_tau);
00017   local_nh.getParam("match_binsize",          params.match_binsize);
00018   local_nh.getParam("match_radius",           params.match_radius);
00019   local_nh.getParam("match_disp_tolerance",   params.match_disp_tolerance);
00020   local_nh.getParam("outlier_disp_tolerance", params.outlier_disp_tolerance);
00021   local_nh.getParam("outlier_flow_tolerance", params.outlier_flow_tolerance);
00022   local_nh.getParam("multi_stage",            params.multi_stage);
00023   local_nh.getParam("half_resolution",        params.half_resolution);
00024   local_nh.getParam("refinement",             params.refinement);
00025 }
00026 
00028 void loadParams(const ros::NodeHandle& local_nh, VisualOdometry::bucketing& bucketing)
00029 {
00030   local_nh.getParam("max_features",  bucketing.max_features);
00031   local_nh.getParam("bucket_width",  bucketing.bucket_width);
00032   local_nh.getParam("bucket_height", bucketing.bucket_height);
00033 }
00034 
00036 void loadCommonParams(const ros::NodeHandle& local_nh, VisualOdometry::parameters& params)
00037 {
00038   loadParams(local_nh, params.match);
00039   loadParams(local_nh, params.bucket);
00040 }
00041 
00043 void loadParams(const ros::NodeHandle& local_nh, VisualOdometryStereo::parameters& params)
00044 {
00045   loadCommonParams(local_nh, params);
00046   local_nh.getParam("ransac_iters",     params.ransac_iters);
00047   local_nh.getParam("inlier_threshold", params.inlier_threshold);
00048   local_nh.getParam("reweighting",      params.reweighting);
00049 }
00050 
00052 void loadParams(const ros::NodeHandle& local_nh, VisualOdometryMono::parameters& params)
00053 {
00054   loadCommonParams(local_nh, params);
00055   if (!local_nh.getParam("camera_height", params.height))
00056   {
00057     ROS_WARN("Parameter 'camera_height' is required but not set. Using default: %f", params.height);
00058   }
00059   if (!local_nh.getParam("camera_pitch", params.pitch))
00060   {
00061     ROS_WARN("Paramter 'camera_pitch' is required but not set. Using default: %f", params.pitch);
00062   }
00063   local_nh.getParam("ransac_iters",     params.ransac_iters);
00064   local_nh.getParam("inlier_threshold", params.inlier_threshold);
00065   local_nh.getParam("motion_threshold", params.motion_threshold);
00066 }
00067 
00068 } // end of namespace
00069 
00070 std::ostream& operator<<(std::ostream& out, const Matcher::parameters& params)
00071 {
00072   out << "  nms_n                  = " << params.nms_n << std::endl;
00073   out << "  nms_tau                = " << params.nms_tau << std::endl;
00074   out << "  match_binsize          = " << params.match_binsize << std::endl;
00075   out << "  match_radius           = " << params.match_radius << std::endl;
00076   out << "  match_disp_tolerance   = " << params.match_disp_tolerance << std::endl;
00077   out << "  outlier_disp_tolerance = " << params.outlier_disp_tolerance << std::endl;
00078   out << "  outlier_flow_tolerance = " << params.outlier_flow_tolerance << std::endl;
00079   out << "  multi_stage            = " << params.multi_stage << std::endl;
00080   out << "  half_resolution        = " << params.half_resolution << std::endl;
00081   out << "  refinement             = " << params.refinement << std::endl;
00082   return out;
00083 }
00084 
00085 std::ostream& operator<<(std::ostream& out, const VisualOdometry::calibration& calibration)
00086 {
00087   out << "  f  = " << calibration.f << std::endl;
00088   out << "  cu = " << calibration.cu << std::endl;
00089   out << "  cv = " << calibration.cv << std::endl;
00090   return out;
00091 }
00092 
00093 std::ostream& operator<<(std::ostream& out, const VisualOdometry::bucketing& bucketing)
00094 {
00095   out << "  max_features  = " << bucketing.max_features << std::endl;
00096   out << "  bucket_width  = " << bucketing.bucket_width << std::endl;
00097   out << "  bucket_height = " << bucketing.bucket_height << std::endl;
00098   return out;
00099 }
00100 
00101 std::ostream& operator<<(std::ostream& out, const VisualOdometry::parameters& params)
00102 {
00103   out << "Calibration parameters:" << std::endl << params.calib;
00104   out << "Matcher parameters:" << std::endl << params.match;
00105   out << "Bucketing parameters:" << std::endl << params.bucket;
00106   return out;
00107 }
00108 
00109 std::ostream& operator<<(std::ostream& out, const VisualOdometryStereo::parameters& params)
00110 {
00111   out << static_cast<VisualOdometry::parameters>(params);
00112   out << "Stereo odometry parameters:" << std::endl;
00113   out << "  base             = " << params.base << std::endl;
00114   out << "  ransac_iters     = " << params.ransac_iters << std::endl;
00115   out << "  inlier_threshold = " << params.inlier_threshold << std::endl;
00116   out << "  reweighting      = " << params.reweighting << std::endl;
00117   return out;
00118 }
00119 
00120 std::ostream& operator<<(std::ostream& out, const VisualOdometryMono::parameters& params)
00121 {
00122   out << static_cast<VisualOdometry::parameters>(params);
00123   out << "Mono odometry parameters:" << std::endl;
00124   out << "  camera_height    = " << params.height << std::endl;
00125   out << "  camera_pitch     = " << params.pitch << std::endl;
00126   out << "  ransac_iters     = " << params.ransac_iters << std::endl;
00127   out << "  inlier_threshold = " << params.inlier_threshold << std::endl;
00128   out << "  motion_threshold = " << params.motion_threshold << std::endl;
00129   return out;
00130 }
00131 
00132 
00133 
00134 } // end of namespace
00135 


viso2_ros
Author(s): Stephan Wirth
autogenerated on Tue Jan 7 2014 11:42:16