diff --git a/include/rgl/api/core.h b/include/rgl/api/core.h index 581969f61..dd7fb3786 100644 --- a/include/rgl/api/core.h +++ b/include/rgl/api/core.h @@ -323,7 +323,15 @@ typedef enum : int32_t typedef enum : int32_t { RGL_FIELD_XYZ_VEC3_F32 = 1, + /** + * Strength of the returned signal captured by the LiDAR sensor. + * It is simulated using intensity textures assigned to entities (see `rgl_entity_set_intensity_texture`). + */ RGL_FIELD_INTENSITY_F32, + /** + * Same as RGL_FIELD_INTENSITY_F32, but uint8_t type. + */ + RGL_FIELD_INTENSITY_U8, RGL_FIELD_IS_HIT_I32, RGL_FIELD_IS_GROUND_I32, RGL_FIELD_RAY_IDX_U32, @@ -343,7 +351,16 @@ typedef enum : int32_t RGL_FIELD_ELEVATION_F32, RGL_FIELD_RING_ID_U16, RGL_FIELD_RETURN_TYPE_U8, + /** + * Seconds have passed since the time of the sensor trigger when this point was measured. + * If velocity distortion is disabled, the time stamp for all points will be zero. + */ RGL_FIELD_TIME_STAMP_F64, + /** + * Nanoseconds have passed since the time of the sensor trigger when this point was measured. + * If velocity distortion is disabled, the time stamp for all points will be zero. + */ + RGL_FIELD_TIME_STAMP_U32, /** * Velocity of the hit point on the entity. @@ -755,7 +772,8 @@ RGL_API rgl_status_t rgl_node_raytrace_configure_mask(rgl_node_t node, const int * @param horizontal_beam_divergence Horizontal beam divergence in radians. * @param vertical_beam_divergence Vertical beam divergence in radians. */ -RGL_API rgl_status_t rgl_node_raytrace_configure_beam_divergence(rgl_node_t node, float horizontal_beam_divergence, float vertical_beam_divergence); +RGL_API rgl_status_t rgl_node_raytrace_configure_beam_divergence(rgl_node_t node, float horizontal_beam_divergence, + float vertical_beam_divergence); /** * Creates or modifies FormatPointsNode. diff --git a/src/RGLFields.hpp b/src/RGLFields.hpp index 5a119ddec..d12d80989 100644 --- a/src/RGLFields.hpp +++ b/src/RGLFields.hpp @@ -40,6 +40,7 @@ typedef unsigned char TextureTexelFormat; #define RAY_IDX_U32 RGL_FIELD_RAY_IDX_U32 #define ENTITY_ID_I32 RGL_FIELD_ENTITY_ID_I32 #define INTENSITY_F32 RGL_FIELD_INTENSITY_F32 +#define INTENSITY_U8 RGL_FIELD_INTENSITY_U8 #define LASER_RETRO_F32 RGL_FIELD_LASER_RETRO_F32 #define RING_ID_U16 RGL_FIELD_RING_ID_U16 #define AZIMUTH_F32 RGL_FIELD_AZIMUTH_F32 @@ -47,6 +48,7 @@ typedef unsigned char TextureTexelFormat; #define DISTANCE_F32 RGL_FIELD_DISTANCE_F32 #define RETURN_TYPE_U8 RGL_FIELD_RETURN_TYPE_U8 #define TIME_STAMP_F64 RGL_FIELD_TIME_STAMP_F64 +#define TIME_STAMP_U32 RGL_FIELD_TIME_STAMP_U32 #define ABSOLUTE_VELOCITY_VEC3_F32 RGL_FIELD_ABSOLUTE_VELOCITY_VEC3_F32 #define RELATIVE_VELOCITY_VEC3_F32 RGL_FIELD_RELATIVE_VELOCITY_VEC3_F32 #define RADIAL_SPEED_F32 RGL_FIELD_RADIAL_SPEED_F32 @@ -70,6 +72,7 @@ inline const std::set& getAllRealFields() RAY_IDX_U32, ENTITY_ID_I32, INTENSITY_F32, + INTENSITY_U8, LASER_RETRO_F32, RING_ID_U16, AZIMUTH_F32, @@ -77,6 +80,7 @@ inline const std::set& getAllRealFields() DISTANCE_F32, RETURN_TYPE_U8, TIME_STAMP_F64, + TIME_STAMP_U32, ABSOLUTE_VELOCITY_VEC3_F32, RELATIVE_VELOCITY_VEC3_F32, RADIAL_SPEED_F32, @@ -117,6 +121,7 @@ FIELD(XYZ_VEC3_F32, Vec3f); FIELD(RAY_IDX_U32, uint32_t); // PCL uses uint32_t FIELD(ENTITY_ID_I32, int32_t); FIELD(INTENSITY_F32, float); +FIELD(INTENSITY_U8, uint8_t); FIELD(LASER_RETRO_F32, float); FIELD(IS_HIT_I32, int32_t); // Signed may be faster FIELD(IS_GROUND_I32, int32_t); // Signed may be faster @@ -126,6 +131,7 @@ FIELD(ELEVATION_F32, float); FIELD(RING_ID_U16, uint16_t); FIELD(RETURN_TYPE_U8, uint8_t); FIELD(TIME_STAMP_F64, double); +FIELD(TIME_STAMP_U32, uint32_t); FIELD(PADDING_8, uint8_t); FIELD(PADDING_16, uint16_t); FIELD(PADDING_32, uint32_t); @@ -149,6 +155,7 @@ inline std::size_t getFieldSize(rgl_field_t type) case IS_HIT_I32: return Field::size; case IS_GROUND_I32: return Field::size; case INTENSITY_F32: return Field::size; + case INTENSITY_U8: return Field::size; case LASER_RETRO_F32: return Field::size; case RING_ID_U16: return Field::size; case AZIMUTH_F32: return Field::size; @@ -156,6 +163,7 @@ inline std::size_t getFieldSize(rgl_field_t type) case DISTANCE_F32: return Field::size; case RETURN_TYPE_U8: return Field::size; case TIME_STAMP_F64: return Field::size; + case TIME_STAMP_U32: return Field::size; case ABSOLUTE_VELOCITY_VEC3_F32: return Field::size; case RELATIVE_VELOCITY_VEC3_F32: return Field::size; case RADIAL_SPEED_F32: return Field::size; @@ -206,6 +214,7 @@ inline std::shared_ptr createArray(rgl_field_t type, Args&&... args) case RAY_IDX_U32: return Subclass::type>::create(std::forward(args)...); case ENTITY_ID_I32: return Subclass::type>::create(std::forward(args)...); case INTENSITY_F32: return Subclass::type>::create(std::forward(args)...); + case INTENSITY_U8: return Subclass::type>::create(std::forward(args)...); case LASER_RETRO_F32: return Subclass::type>::create(std::forward(args)...); case RING_ID_U16: return Subclass::type>::create(std::forward(args)...); case AZIMUTH_F32: return Subclass::type>::create(std::forward(args)...); @@ -213,6 +222,7 @@ inline std::shared_ptr createArray(rgl_field_t type, Args&&... args) case DISTANCE_F32: return Subclass::type>::create(std::forward(args)...); case RETURN_TYPE_U8: return Subclass::type>::create(std::forward(args)...); case TIME_STAMP_F64: return Subclass::type>::create(std::forward(args)...); + case TIME_STAMP_U32: return Subclass::type>::create(std::forward(args)...); case IS_HIT_I32: return Subclass::type>::create(std::forward(args)...); case IS_GROUND_I32: return Subclass::type>::create(std::forward(args)...); case ABSOLUTE_VELOCITY_VEC3_F32: @@ -240,6 +250,7 @@ inline std::string toString(rgl_field_t type) case RAY_IDX_U32: return "RAY_IDX_U32"; case ENTITY_ID_I32: return "ENTITY_ID_I32"; case INTENSITY_F32: return "INTENSITY_F32"; + case INTENSITY_U8: return "INTENSITY_U8"; case LASER_RETRO_F32: return "LASER_RETRO_F32"; case RING_ID_U16: return "RING_ID_U16"; case AZIMUTH_F32: return "AZIMUTH_F32"; @@ -247,6 +258,7 @@ inline std::string toString(rgl_field_t type) case DISTANCE_F32: return "DISTANCE_F32"; case RETURN_TYPE_U8: return "RETURN_TYPE_U8"; case TIME_STAMP_F64: return "TIME_STAMP_F64"; + case TIME_STAMP_U32: return "TIME_STAMP_U32"; case ABSOLUTE_VELOCITY_VEC3_F32: return "ABSOLUTE_VELOCITY_VEC3_F32"; case RELATIVE_VELOCITY_VEC3_F32: return "RELATIVE_VELOCITY_VEC3_F32"; case RADIAL_SPEED_F32: return "RADIAL_SPEED_F32"; @@ -278,6 +290,7 @@ inline std::vector toRos2Fields(rgl_field_t type) case RAY_IDX_U32: return {sensor_msgs::msg::PointField::UINT32}; case ENTITY_ID_I32: return {sensor_msgs::msg::PointField::INT32}; case INTENSITY_F32: return {sensor_msgs::msg::PointField::FLOAT32}; + case INTENSITY_U8: return {sensor_msgs::msg::PointField::UINT8}; case LASER_RETRO_F32: return {sensor_msgs::msg::PointField::FLOAT32}; case RING_ID_U16: return {sensor_msgs::msg::PointField::UINT16}; case AZIMUTH_F32: return {sensor_msgs::msg::PointField::FLOAT32}; @@ -285,6 +298,7 @@ inline std::vector toRos2Fields(rgl_field_t type) case DISTANCE_F32: return {sensor_msgs::msg::PointField::FLOAT32}; case RETURN_TYPE_U8: return {sensor_msgs::msg::PointField::UINT8}; case TIME_STAMP_F64: return {sensor_msgs::msg::PointField::FLOAT64}; + case TIME_STAMP_U32: return {sensor_msgs::msg::PointField::UINT32}; case ABSOLUTE_VELOCITY_VEC3_F32: return {sensor_msgs::msg::PointField::FLOAT32, sensor_msgs::msg::PointField::FLOAT32, sensor_msgs::msg::PointField::FLOAT32}; @@ -318,20 +332,25 @@ inline std::vector toRos2Fields(rgl_field_t type) inline std::vector toRos2Names(rgl_field_t type) { + // clang-format off switch (type) { case XYZ_VEC3_F32: return {"x", "y", "z"}; case IS_HIT_I32: return {"is_hit"}; case IS_GROUND_I32: return {"is_ground"}; case ENTITY_ID_I32: return {"entity_id"}; case RAY_IDX_U32: return {"ray_idx"}; - case INTENSITY_F32: return {"intensity"}; + case INTENSITY_F32: + case INTENSITY_U8: + return {"intensity"}; case LASER_RETRO_F32: return {"laser_retro"}; - case RING_ID_U16: return {"ring"}; + case RING_ID_U16: return {"channel"}; case AZIMUTH_F32: return {"azimuth"}; case ELEVATION_F32: return {"elevation"}; case DISTANCE_F32: return {"distance"}; case RETURN_TYPE_U8: return {"return_type"}; - case TIME_STAMP_F64: return {"time_stamp"}; + case TIME_STAMP_F64: + case TIME_STAMP_U32: + return {"time_stamp"}; case ABSOLUTE_VELOCITY_VEC3_F32: return {"abs_vx", "abs_vy", "abs_vz"}; case RELATIVE_VELOCITY_VEC3_F32: return {"rel_vx", "rel_vy", "rel_vz"}; case RADIAL_SPEED_F32: return {"radial_speed"}; @@ -346,6 +365,7 @@ inline std::vector toRos2Names(rgl_field_t type) case PADDING_16: return {}; case PADDING_32: return {}; } + // clang-format on throw std::invalid_argument(fmt::format("toRos2Names: unknown RGL field {}", type)); } diff --git a/src/gpu/RaytraceRequestContext.hpp b/src/gpu/RaytraceRequestContext.hpp index 696a0fa3b..a3c22e043 100644 --- a/src/gpu/RaytraceRequestContext.hpp +++ b/src/gpu/RaytraceRequestContext.hpp @@ -45,7 +45,6 @@ struct RaytraceRequestContext const int8_t* rayMask; OptixTraversableHandle scene; - double sceneTime; float sceneDeltaTime; // Output @@ -54,9 +53,11 @@ struct RaytraceRequestContext Field::type* rayIdx; Field::type* ringIdx; Field::type* distance; - Field::type* intensity; + Field::type* intensityF32; + Field::type* intensityU8; Field::type* laserRetro; - Field::type* timestamp; + Field::type* timestampF64; + Field::type* timestampU32; Field::type* entityId; Field::type* pointAbsVelocity; Field::type* pointRelVelocity; diff --git a/src/gpu/optixPrograms.cu b/src/gpu/optixPrograms.cu index a1687abba..cdd6b105c 100644 --- a/src/gpu/optixPrograms.cu +++ b/src/gpu/optixPrograms.cu @@ -39,7 +39,8 @@ __device__ void saveRayResult(const Vec3f& xyz, float distance, float intensity, float laserRetro); __device__ void saveNonHitRayResult(float nonHitDistance); __device__ void shootSamplingRay(const Mat3x4f& ray, float maxRange, unsigned sampleBeamIdx); -__device__ Mat3x4f makeBeamSampleRayTransform(float hHalfDivergenceRad, float vHalfDivergenceRad, unsigned layerIdx, unsigned vertexIdx); +__device__ Mat3x4f makeBeamSampleRayTransform(float hHalfDivergenceRad, float vHalfDivergenceRad, unsigned layerIdx, + unsigned vertexIdx); extern "C" __global__ void __raygen__() { @@ -72,6 +73,16 @@ extern "C" __global__ void __raygen__() ctx.elevation[rayIdx] = rayLocal.toRotationXOrderZXYLeftHandRad(); } + if (ctx.timestampF64 != nullptr) { + ctx.timestampF64[rayIdx] = ctx.doApplyDistortion ? ctx.rayTimeOffsetsMs[rayIdx] * 1e-3f : 0; // in seconds + } + if (ctx.timestampU32 != nullptr) { + ctx.timestampU32[rayIdx] = ctx.doApplyDistortion ? + static_cast(ctx.rayTimeOffsetsMs[rayIdx] * 1e6f) // in nanoseconds + : + 0; + } + if (ctx.doApplyDistortion) { // Velocities are in the local frame. Need to operate on rays in local frame. // Ray time offsets are in milliseconds, velocities are in unit per seconds. @@ -90,7 +101,8 @@ extern "C" __global__ void __raygen__() // Shoot multi-return sampling rays for (int layerIdx = 0; layerIdx < MULTI_RETURN_BEAM_LAYERS; ++layerIdx) { for (int vertexIdx = 0; vertexIdx < MULTI_RETURN_BEAM_VERTICES; vertexIdx++) { - Mat3x4f sampleRay = ray * makeBeamSampleRayTransform(ctx.hBeamHalfDivergenceRad, ctx.vBeamHalfDivergenceRad, layerIdx, vertexIdx); + Mat3x4f sampleRay = ray * makeBeamSampleRayTransform(ctx.hBeamHalfDivergenceRad, ctx.vBeamHalfDivergenceRad, + layerIdx, vertexIdx); // Sampling rays indexes start from 1, 0 is reserved for the primary ray const unsigned beamSampleRayIdx = 1 + layerIdx * MULTI_RETURN_BEAM_VERTICES + vertexIdx; shootSamplingRay(sampleRay, maxRange, beamSampleRayIdx); @@ -146,8 +158,10 @@ extern "C" __global__ void __closesthit__() if (!ctx.doApplyDistortion) { return hitWorldRaytraced; } - Mat3x4f sampleRayTf = beamSampleRayIdx == 0 ? Mat3x4f::identity() : - makeBeamSampleRayTransform(ctx.hBeamHalfDivergenceRad, ctx.vBeamHalfDivergenceRad, circleIdx, vertexIdx); + Mat3x4f sampleRayTf = beamSampleRayIdx == 0 ? + Mat3x4f::identity() : + makeBeamSampleRayTransform(ctx.hBeamHalfDivergenceRad, ctx.vBeamHalfDivergenceRad, circleIdx, + vertexIdx); Mat3x4f undistortedRay = ctx.raysWorld[beamIdx] * sampleRayTf; Vec3f undistortedOrigin = undistortedRay * Vec3f{0, 0, 0}; Vec3f undistortedDir = undistortedRay * Vec3f{0, 0, 1} - undistortedOrigin; @@ -175,7 +189,7 @@ extern "C" __global__ void __closesthit__() const float incidentAngle = acosf(fabs(wNormal.dot(rayDir))); float intensity = 0; - bool isIntensityRequested = ctx.intensity != nullptr; + bool isIntensityRequested = ctx.intensityF32 != nullptr || ctx.intensityU8 != nullptr; if (isIntensityRequested && entityData.textureCoords != nullptr && entityData.texture != 0) { assert(triangleIndices.x() < entityData.textureCoordsCount); assert(triangleIndices.y() < entityData.textureCoordsCount); @@ -258,14 +272,17 @@ __device__ void shootSamplingRay(const Mat3x4f& ray, float maxRange, unsigned in optixTrace(ctx.scene, origin, dir, 0.0f, maxRange, 0.0f, OptixVisibilityMask(255), flags, 0, 1, 0, beamSampleRayIdx); } -__device__ Mat3x4f makeBeamSampleRayTransform(float hHalfDivergenceRad, float vHalfDivergenceRad, unsigned int layerIdx, unsigned int vertexIdx) +__device__ Mat3x4f makeBeamSampleRayTransform(float hHalfDivergenceRad, float vHalfDivergenceRad, unsigned int layerIdx, + unsigned int vertexIdx) { if (ctx.hBeamHalfDivergenceRad == 0.0f && ctx.vBeamHalfDivergenceRad == 0.0f) { return Mat3x4f::identity(); } - const float hCurrentHalfDivergenceRad = hHalfDivergenceRad * (1.0f - static_cast(layerIdx) / MULTI_RETURN_BEAM_LAYERS); - const float vCurrentHalfDivergenceRad = vHalfDivergenceRad * (1.0f - static_cast(layerIdx) / MULTI_RETURN_BEAM_LAYERS); + const float hCurrentHalfDivergenceRad = hHalfDivergenceRad * + (1.0f - static_cast(layerIdx) / MULTI_RETURN_BEAM_LAYERS); + const float vCurrentHalfDivergenceRad = vHalfDivergenceRad * + (1.0f - static_cast(layerIdx) / MULTI_RETURN_BEAM_LAYERS); const float angleStep = 2.0f * static_cast(M_PI) / MULTI_RETURN_BEAM_VERTICES; @@ -309,11 +326,12 @@ __device__ void saveRayResult(const Vec3f& xyz, float distance, float intensity, if (ctx.distance != nullptr) { ctx.distance[beamIdx] = distance; } - if (ctx.intensity != nullptr) { - ctx.intensity[beamIdx] = intensity; + if (ctx.intensityF32 != nullptr) { + ctx.intensityF32[beamIdx] = intensity; } - if (ctx.timestamp != nullptr) { - ctx.timestamp[beamIdx] = ctx.sceneTime; + if (ctx.intensityU8 != nullptr) { + // intensity < 0 not possible + ctx.intensityU8[beamIdx] = intensity < UINT8_MAX ? static_cast(std::round(intensity)) : UINT8_MAX; } if (ctx.entityId != nullptr) { ctx.entityId[beamIdx] = isFinite ? objectID : RGL_ENTITY_INVALID_ID; diff --git a/src/graph/RaytraceNode.cpp b/src/graph/RaytraceNode.cpp index a402ff308..d90189a16 100644 --- a/src/graph/RaytraceNode.cpp +++ b/src/graph/RaytraceNode.cpp @@ -88,6 +88,7 @@ void RaytraceNode::enqueueExecImpl() // Note: requestCtx is a HostPinnedArray just for convenience (Host meme accessible from GPU), may be optimized. requestCtxHst->resize(1, true, false); + requestCtxHst->at(0) = RaytraceRequestContext{ .sensorLinearVelocityXYZ = sensorLinearVelocityXYZ, .sensorAngularVelocityRPY = sensorAngularVelocityRPY, @@ -106,16 +107,17 @@ void RaytraceNode::enqueueExecImpl() .rayTimeOffsetsCount = timeOffsets.has_value() ? (*timeOffsets)->getCount() : 0, .rayMask = (rayMask != nullptr) ? rayMask->getReadPtr() : nullptr, .scene = sceneAS, - .sceneTime = Scene::instance().getTime().value_or(Time::zero()).asSeconds(), .sceneDeltaTime = static_cast(Scene::instance().getDeltaTime().value_or(Time::zero()).asSeconds()), .xyz = getPtrTo(), .isHit = getPtrTo(), .rayIdx = getPtrTo(), .ringIdx = getPtrTo(), .distance = getPtrTo(), - .intensity = getPtrTo(), + .intensityF32 = getPtrTo(), + .intensityU8 = getPtrTo(), .laserRetro = getPtrTo(), - .timestamp = getPtrTo(), + .timestampF64 = getPtrTo(), + .timestampU32 = getPtrTo(), .entityId = getPtrTo(), .pointAbsVelocity = getPtrTo(), .pointRelVelocity = getPtrTo(), @@ -128,7 +130,6 @@ void RaytraceNode::enqueueExecImpl() .vBeamHalfDivergenceRad = vBeamHalfDivergenceRad, .mrSamples = mrSamples.getPointers(), }; - requestCtxDev->copyFrom(requestCtxHst); CUdeviceptr pipelineArgsPtr = requestCtxDev->getDeviceReadPtr(); std::size_t pipelineArgsSize = requestCtxDev->getSizeOf() * requestCtxDev->getCount(); diff --git a/test/include/helpers/fieldGenerators.hpp b/test/include/helpers/fieldGenerators.hpp index 02530eabf..8de8a1741 100644 --- a/test/include/helpers/fieldGenerators.hpp +++ b/test/include/helpers/fieldGenerators.hpp @@ -30,9 +30,12 @@ static std::function::type(int)> genCoord = [](int i) { return Vec3f(static_cast(i) / (static_cast(i) + 1), static_cast(i) / (static_cast(i) + 2), static_cast(i) / (static_cast(i) + 3)); }; -static std::function::type(int)> genIntensity = [](int i) { +static std::function::type(int)> genIntensityF32 = [](int i) { return static_cast(i) / (static_cast(i + 1)); }; +static std::function::type(int)> genIntensityU8 = [](int i) { + return i % std::numeric_limits::type>::max(); +}; static std::function::type(int)> genLaserRetro = [](int i) { return static_cast(i) / (static_cast(i + 1)); }; @@ -45,7 +48,10 @@ static std::function::type(int)> genElevation = [](int i) { static std::function::type(int)> genDistance = [](int i) { return static_cast(i) / (static_cast(i + 1)); }; -static std::function::type(int)> genTimeStamp = [](int i) { +static std::function::type(int)> genTimeStampF64 = [](int i) { + return static_cast(i) / (static_cast(i + 1)); +}; +static std::function::type(int)> genTimeStampU32 = [](int i) { return static_cast(i) / (static_cast(i + 1)); }; static std::function::type(int)> genRayIdx = [](int i) { return i; }; diff --git a/test/include/helpers/testPointCloud.hpp b/test/include/helpers/testPointCloud.hpp index 7754f28bf..194200335 100644 --- a/test/include/helpers/testPointCloud.hpp +++ b/test/include/helpers/testPointCloud.hpp @@ -287,14 +287,16 @@ class TestPointCloud {IS_GROUND_I32, [&](std::size_t count) {setFieldValues(generateFieldValues(count, genRandGround));}}, {RAY_IDX_U32, [&](std::size_t count) {setFieldValues(generateFieldValues(count, genRayIdx));}}, {ENTITY_ID_I32, [&](std::size_t count) {setFieldValues(generateFieldValues(count, genEntityId));}}, - {INTENSITY_F32, [&](std::size_t count) {setFieldValues(generateFieldValues(count, genIntensity));}}, + {INTENSITY_F32, [&](std::size_t count) {setFieldValues(generateFieldValues(count, genIntensityF32));}}, + {INTENSITY_U8, [&](std::size_t count) {setFieldValues(generateFieldValues(count, genIntensityU8));}}, {LASER_RETRO_F32, [&](std::size_t count) {setFieldValues(generateFieldValues(count, genLaserRetro));}}, {RING_ID_U16, [&](std::size_t count) {setFieldValues(generateFieldValues(count, genRingId));}}, {AZIMUTH_F32, [&](std::size_t count) {setFieldValues(generateFieldValues(count, genAzimuth));}}, {ELEVATION_F32, [&](std::size_t count) {setFieldValues(generateFieldValues(count, genElevation));}}, {DISTANCE_F32, [&](std::size_t count) {setFieldValues(generateFieldValues(count, genDistance));}}, {RETURN_TYPE_U8, [&](std::size_t count) {setFieldValues(generateFieldValues(count, genReturnType));}}, - {TIME_STAMP_F64, [&](std::size_t count) {setFieldValues(generateFieldValues(count, genTimeStamp));}}, + {TIME_STAMP_F64, [&](std::size_t count) {setFieldValues(generateFieldValues(count, genTimeStampF64));}}, + {TIME_STAMP_U32, [&](std::size_t count) {setFieldValues(generateFieldValues(count, genTimeStampU32));}}, {RADIAL_SPEED_F32, [&](std::size_t count) {setFieldValues(generateFieldValues(count, genRadialSpeed));}}, {ABSOLUTE_VELOCITY_VEC3_F32, [&](std::size_t count) {setFieldValues(generateFieldValues(count, genAbsoluteVelocity));}}, {RELATIVE_VELOCITY_VEC3_F32, [&](std::size_t count) {setFieldValues(generateFieldValues(count, genRelativeVelocity));}}, diff --git a/test/src/graph/nodes/FormatPointsNodeTest.cpp b/test/src/graph/nodes/FormatPointsNodeTest.cpp index 7064fd099..12b8a8d4f 100644 --- a/test/src/graph/nodes/FormatPointsNodeTest.cpp +++ b/test/src/graph/nodes/FormatPointsNodeTest.cpp @@ -230,17 +230,13 @@ TEST_F(FormatPointsNodeTest, validate_results_after_changing_format) Mat3x4f::TRS({0.2, 0, 0}).toRGL(), Mat3x4f::TRS({0.3, 0, 0}).toRGL(), Mat3x4f::TRS({0.4, 0, 0}).toRGL()}; rgl_mat3x4f lidarPoseTf = Mat3x4f::identity().toRGL(); - std::vector formatFields = {XYZ_VEC3_F32, PADDING_32, TIME_STAMP_F64}; + std::vector formatFields = {XYZ_VEC3_F32, PADDING_32}; struct FormatStruct { Field::type xyz; Field::type padding; - Field::type timestamp; } formatStruct; - Time timestamp = Time::seconds(1.5); - EXPECT_RGL_SUCCESS(rgl_scene_set_time(nullptr, timestamp.asNanoseconds())); - EXPECT_RGL_SUCCESS(rgl_node_rays_from_mat3x4f(&useRays, rays.data(), rays.size())); EXPECT_RGL_SUCCESS(rgl_node_rays_transform(&lidarPose, &lidarPoseTf)); EXPECT_RGL_SUCCESS(rgl_node_raytrace(&raytrace, nullptr)); @@ -265,7 +261,6 @@ TEST_F(FormatPointsNodeTest, validate_results_after_changing_format) EXPECT_NEAR(formatData[i].xyz[0], rays[i].value[0][3], EPSILON_F); EXPECT_NEAR(formatData[i].xyz[1], rays[i].value[1][3], EPSILON_F); EXPECT_NEAR(formatData[i].xyz[2], EXPECTED_HITPOINT_Z, EPSILON_F); - EXPECT_EQ(formatData[i].timestamp, timestamp.asSeconds()); } // Test if fields update is propagated over graph properly @@ -294,7 +289,6 @@ TEST_F(FormatPointsNodeTest, validate_results_after_changing_format) EXPECT_NEAR(formatDataEx[i].xyz[1], rays[i].value[1][3], EPSILON_F); EXPECT_NEAR(formatDataEx[i].xyz[2], EXPECTED_HITPOINT_Z, EPSILON_F); EXPECT_NEAR(formatDataEx[i].distance, EXPECTED_RAY_DISTANCE, EPSILON_F); - EXPECT_EQ(formatDataEx[i].timestamp, timestamp.asSeconds()); } } diff --git a/test/src/helpers/pointsTest.cpp b/test/src/helpers/pointsTest.cpp index aa8b338a2..77fdaa6e9 100644 --- a/test/src/helpers/pointsTest.cpp +++ b/test/src/helpers/pointsTest.cpp @@ -44,9 +44,9 @@ class PointCloudTest : public ::testing::TestWithParam std::vector points; points.reserve(pointsCount); for (int i = 0; i < pointsCount; i++) { - points.emplace_back(TestPointStruct{genCoord(i), genHalfHit(i), genRayIdx(i), genEntityId(i), genIntensity(i), + points.emplace_back(TestPointStruct{genCoord(i), genHalfHit(i), genRayIdx(i), genEntityId(i), genIntensityF32(i), genRingId(i), genAzimuth(i), genDistance(i), genReturnType(i), - genTimeStamp(i)}); + genTimeStampF64(i)}); } return points; } @@ -57,12 +57,12 @@ class PointCloudTest : public ::testing::TestWithParam isHit = generateFieldValues(pointsCount, genHalfHit); rayIdx = generateFieldValues(pointsCount, genRayIdx); entityId = generateFieldValues(pointsCount, genEntityId); - intensity = generateFieldValues(pointsCount, genIntensity); + intensity = generateFieldValues(pointsCount, genIntensityF32); ringId = generateFieldValues(pointsCount, genRingId); azimuth = generateFieldValues(pointsCount, genAzimuth); distance = generateFieldValues(pointsCount, genDistance); returnType = generateFieldValues(pointsCount, genReturnType); - timeStamp = generateFieldValues(pointsCount, genTimeStamp); + timeStamp = generateFieldValues(pointsCount, genTimeStampF64); } void setFieldValues(TestPointCloud& pointCloud)