MRPT  2.0.4
CObservation.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "obs-precomp.h" // Precompiled headers
11 
12 #include <mrpt/obs/CObservation.h>
13 #include <mrpt/poses/CPose3D.h>
15 #include <mrpt/system/os.h>
16 #include <iomanip>
17 
18 using namespace mrpt::obs;
19 using namespace mrpt::poses;
20 using namespace mrpt::math;
21 
23 
24 void CObservation::getSensorPose(mrpt::math::TPose3D& out_sensorPose) const
25 {
26  CPose3D p;
27  getSensorPose(p);
28  out_sensorPose = p.asTPose();
29 }
30 
32 {
33  setSensorPose(CPose3D(newSensorPose));
34 }
35 
37 {
38  std::swap(timestamp, o.timestamp);
39  std::swap(sensorLabel, o.sensorLabel);
40 }
41 
42 void CObservation::getDescriptionAsText(std::ostream& o) const
43 {
44  using namespace mrpt::system; // for the TTimeStamp << op
45 
46  o << mrpt::format(
47  "Timestamp (UTC): %s\n"
48  " (as time_t): %.09f\n",
49  mrpt::system::dateTimeToString(timestamp).c_str(),
50  mrpt::Clock::toDouble(timestamp));
51 
52  o << " (as TTimestamp): " << timestamp
53  << "\n"
54  "Sensor label: '"
55  << sensorLabel << "'"
56  << "\n\n";
57 }
58 
60 {
61  std::stringstream ss;
62  getDescriptionAsText(ss);
63  return ss.str();
64 }
os.h
mrpt::obs::CObservation::sensorLabel
std::string sensorLabel
An arbitrary label that can be used to identify the sensor.
Definition: CObservation.h:62
mrpt::system::dateTimeToString
std::string 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:154
mrpt::obs::CObservation::setSensorPose
virtual void setSensorPose(const mrpt::poses::CPose3D &newSensorPose)=0
A general method to change the sensor pose on the robot.
obs-precomp.h
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: BaseAppDataSource.h:15
mrpt::obs::CObservation::getDescriptionAsTextValue
std::string getDescriptionAsTextValue() const
Return by value version of getDescriptionAsText(std::ostream&)
Definition: CObservation.cpp:59
IMPLEMENTS_VIRTUAL_SERIALIZABLE
#define IMPLEMENTS_VIRTUAL_SERIALIZABLE(class_name, base_class, NS)
This must be inserted as implementation of some required members for virtual CSerializable classes:
Definition: CSerializable.h:177
mrpt::poses
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Definition: CHierarchicalMapMHPartition.h:22
mrpt::obs
This namespace contains representation of robot actions and observations.
Definition: CParticleFilter.h:17
mrpt::obs::CObservation::timestamp
mrpt::system::TTimeStamp timestamp
The associated UTC time-stamp.
Definition: CObservation.h:60
mrpt::Clock::toDouble
static double toDouble(const time_point t) noexcept
Converts a timestamp to a UNIX time_t-like number, with fractional part.
Definition: Clock.cpp:106
mrpt::obs::CObservation::getDescriptionAsText
virtual void getDescriptionAsText(std::ostream &o) const
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
Definition: CObservation.cpp:42
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:85
mrpt::poses::CPose3D::asTPose
mrpt::math::TPose3D asTPose() const
Definition: CPose3D.cpp:759
mrpt::math::TPose3D
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
Definition: TPose3D.h:24
CPose3D.h
CObservation.h
mrpt::obs::CObservation
Declares a class that represents any robot's observation.
Definition: CObservation.h:43
mrpt::obs::CObservation::swap
void swap(CObservation &o)
Swap with another observation, ONLY the data defined here in the base class CObservation.
Definition: CObservation.cpp:36
mrpt::math
This base provides a set of functions for maths stuff.
Definition: math/include/mrpt/math/bits_math.h:11
CArchive.h
mrpt::format
std::string std::string format(std::string_view fmt, ARGS &&... args)
Definition: format.h:26
mrpt::system
Definition: backtrace.h:14



Page generated by Doxygen 1.8.17 for MRPT 2.0.4 at Sun Jul 19 15:15:43 UTC 2020