RapyutaSimulationPlugins
RRROS2IMUComponent.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/ROS2Imu.h>
32 
33 
34 
35 // RapyutaSimulationPlugins
36 
37 #include "Core/RRGeneralUtils.h"
38 
39 
40 
41 #include "RRROS2IMUComponent.generated.h"
42 
43 
44 
56 class RAPYUTASIMULATIONPLUGINS_API URRROS2IMUComponent : public URRROS2BaseSensorComponent
57 
58 {
59 
60 
61 
62 public:
63 
73 
74 
75 
76  void BeginPlay() override;
77 
78 
79 
86  virtual void SensorUpdate() override;
87 
88 
89 
90 
95  FTransform InitialTransform = FTransform::Identity;
96 
97 
98 
99 
104  FVector LinearAcceleration = FVector::ZeroVector;
105 
106 
107 
108 
113  FVector AngularVelocity = FVector::ZeroVector;
114 
115 
116 
117 
122  FQuat Orientation = FQuat::Identity;
123 
124 
125 
139  virtual void Reset();
140 
141 
142 
143 
148  TObjectPtr<URRGaussianNoise> LinearAccelerationNoise;
149 
150 
151 
152 
157  float NoiseMeanLinearAcceleration = 0.f;
158 
159 
160 
161 
166  float NoiseVarianceLinearAcceleration = 0.05f;
167 
168 
169 
170 
175  TObjectPtr<URRGaussianNoise> OrientationNoise;
176 
177 
178 
179 
184  float NoiseMeanOrientation = 0.f;
185 
186 
187 
188 
193  float NoiseVarianceOrientation = 0.01f;
194 
195 
196 
197 
202  float OrientationNoiseDriftCoefficient = 0.0f;
203 
204 
205 
206 
211  TObjectPtr<URRGaussianNoise> AngularVelocityNoise;
212 
213 
214 
215 
220  float NoiseMeanAngularVelocity = 0.f;
221 
222 
223 
224 
229  float NoiseVarianceAngularVelocity = 0.01f;
230 
231 
232 
233  // ROS
234 
250  virtual FROSImu GetROS2Data();
251 
252 
253 
264  virtual void SetROS2Msg(UROS2GenericMsg* InMessage) override;
265 
266 
267 
268 
273  FROSImu Data;
274 
275 
276 
277 protected:
278 
279 
284  FVector OffsetOrientation = FVector::ZeroVector;
285 
286 
287 
288  // sensor drift
289 
290  FVector OrientationNoiseSum = FVector::ZeroVector;
291 
292 
293 
294 
299  FTransform LastTransform = FTransform::Identity;
300 
301 
302 
303 
308  FVector LastLinearVel = FVector::ZeroVector;
309 
310 
311 
312 
317  FTransform LastdT = FTransform::Identity;
318 
319 
320 
321 
327 
328 };
329 
URRROS2IMUComponent::AngularVelocityNoise
TObjectPtr< URRGaussianNoise > AngularVelocityNoise
Definition: RRROS2IMUComponent.h:211
URRROS2IMUComponent::OrientationNoise
TObjectPtr< URRGaussianNoise > OrientationNoise
Definition: RRROS2IMUComponent.h:175
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
URRROS2BaseSensorComponent::SensorUpdate
virtual void SensorUpdate()
Update Sensor data. This method should be overwritten by child class.
Definition: RRROS2BaseSensorComponent.h:348
URRROS2IMUComponent::LinearAccelerationNoise
TObjectPtr< URRGaussianNoise > LinearAccelerationNoise
Definition: RRROS2IMUComponent.h:148
URRROS2IMUComponent::Data
FROSImu Data
Definition: RRROS2IMUComponent.h:273
URRROS2IMUComponent
IMU sensor components which publish Orienation, AngularVelocity, LinearAcceleration.
Definition: RRROS2IMUComponent.h:56
URRROS2IMUComponent::LastSensorUpdateTime
float LastSensorUpdateTime
Definition: RRROS2IMUComponent.h:326
RRROS2BaseSensorComponent.h
Base ROS 2 Sensor Component class. Other sensors class should inherit from this class.
RRGeneralUtils.h
General utils.
URRROS2BaseSensorComponent
Base ROS 2 Sensor Component class. Other sensors class should inherit from this class.
Definition: RRROS2BaseSensorComponent.h:175