A sensor to register collisions. More...
#include <CollisionSensor.h>
Public Member Functions | |
ACollisionSensor (const FObjectInitializer &ObjectInitializer) | |
void | SetOwner (AActor *NewOwner) override |
Public Member Functions inherited from ASensor | |
ASensor (const FObjectInitializer &ObjectInitializer) | |
virtual void | BeginPlay () |
boost::optional< FActorAttribute > | GetAttribute (const FString Name) |
const UCarlaEpisode & | GetEpisode () const |
URandomEngine * | GetRandomEngine () |
int32 | GetSeed () const |
auto | GetToken () const |
Return the token that allows subscribing to this sensor's stream. More... | |
bool | IsStreamReady () |
FDataStream | MoveDataStream () |
virtual void | OnFirstClientConnected () |
virtual void | OnLastClientDisconnected () |
virtual void | PostPhysTick (UWorld *World, ELevelTick TickType, float DeltaSeconds) |
void | PostPhysTickInternal (UWorld *World, ELevelTick TickType, float DeltaSeconds) |
virtual void | PrePhysTick (float DeltaSeconds) |
virtual void | Set (const FActorDescription &Description) |
void | SetDataStream (FDataStream InStream) |
Replace the FDataStream associated with this sensor. More... | |
void | SetEpisode (const UCarlaEpisode &InEpisode) |
void | SetSeed (int32 InSeed) |
void | Tick (const float DeltaTime) final |
Static Public Member Functions | |
static FActorDefinition | GetSensorDefinition () |
Private Member Functions | |
void | OnCollisionEvent (AActor *Actor, AActor *OtherActor, FVector NormalImpulse, const FHitResult &Hit) |
Private Attributes | |
std::vector< std::tuple< uint64_t, AActor *, AActor * > > | CollisionRegistry |
Registry that saves all collisions. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from ASensor | |
void | EndPlay (EEndPlayReason::Type EndPlayReason) override |
template<typename SensorT > | |
FAsyncDataStream | GetDataStream (const SensorT &Self) |
Return the FDataStream associated with this sensor. More... | |
void | PostActorCreated () override |
Protected Attributes inherited from ASensor | |
bool | bIsActive = false |
URandomEngine * | RandomEngine = nullptr |
Random Engine used to provide noise for sensor output. More... | |
int32 | Seed = 123456789 |
Seed of the pseudo-random engine. More... | |
A sensor to register collisions.
Definition at line 19 of file CollisionSensor.h.
ACollisionSensor::ACollisionSensor | ( | const FObjectInitializer & | ObjectInitializer | ) |
Definition at line 17 of file CollisionSensor.cpp.
|
static |
Definition at line 23 of file CollisionSensor.cpp.
References UActorBlueprintFunctionLibrary::MakeGenericSensorDefinition().
|
private |
Definition at line 42 of file CollisionSensor.cpp.
References ACarlaRecorder::AddCollision(), Collision, CollisionRegistry, ASensor::Episode, carla::streaming::detail::token_type::get_stream_id(), ASensor::GetDataStream(), ASensor::GetEpisode(), FCarlaEngine::GetFrameCounter(), carla::ros2::ROS2::GetInstance(), UCarlaEpisode::GetRecorder(), ASensor::GetToken(), ACarlaRecorder::IsEnabled(), UCarlaEpisode::SerializeActor(), and FAsyncDataStreamTmpl< T >::SerializeAndSend().
Referenced by SetOwner().
|
override |
Definition at line 30 of file CollisionSensor.cpp.
References OnCollisionEvent().
Registry that saves all collisions.
Used to avoid sending the same collision more than once per frame, as the collision sensor uses the PhysX substepping tick. Helps with sensor usage and stream overload.
Definition at line 42 of file CollisionSensor.h.
Referenced by OnCollisionEvent().