Main MRPT website > C++ reference for MRPT 1.5.9
TStereoCamera.cpp
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
10 #include "base-precomp.h" // Precompiled headers
11 
14 #include <mrpt/utils/CStream.h>
15 
16 using namespace mrpt::utils;
17 using namespace mrpt::poses;
18 using namespace mrpt::math;
19 using namespace std;
20 
22 
24 {
25 }
26 
27 
28 /** Save as a config block:
29  */
31 {
32  // [<SECTION>_LEFT]
33  // ...
34  // [<SECTION>_RIGHT]
35  // ...
36  // [<SECTION>_LEFT2RIGHT_POSE]
37  // pose_quaternion = [x y z qr qx qy qz]
38 
39  leftCamera.saveToConfigFile(section+string("_LEFT"), cfg);
40  rightCamera.saveToConfigFile(section+string("_RIGHT"), cfg);
41 
42  const CPose3DQuat q = CPose3DQuat(rightCameraPose); // Don't remove this line, it's a safe against future possible bugs if rightCameraPose changes!
43  cfg.write(section+string("_LEFT2RIGHT_POSE"), "pose_quaternion",q.asString() );
44 }
45 
46 /** Load all the params from a config source, in the format described in saveToConfigFile()
47  */
49 {
50  // [<SECTION>_LEFT]
51  // ...
52  // [<SECTION>_RIGHT]
53  // ...
54  // [<SECTION>_LEFT2RIGHT_POSE]
55  // pose_quaternion = [x y z qr qx qy qz]
56 
57  leftCamera.loadFromConfigFile(section+string("_LEFT"), cfg);
58  rightCamera.loadFromConfigFile(section+string("_RIGHT"), cfg);
59  rightCameraPose.fromString( cfg.read_string(section+string("_LEFT2RIGHT_POSE"), "pose_quaternion","" ) );
60 }
61 
62 // WriteToStream
64 {
65  if( version )
66  *version = 1;
67  else
68  {
69  out << leftCamera
70  << rightCamera
71  << rightCameraPose;
72  } // end else
73 }
74 
75 // ReadFromStream
77 {
78  switch( version )
79  {
80  case 0:
81  case 1:
82  {
83  if (version==0)
84  {
85  uint8_t _model;
86  in >> _model; // unused now
87  }
88 
89  in >> leftCamera
90  >> rightCamera
91  >> rightCameraPose;
92  } break;
93  default:
95  }
96 }
97 
99 {
101  saveToConfigFile("",cfg);
102  return cfg.getContent();
103 }
104 
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Definition: zip.h:16
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:39
GLdouble GLdouble GLdouble GLdouble q
Definition: glext.h:3626
std::string read_string(const std::string &section, const std::string &name, const std::string &defaultValue, bool failIfNotFound=false) const
STL namespace.
IMPLEMENTS_SERIALIZABLE(CLogFileRecord_FullEval, CHolonomicLogFileRecord, mrpt::nav) IMPLEMENTS_SERIALIZABLE(CHolonomicFullEval
Structure to hold the parameters of a pinhole stereo camera model.
Definition: TStereoCamera.h:25
This class allows loading and storing values and vectors of different types from a configuration text...
unsigned char uint8_t
Definition: rptypes.h:43
This class implements a config file-like interface over a memory-stored string list.
void getContent(std::string &str) const
Return the current contents of the virtual "config file".
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:38
This base provides a set of functions for maths stuff.
Definition: CArrayNumeric.h:19
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
std::string dumpAsText() const
Dumps all the parameters as a multi-line string, with the same format than saveToConfigFile.
int version
Definition: mrpt_jpeglib.h:898
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,qz).
Definition: CPose3DQuat.h:41
GLsizei const GLchar ** string
Definition: glext.h:3919
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Definition: CPoint.h:17
void loadFromConfigFile(const std::string &section, const mrpt::utils::CConfigFileBase &cfg)
Load all the params from a config source, in the same format that used in saveToConfigFile().
void readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
void write(const std::string &section, const std::string &name, const data_t &value, const int name_padding_width=-1, const int value_padding_width=-1, const std::string &comment=std::string())
void saveToConfigFile(const std::string &section, mrpt::utils::CConfigFileBase &cfg) const
Save all params to a plain text config file in this format:
GLuint in
Definition: glext.h:6301



Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020