46 o <<
"Homogeneous matrix for the sensor pose wrt vehicle:\n";
50 o <<
"Pointcloud class: ";
57 o <<
pointcloud->GetRuntimeClass()->className <<
"\n";
58 o <<
"Number of points: " <<
pointcloud->size() <<
"\n";
62 o <<
"Pointcloud is stored externally in format `" 132 bool ok = pts->loadFromKittiVelodyneFile(abs_filename);
135 "[kitti format] Error loading lazy-load point cloud " 137 abs_filename.c_str()));
145 data.loadFromTextFile(abs_filename);
146 if (
data.rows() == 0)
148 "Empty external point cloud plain text file? `%s`",
149 abs_filename.c_str());
153 if (
data.cols() == 3 ||
data.cols() == 2)
158 else if (
data.cols() == 6)
163 else if (
data.cols() == 4)
170 "Unexpected number of columns in point cloud file: cols=%u",
171 static_cast<unsigned int>(
data.cols()));
173 pc->resize(
data.rows());
174 std::vector<float> vals(
data.cols());
175 for (
int i = 0; i <
data.rows(); i++)
177 data.extractRow(i, vals);
178 pc->setPointAllFieldsFast(i, vals);
189 auto obj = ar.ReadObject();
195 "[mrpt-serialization format] Error loading " 196 "lazy-load point cloud file: %s",
197 abs_filename.c_str()));
223 std::ofstream f(abs_filename);
225 std::vector<float> row;
226 for (
size_t i = 0; i <
pointcloud->size(); i++)
229 for (
const float v : row) f << v <<
" ";
251 const std::string& fileName,
static Ptr Create(Args &&... args)
T ReadPOD()
Reads a simple POD type and returns by value.
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
A compile-time fixed-size numeric matrix container.
void load() const override
Makes sure all images and other fields which may be externally stored are loaded in memory...
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
#define THROW_EXCEPTION(msg)
An observation from any sensor that can be summarized as a pointcloud.
std::string std::string format(std::string_view fmt, ARGS &&... args)
bool fileExists(const std::string &fileName)
Test if a given file (or directory) exists.
A range or depth 3D scan measurement, as from a time-of-flight range camera or a structured-light dep...
void setSensorPose(const mrpt::poses::CPose3D &p) override
A general method to change the sensor pose on the robot.
mrpt::poses::CPose3D sensorPose
Sensor placement wrt the vehicle/robot.
ExternalStorageFormat m_externally_stored
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
CArchiveStreamBase< STREAM > archiveFrom(STREAM &s)
Helper function to create a templatized wrapper CArchive object for a: MRPT's CStream, std::istream, std::ostream, std::stringstream.
#define ASSERT_(f)
Defines an assertion mechanism.
void unload() override
Unload all images, for the case they being delayed-load images stored in external files (othewise...
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors...
This namespace contains representation of robot actions and observations.
static Ptr Create(Args &&... args)
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism.
std::string m_external_file
void getSensorPose(mrpt::poses::CPose3D &out_sensorPose) const override
A general method to retrieve the sensor pose on the robot.
mrpt::maps::CPointsMap::Ptr pointcloud
The pointcloud.
IMPLEMENTS_SERIALIZABLE(CObservationPointCloud, CObservation, mrpt::obs)
std::string sensorLabel
An arbitrary label that can be used to identify the sensor.
bool isExternallyStored() const
static Ptr Create(Args &&... args)
mrpt::system::TTimeStamp timestamp
The associated UTC time-stamp.
void setAsExternalStorage(const std::string &fileName, const ExternalStorageFormat fmt)
Virtual base class for "archives": classes abstracting I/O streams.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
Plain text, each line has "x y z [i]" coords.
Uses Kitti .bin file format.
is always stored in memory
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
mrpt::vision::TStereoCalibResults out
Declares a class that represents any robot's observation.
Uses mrpt-serialization binary file.
CObservationPointCloud()=default
MATRIX44 getHomogeneousMatrixVal() const
Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (t...
Saves data to a file and transparently compress the data using the given compression level...
void getDescriptionAsText(std::ostream &o) const override
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
This template class provides the basic functionality for a general 2D any-size, resizable container o...
virtual void getDescriptionAsText(std::ostream &o) const
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
static struct FontData data