Main MRPT website > C++ reference for MRPT 1.5.6
CObservation.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 "obs-precomp.h" // Precompiled headers
11 
12 #include <mrpt/obs/CObservation.h>
13 #include <mrpt/utils/CStream.h>
14 #include <mrpt/system/os.h>
16 
17 #include <mrpt/poses/CPose3D.h>
18 #include <iomanip>
19 
20 using namespace mrpt::obs;
21 using namespace mrpt::utils;
22 using namespace mrpt::poses;
23 using namespace mrpt::math;
24 
26 
27 
28 /*---------------------------------------------------------------
29  CONSTRUCTOR
30  ---------------------------------------------------------------*/
32  timestamp( mrpt::system::now() ),
33  sensorLabel()
34 {
35 }
36 
37 
38 void CObservation::getSensorPose( mrpt::math::TPose3D &out_sensorPose ) const
39 {
40  CPose3D p;
41  getSensorPose(p);
42  out_sensorPose = TPose3D(p);
43 }
44 
46 {
47  setSensorPose(CPose3D(newSensorPose));
48 }
49 
51 {
52  std::swap(timestamp, o.timestamp);
53  std::swap(sensorLabel, o.sensorLabel);
54 }
55 
56 void CObservation::getDescriptionAsText(std::ostream &o) const
57 {
58  o << "Timestamp (UTC): " << mrpt::system::dateTimeToString(timestamp) << std::endl;
59  o << " (as time_t): " << std::fixed << std::setprecision(5) << mrpt::system::timestampTotime_t(timestamp) << std::endl;
60  o << " (as TTimestamp): " << timestamp << std::endl;
61  o << "Sensor label: '" << sensorLabel << "'" << std::endl;
62  o << std::endl;
63 }
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:39
mrpt::system::TTimeStamp now()
A shortcut for system::getCurrentTime.
Definition: datetime.h:70
void swap(CObservation &o)
Swap with another observation, ONLY the data defined here in the base class CObservation. It's protected since it'll be only called from child classes that should know what else to swap appart from these common data.
virtual void getDescriptionAsText(std::ostream &o) const
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
virtual void getSensorPose(mrpt::poses::CPose3D &out_sensorPose) const =0
A general method to retrieve the sensor pose on the robot.
#define IMPLEMENTS_VIRTUAL_SERIALIZABLE(class_name, base_class_name, NameSpace)
This must be inserted as implementation of some required members for virtual CSerializable classes: ...
virtual void setSensorPose(const mrpt::poses::CPose3D &newSensorPose)=0
A general method to change the sensor pose on the robot.
GLfloat GLfloat p
Definition: glew.h:10113
std::string sensorLabel
An arbitrary label that can be used to identify the sensor.
mrpt::system::TTimeStamp timestamp
The associated UTC time-stamp. Where available, this should contain the accurate satellite-based time...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:72
Declares a class that represents any robot's observation.
std::string BASE_IMPEXP dateTimeToString(const mrpt::system::TTimeStamp t)
Convert a timestamp into this textual form (UTC time): YEAR/MONTH/DAY,HH:MM:SS.MMM.
Definition: datetime.cpp:247
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
double BASE_IMPEXP timestampTotime_t(const mrpt::system::TTimeStamp t)
Transform from TTimeStamp to standard "time_t" (actually a double number, it can contain fractions of...
Definition: datetime.cpp:53



Page generated by Doxygen 1.8.6 for MRPT 1.5.6 Git: 4c65e84 Tue Apr 24 08:18:17 2018 +0200 at mar abr 24 08:26:17 CEST 2018