83 FVector NormalImpulse,
84 const FHitResult &Hit)
88 UE_LOG(LogCarla, Error, TEXT(
"ACollisionSensor::OnActorCollisionEvent Error with collided actor; Not valid.\n Collider actor %s"),
89 *(Actor->GetName()) );
95 UE_LOG(LogCarla, Error, TEXT(
"ACollisionSensor::OnActorCollisionEvent Error with collider actor; Not valid.\n Collided actor %s"),
96 *(OtherActor->GetName()) );
105 if (std::get<0>(
Collision) == CurrentFrame &&
114 constexpr float TO_METERS = 1e-2;
115 NormalImpulse *= TO_METERS;
118 CurrentEpisode.SerializeActor(Actor),
119 CurrentEpisode.SerializeActor(OtherActor),
121 (
float)NormalImpulse.X,
122 (
float)NormalImpulse.Y,
123 (
float)NormalImpulse.Z));
126 if (CurrentEpisode.GetRecorder()->IsEnabled()){
127 CurrentEpisode.GetRecorder()->AddCollision(Actor, OtherActor);
133#if defined(WITH_ROS2)
135 if (ROS2->IsEnabled())
137 TRACE_CPUPROFILER_EVENT_SCOPE_STR(
"ROS2 Send");
139 AActor* ParentActor = GetAttachParentActor();
142 FTransform LocalTransformRelativeToParent = GetActorTransform().GetRelativeTransform(ParentActor->GetActorTransform());
143 ROS2->ProcessDataFromCollisionSensor(0, StreamId, LocalTransformRelativeToParent, OtherActor->GetUniqueID(),
carla::geom::Vector3D{NormalImpulse.X, NormalImpulse.Y, NormalImpulse.Z},
this);
147 ROS2->ProcessDataFromCollisionSensor(0, StreamId, GetActorTransform(), OtherActor->GetUniqueID(),
carla::geom::Vector3D{NormalImpulse.X, NormalImpulse.Y, NormalImpulse.Z},
this);