35 if (
this == &o)
return *
this;
44 m_observations.clear();
51 out.WriteAs<uint32_t>(m_observations.size());
52 for (
const auto& o : m_observations)
82 m_observations.resize(n);
84 m_observations.begin(), m_observations.end(),
89 for (i = 0; i < n; i++)
90 m_observations[i]->timestamp = tempTimeStamp;
108 for (
auto it =
begin(); it !=
end(); ++it)
111 newObs.reset(dynamic_cast<CObservation*>(newObs->clone()));
112 m_observations.push_back(
123 m_observations.push_back(obs);
132 m_observations.push_back(obs);
141 m_observations.push_back(obs);
152 "Index %u out of range.", static_cast<unsigned>(idx));
155 auto it =
begin() + idx;
157 m_observations.erase(it);
168 auto it =
begin() + idx;
176 auto it =
begin() + idx;
190 return m_observations.erase(it);
198 const std::string& label,
size_t idx)
const 202 size_t foundCount = 0;
203 for (
const auto& it : *
this)
204 if (!
os::_strcmpi(it->sensorLabel.c_str(), label.c_str()))
205 if (foundCount++ == idx)
return it;
226 for (
auto it =
begin(); it !=
end();)
228 if (!
os::_strcmpi((*it)->sensorLabel.c_str(), label.c_str()))
255 throw std::runtime_error(
256 "[CSensoryFrame::buildAuxPointsMap] ERROR: This function needs " 257 "linking against mrpt-maps.\n");
259 for (
const auto& it : *
this)
261 (*ptr_internal_build_points_map_from_scan2D)(
270 for (
const auto& it : *
this)
271 anyone |= it->insertObservationInto(theMap, robotPose);
void clear()
Clear all current observations.
void insert(const CObservation::Ptr &obs)
Inserts a new observation to the list: The pointer to the objects is copied, thus DO NOT delete the p...
std::deque< CObservation::Ptr >::iterator iterator
You can use CSensoryFrame::begin to get a iterator to the first element.
void eraseByIndex(size_t idx)
Removes the i'th observation in the list (0=first).
void push_back(const CObservation::Ptr &obs)
Inserts a new observation to the list: The pointer to the objects is copied, thus DO NOT delete the p...
scan2pts_functor ptr_internal_build_points_map_from_scan2D
size_t size(const MATRIXLIKE &m, const int dim)
#define ASSERT_BELOW_(__A, __B)
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
CSensoryFrame & operator=(const CSensoryFrame &o)
Copy.
mrpt::maps::CMetricMap::Ptr m_cachedMap
A points map, build only under demand by the methods getAuxPointsMap() and buildAuxPointsMap().
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
iterator erase(const iterator &it)
Removes the given observation in the list, and return an iterator to the next element (or this->end()...
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
#define ASSERT_(f)
Defines an assertion mechanism.
mrpt::Clock::time_point TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
const CObservation::Ptr & getObservationByIndex(size_t idx) const
Returns the i'th observation in the list (0=first).
void swap(CSensoryFrame &sf)
Efficiently swaps the contents of two objects.
This namespace contains representation of robot actions and observations.
Declares a class for storing a "sensory frame", a set of "observations" taken by the robot approximat...
#define IS_CLASS(obj, class_name)
True if the given reference to object (derived from mrpt::rtti::CObject) is of the given class...
std::shared_ptr< CObservation > Ptr
void operator+=(const CSensoryFrame &sf)
You can use "sf1+=sf2;" to add observations in sf2 to sf1.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
const_iterator end() const
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
const_iterator begin() const
Virtual base class for "archives": classes abstracting I/O streams.
Declares a virtual base class for all metric maps storage classes.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
mrpt::vision::TStereoCalibResults out
void(*)(const mrpt::obs::CObservation2DRangeScan &obs, mrpt::maps::CMetricMap::Ptr &out_map, const void *insertOps) scan2pts_functor
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
CObservation::Ptr getObservationBySensorLabel(const std::string &label, size_t idx=0) const
Returns the i'th observation in the list with the given "sensorLabel" (0=first).
size_t ReadBufferFixEndianness(T *ptr, size_t ElementCount)
Reads a sequence of elemental datatypes, taking care of reordering their bytes from the MRPT stream s...
bool insertObservationsInto(mrpt::maps::CMetricMap *theMap, const mrpt::poses::CPose3D *robotPose=nullptr) const
Insert all the observations in this SF into a metric map or any kind (see mrpt::maps::CMetricMap).
void clear()
Clear the contents of this container.
std::deque< CObservation::Ptr > m_observations
The set of observations taken at the same time instant.
#define INVALID_TIMESTAMP
Represents an invalid timestamp, where applicable.
void eraseByLabel(const std::string &label)
Removes all the observations that match a given sensorLabel.
int _strcmpi(const char *str1, const char *str2) noexcept
An OS-independent version of strcmpi.
void internal_buildAuxPointsMap(const void *options=nullptr) const
Internal method, used from buildAuxPointsMap()