RapyutaSimulationPlugins
RRROS2HitSensorComponent.h
Go to the documentation of this file.
1 
13 #pragma once
14 
15 
16 
17 // UE
18 
19 #include "CoreMinimal.h"
20 
21 #include "EngineUtils.h"
22 
23 
24 
25 // rclUE
26 
28 
29 
30 
31 #include <Msgs/ROS2HitEvent.h>
32 
33 
34 
35 // RapyutaSimulationPlugins
36 
37 #include "Core/RRGeneralUtils.h"
38 
39 
40 
41 #include "RRROS2HitSensorComponent.generated.h"
42 
43 
44 
58 class RAPYUTASIMULATIONPLUGINS_API URRROS2HitSensorComponent : public URRROS2BaseSensorComponent
59 
60 {
61 
62 
63 
64 public:
65 
75 
76  {
77 
78  // ROS 2 param
79 
80  TopicName = TEXT("collisions");
81 
82  MsgClass = UROS2HitEventMsg::StaticClass();
83 
84  PublicationFrequencyHz = 0; //Event based trigger
85 
86  }
87 
88 
89 
90  void BeginPlay() override;
91 
92 
93 
95 
97 
98 
103  TArray<UObject*> TargetObjects;
104 
105 
106 
108 
109 
114  virtual void BindCallback(UObject* InTargetObject);
115 
116 
117 
119 
121 
122 
127  virtual void OnHit(AActor* SelfActor,
128 
129  AActor* OtherActor,
130 
131  FVector NormalImpulse,
132 
133  const FHitResult& Hit,
134 
135  const FString& Name = TEXT(""));
136 
137 
138 
139 
144  virtual void OnTargetComponentHit(UPrimitiveComponent* HitComp,
145 
146  AActor* OtherActor,
147 
148  UPrimitiveComponent* OtherComp,
149 
150  FVector NormalImpulse,
151 
152  const FHitResult& Hit);
153 
154 
155 
156 
161  virtual void OnTargetActorHit(AActor* SelfActor, AActor* OtherActor, FVector NormalImpulse, const FHitResult& Hit);
162 
163 
164 
165  // ROS
166 
177  virtual void SetROS2Msg(UROS2GenericMsg* InMessage) override;
178 
179 
180 
181 
186  FROSHitEvent Data;
187 
188 
189 
191 
192 
197  bool bIgnoreSelf = true;
198 
199 
200 
202 
203 
208  TArray<UObject*> IgnoreList;
209 
210 
211 
212  bool IsIgnore(AActor* SelfActor, AActor* OtherActor, UPrimitiveComponent* OtherComp);
213 
214 };
215 
URRROS2BaseSensorComponent::SetROS2Msg
virtual void SetROS2Msg(UROS2GenericMsg *InMessage)
Set sensor data to ROS 2 msg. This method should be overwritten by child class.
Definition: RRROS2BaseSensorComponent.h:367
URRROS2HitSensorComponent::TargetObjects
TArray< UObject * > TargetObjects
List of UObject which is whether child class of PrimitiveComponent or Actor.
Definition: RRROS2HitSensorComponent.h:103
RRROS2BaseSensorComponent.h
Base ROS 2 Sensor Component class. Other sensors class should inherit from this class.
URRROS2HitSensorComponent::Data
FROSHitEvent Data
Definition: RRROS2HitSensorComponent.h:186
URRROS2HitSensorComponent::URRROS2HitSensorComponent
URRROS2HitSensorComponent()
Construct a new URRROS2HitSensorComponent object.
Definition: RRROS2HitSensorComponent.h:74
RRGeneralUtils.h
General utils.
URRROS2HitSensorComponent
Publish Hit status with OnActorHit and OnComponentHit.
Definition: RRROS2HitSensorComponent.h:58
URRROS2BaseSensorComponent
Base ROS 2 Sensor Component class. Other sensors class should inherit from this class.
Definition: RRROS2BaseSensorComponent.h:175
URRROS2HitSensorComponent::IgnoreList
TArray< UObject * > IgnoreList
List of object which collide with are ignored.
Definition: RRROS2HitSensorComponent.h:208