RapyutaSimulationPlugins
RRBaseOdomComponent.h
Go to the documentation of this file.
1 
13 #pragma once
14 
15 
16 
17 // UE
18 
19 #include "CoreMinimal.h"
20 
21 
22 
23 // RapyutaSimulationPlugins
24 
25 #include "Core/RRActorCommon.h"
26 
28 
30 
31 #include "Tools/SimulationState.h"
32 
33 
34 
35 #include "RRBaseOdomComponent.generated.h"
36 
37 
38 
39 class ARRBaseRobot;
40 
41 
42 
56 enum class EOdomSource : uint8
57 
58 {
59 
60  WORLD ,
61 
62  ENCODER ,
63 
64 };
65 
66 
67 
85 class RAPYUTASIMULATIONPLUGINS_API URRBaseOdomComponent : public URRROS2BaseSensorComponent
86 
87 {
88 
89 
90 
91 public:
92 
94 
95 
96 
103  virtual void SensorUpdate() override;
104 
105 
106 
107  virtual void PreInitializePublisher(UROS2NodeComponent* InROS2Node, const FString& InTopicName) override;
108 
109 
110 
111 
116  TWeakObjectPtr<ARRBaseRobot> RobotVehicle = nullptr;
117 
118 
119 
121 
123 
125 
126 
131  bool bManualUpdate = false;
132 
133 
134 
135 
140  FROSOdom OdomData;
141 
142 
143 
145 
146 
151  FString ChildFrameId = TEXT("base_footprint");
152 
153 
154 
167  void SetFrameIds(const FString& InFrameId, const FString& InChildFrameId);
168 
169 
170 
171 
176  FTransform InitialTransform = FTransform::Identity;
177 
178 
179 
180 
185  FTransform GetOdomTF() const;
186 
187 
188 
189 
194  virtual void InitOdom();
195 
196 
197 
198 
204 
205 
206 
217  virtual void UpdateOdom(float InDeltaTime);
218 
219 
220 
222 
224 
225 
230  bool bPublishOdomTf = false;
231 
232 
233 
234 
239  bool bIsOdomInitialized = false;
240 
241 
242 
244 
245 
250  FTransform RootOffset = FTransform::Identity;
251 
252 
253 
254 
259  TObjectPtr<URRGaussianNoise> PositionNoise;
260 
261 
262 
263 
268  TObjectPtr<URRGaussianNoise> RotNoise;
269 
270 
271 
272 
277  float NoiseMeanPosition = 0.f;
278 
279 
280 
281 
286  float NoiseVariancePosition = 0.001f;
287 
288 
289 
290 
295  float NoiseMeanRot = 0.f;
296 
297 
298 
299 
304  float NoiseVarianceRot = 0.005f;
305 
306 
307 
309 
310 
315  bool bWithNoise = true;
316 
317 
318 
319 protected:
320 
321  float LastUpdatedTime = 0.f;
322 
323 
324 
325 
330  FTransform PreviousTransform = FTransform::Identity;
331 
332 
333 
334 
339  FTransform PreviousNoisyTransform = FTransform::Identity;
340 
341 };
342 
EOdomSource
EOdomSource
Type of odometry frame origin.
Definition: RRBaseOdomComponent.h:56
URRBaseOdomComponent
Base Odom Component which provide actor pose changes.
Definition: RRBaseOdomComponent.h:85
URRROS2BaseSensorComponent::SensorUpdate
virtual void SensorUpdate()
Update Sensor data. This method should be overwritten by child class.
Definition: RRROS2BaseSensorComponent.h:348
EOdomSource::ENCODER
@ ENCODER
UMETA(DisplayName = "Encoder")
RRROS2OdomPublisher.h
Odometry Topic and TF publisher of ARRBaseRobot.
EOdomSource::WORLD
@ WORLD
UMETA(DisplayName = "World"),.
SimulationState.h
SimulationState class provides ROS 2 interface implementation to interact with UE4.
RRROS2EntityStateSensorComponent.h
EntityState sensor components which publish entitystate relative to a specific actor.
URRBaseOdomComponent::RotNoise
TObjectPtr< URRGaussianNoise > RotNoise
Definition: RRBaseOdomComponent.h:268
URRBaseOdomComponent::OdomData
FROSOdom OdomData
Definition: RRBaseOdomComponent.h:140
URRBaseOdomComponent::PositionNoise
TObjectPtr< URRGaussianNoise > PositionNoise
Definition: RRBaseOdomComponent.h:259
URRROS2BaseSensorComponent::PreInitializePublisher
virtual void PreInitializePublisher(UROS2NodeComponent *InROS2Node, const FString &InTopicName=TEXT(""))
Set publish frequency, topic name and FrameId.
RRActorCommon.h
Asset utils.
URRROS2BaseSensorComponent
Base ROS 2 Sensor Component class. Other sensors class should inherit from this class.
Definition: RRROS2BaseSensorComponent.h:175
ARRBaseRobot
Base Robot class. Other robot class should inherit from this class.
Definition: RRBaseRobot.h:161