Skip to content

Commit 1cc5bec

Browse files
authored
Fix relative velocity (and radial speed) calculation (#267)
* Fix relative velocity calculation * Remove incorrect validation check in Ros2PublishPointVelocityMarkersNode
1 parent a0dfb68 commit 1cc5bec

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

extensions/ros2/src/graph/Ros2PublishPointVelocityMarkersNode.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ void Ros2PublishPointVelocityMarkersNode::ros2ValidateImpl()
3434
if (!input->isDense()) {
3535
throw InvalidPipeline(fmt::format("{} requires a compacted point cloud (dense)", getName()));
3636
}
37-
38-
if (!input->hasField(RGL_FIELD_DYNAMIC_FORMAT)) {
39-
auto msg = fmt::format("{} requires a formatted point cloud", getName());
40-
throw InvalidPipeline(msg);
41-
}
4237
}
4338
void Ros2PublishPointVelocityMarkersNode::ros2EnqueueExecImpl()
4439
{

src/gpu/optixPrograms.cu

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,10 @@ extern "C" __global__ void __closesthit__()
264264
Vec3f absPointVelocityInSensorFrame = ctx.rayOriginToWorld.rotation().inverse() * absPointVelocity;
265265
Vec3f relPointVelocityBasedOnSensorLinearVelocity = absPointVelocityInSensorFrame - ctx.sensorLinearVelocityXYZ;
266266

267-
Vec3f distanceOnAxisXYZ = hitWorld - origin;
268-
Vec3f relPointVelocityBasedOnSensorAngularVelocity = Vec3f(.0f) - ctx.sensorAngularVelocityRPY.cross(distanceOnAxisXYZ);
267+
Vec3f hitRays = ctx.rayOriginToWorld.inverse() * hitWorld;
268+
Vec3f relPointVelocityBasedOnSensorAngularVelocity = Vec3f(.0f) - ctx.sensorAngularVelocityRPY.cross(hitRays);
269269
relPointVelocity = relPointVelocityBasedOnSensorLinearVelocity + relPointVelocityBasedOnSensorAngularVelocity;
270270

271-
Vec3f hitRays = ctx.rayOriginToWorld.inverse() * hitWorld;
272271
radialSpeed = hitRays.normalized().dot(relPointVelocity);
273272
}
274273

0 commit comments

Comments
 (0)