Change variable name to adapt to code standard and added

stream operator for LidarDetection
This commit is contained in:
Daniel Santos-Olivan 2020-07-07 18:28:42 +02:00 committed by Marc Garcia Puig
parent e292109879
commit 1926b68e70
4 changed files with 17 additions and 9 deletions

View File

@ -22,7 +22,7 @@ namespace pointcloud {
DEBUG_ASSERT(std::distance(begin, end) >= 0);
WriteHeader(out, static_cast<size_t>(std::distance(begin, end)));
for (; begin != end; ++begin) {
out << begin->Point.x << ' ' << begin->Point.y << ' ' << begin->Point.z << ' ' << begin->intensity << '\n';
out << begin->point.x << ' ' << begin->point.y << ' ' << begin->point.z << ' ' << begin->intensity << '\n';
}
}

View File

@ -22,7 +22,6 @@ namespace data {
using Super = Array<s11n::LidarDetection>;
protected:
using Serializer = s11n::LidarSerializer;
friend Serializer;

View File

@ -42,13 +42,13 @@ namespace s11n {
class LidarDetection {
public:
geom::Location Point;
geom::Location point;
float intensity;
LidarDetection(float x, float y, float z, float intensity) :
Point(x, y, z), intensity{intensity} { }
point(x, y, z), intensity{intensity} { }
LidarDetection(geom::Location p, float intensity) :
Point(p), intensity{intensity} { }
point(p), intensity{intensity} { }
};
class LidarMeasurement {
@ -109,9 +109,9 @@ namespace s11n {
for (auto idxChannel = 0u; idxChannel < GetChannelCount(); ++idxChannel) {
_header[Index::SIZE + idxChannel] = static_cast<uint32_t>(_aux_points.size());
for (auto& pt : _aux_points[idxChannel]) {
_points.emplace_back(pt.Point.x);
_points.emplace_back(pt.Point.y);
_points.emplace_back(pt.Point.z);
_points.emplace_back(pt.point.x);
_points.emplace_back(pt.point.y);
_points.emplace_back(pt.point.z);
_points.emplace_back(pt.intensity);
}
}

View File

@ -128,6 +128,15 @@ namespace s11n {
return out;
}
std::ostream &operator<<(std::ostream &out, const LidarDetection &det) {
out << "LidarDetection(x=" << std::to_string(det.point.x)
<< ", y=" << std::to_string(det.point.y)
<< ", z=" << std::to_string(det.point.z)
<< ", intensity=" << std::to_string(det.intensity)
<< ')';
return out;
}
} // namespace s11n
} // namespace sensor
} // namespace carla
@ -320,7 +329,7 @@ void export_sensor_data() {
;
class_<css::LidarDetection>("LidarDetection")
.def_readwrite("point", &css::LidarDetection::Point)
.def_readwrite("point", &css::LidarDetection::point)
.def_readwrite("intensity", &css::LidarDetection::intensity)
.def(self_ns::str(self_ns::self))
;