rclUE
rclcUtilities.h
Go to the documentation of this file.
1 
13 #pragma once
14 
15 
16 
17 // std
18 
19 
20 
21 #include <cstdlib>
22 
23 #include <cstring>
24 
25 #include <random>
26 
27 
28 
29 // UE
30 
31 #include "HAL/UnrealMemory.h"
32 
33 #include "Kismet/GameplayStatics.h"
34 
35 #include "Kismet/KismetSystemLibrary.h"
36 
37 #include "UObject/Object.h"
38 
39 
40 
41 // rclUE msgs
42 
43 #include "builtin_interfaces/msg/detail/time__struct.h"
44 
45 #include "geometry_msgs/msg/quaternion.h"
46 
47 #include "geometry_msgs/msg/transform.h"
48 
49 #include "geometry_msgs/msg/vector3.h"
50 
51 #include "rosidl_runtime_c/string.h"
52 
53 #include "rosidl_runtime_c/string_functions.h"
54 
55 #include "rosidl_runtime_c/u16string_functions.h"
56 
57 #include "std_msgs/msg/string.h"
58 
59 
60 
61 // rclUE others
62 
63 #include "logUtilities.h"
64 
65 #include "rcl/graph.h"
66 
67 #include "rcl/wait.h"
68 
69 #include "rcl_action/wait.h"
70 
71 #include "rclc/rclc.h"
72 
73 
74 
75 #include "rclcUtilities.generated.h"
76 
77 
78 
79 DECLARE_LOG_CATEGORY_EXTERN(LogROS2, Log, All);
80 
81 
82 
83 static TAutoConsoleVariable<int32> CVarRclUERcsSoftCheck(
84 
85  TEXT("RCLUE.RCSOFTCHECK"),
86 
87  0,
88 
89  TEXT("Exit UE with rcl function error or not.\n")
90 
91  TEXT("<=0: Continue without exiting UE even with rcl functions return error code.")
92 
93  TEXT(" 1: Exit UE with rcl functions error code.)\n"),
94 
95  ECVF_Scalability | ECVF_RenderThreadSafe);
96 
97 
98 
100 
101 #define RCSOFTCHECK(fn) \
102 
103  { \
104 
105  rcl_ret_t temp_rc = fn; \
106 
107  if ((temp_rc != RCL_RET_OK)) \
108 
109  { \
110 
111  UE_LOG_WITH_INFO(LogTemp, \
112 
113  Error, \
114 
115  TEXT("Failed status on line %d (function %s): %d. Continuing."), \
116 
117  __LINE__, \
118 
119  *FString(__FUNCTION__), \
120 
121  (int)temp_rc); \
122 
123  static const auto CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("RCLUE.RCSOFTCHECK")); \
124 
125  if (CVar->GetInt()) \
126 
127  { \
128 
129  check(temp_rc == 0); \
130 
131  } \
132 
133  } \
134 
135  }
136 
137 
138 
153 
154 {
155 
156  Created ,
157 
159 
160 };
161 
162 
163 
177 enum class UROS2QoS : uint8
178 
179 {
180 
181  Default ,
182 
183  SensorData ,
184 
186 
188 
189  ClockPub ,
190 
191  KeepLast ,
192 
193  Parameters ,
194 
195  Services ,
196 
197  ParameterEvents ,
198 
199  System ,
200 
201  UnknownQoS ,
202 
203 };
204 
205 
206 
208 
209 static const rmw_qos_profile_t rclUE_qos_profile_keep_last = {RMW_QOS_POLICY_HISTORY_KEEP_LAST,
210 
211  1,
212 
213  RMW_QOS_POLICY_RELIABILITY_RELIABLE,
214 
215  RMW_QOS_POLICY_DURABILITY_VOLATILE,
216 
217  RMW_QOS_DEADLINE_DEFAULT,
218 
219  RMW_QOS_LIFESPAN_DEFAULT,
220 
221  RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
222 
223  RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT,
224 
225  false};
226 
227 
228 
230 
231 static const rmw_qos_profile_t rclUE_qos_profile_sensor_data = {RMW_QOS_POLICY_HISTORY_KEEP_LAST,
232 
233  5,
234 
235  RMW_QOS_POLICY_RELIABILITY_RELIABLE,
236 
237  RMW_QOS_POLICY_DURABILITY_VOLATILE,
238 
239  RMW_QOS_DEADLINE_DEFAULT,
240 
241  RMW_QOS_LIFESPAN_DEFAULT,
242 
243  RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
244 
245  RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT,
246 
247  false};
248 
249 
250 
252 
253 static const rmw_qos_profile_t rclUE_qos_profile_clock_pub = {RMW_QOS_POLICY_HISTORY_KEEP_LAST,
254 
255  10,
256 
257  RMW_QOS_POLICY_RELIABILITY_RELIABLE,
258 
259  RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL,
260 
261  RMW_QOS_DEADLINE_DEFAULT,
262 
263  RMW_QOS_LIFESPAN_DEFAULT,
264 
265  RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
266 
267  RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT,
268 
269  false};
270 
271 
272 
274 
275 static const rmw_qos_profile_t rclUE_qos_profile_dynamic_broadcaster = {RMW_QOS_POLICY_HISTORY_KEEP_LAST,
276 
277  100,
278 
279  RMW_QOS_POLICY_RELIABILITY_RELIABLE,
280 
281  RMW_QOS_POLICY_DURABILITY_VOLATILE,
282 
283  RMW_QOS_DEADLINE_DEFAULT,
284 
285  RMW_QOS_LIFESPAN_DEFAULT,
286 
287  RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
288 
289  RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT,
290 
291  false};
292 
293 
294 
296 
297 static const rmw_qos_profile_t rclUE_qos_profile_static_broadcaster = {RMW_QOS_POLICY_HISTORY_KEEP_LAST,
298 
299  1,
300 
301  RMW_QOS_POLICY_RELIABILITY_RELIABLE,
302 
303  RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL,
304 
305  RMW_QOS_DEADLINE_DEFAULT,
306 
307  RMW_QOS_LIFESPAN_DEFAULT,
308 
309  RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
310 
311  RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT,
312 
313  false};
314 
315 
316 
318 
319 static const TMap<UROS2QoS, rmw_qos_profile_t> QoS_LUT = {{UROS2QoS::Default, rmw_qos_profile_default},
320 
322 
324 
326 
328 
330 
331  {UROS2QoS::Parameters, rmw_qos_profile_parameters},
332 
333  {UROS2QoS::Services, rmw_qos_profile_services_default},
334 
335  {UROS2QoS::ParameterEvents, rmw_qos_profile_parameter_events},
336 
337  {UROS2QoS::System, rmw_qos_profile_system_default},
338 
339  {UROS2QoS::UnknownQoS, rmw_qos_profile_unknown}};
340 
341 
342 
356 class URRTimerManager : public UObject
357 
358 {
359 
360 public:
361 
362  FString LogInfo;
363 
364 
365 
366 protected:
367 
368 
373  bool bEnabled = true;
374 
375 
376 
377 
382  float Rate = 0.f;
383 
384 
385 
386 
391  float DesiredTime = 0.f;
392 
393 
394 
396 
397 
402  FTimerHandle TimerHandle;
403 
404 
405 
406  FTimerDelegate Delegate;
407 
408 
409 
410  FTimerDelegate TimerDelegate;
411 
412 
413 
415 
416 
421  float LogLastHit = 0.f;
422 
423 
424 
425 public:
426 
427  void StopTimer()
428 
429  {
430 
431  bEnabled = false;
432 
433  GetWorld()->GetTimerManager().ClearTimer(TimerHandle);
434 
435  UE_LOG_WITH_INFO(LogTemp, Log, TEXT("[%s] Timer stopped"), *LogInfo);
436 
437  }
438 
439 
440 
441  void SetTimer(FTimerDelegate const& InDelegate, float InRate)
442 
443  {
444 
445  StopTimer();
446 
447  Rate = InRate;
448 
449  Delegate = InDelegate;
450 
451  bEnabled = true;
452 
453  DesiredTime = UGameplayStatics::GetTimeSeconds(GetWorld()) + Rate;
454 
455 
456 
457  TimerDelegate = FTimerDelegate::CreateUObject(this, &URRTimerManager::SetTimerImple);
458 
459  GetWorld()->GetTimerManager().SetTimer(TimerHandle, TimerDelegate, Rate, false);
460 
461  UE_LOG_WITH_INFO(LogTemp, Log, TEXT("[%s] Timer started"), *LogInfo);
462 
463  }
464 
465 
466 
467  void SetTimerImple()
468 
469  {
470 
471  if (!bEnabled)
472 
473  {
474 
475  bEnabled = true;
476 
477  return;
478 
479  }
480 
481 
482 
483  // function call. Make sure delegate is bound.
484 
485  if (Delegate.IsBound())
486 
487  {
488 
489  Delegate.ExecuteIfBound();
490 
491  }
492 
493  else
494 
495  {
496 
497  UE_LOG_WITH_INFO(LogTemp, Error, TEXT("[%s] Delegate is not bound"), *LogInfo);
498 
499  }
500 
501 
502 
503  float now = UGameplayStatics::GetTimeSeconds(GetWorld());
504 
505 
506 
507  // update DesiredTime
508 
509  DesiredTime += Rate;
510 
511 
512 
513  float wt = DesiredTime - now;
514 
515  if (wt <= 0)
516 
517  {
518 
520 
521  30,
522 
523  LogLastHit,
524 
525  LogTemp,
526 
527  Warning,
528 
529  TEXT("[URRTimerManager::SetTimerImple][%s] Delegate function call take longer than Rate or StepSize is not "
530 
531  "small enough to meet target Rate=%f, "
532 
533  "StepSize=%f."),
534 
535  *LogInfo,
536 
537  Rate,
538 
539  FApp::GetFixedDeltaTime());
540 
541  // Make sure that function call happens at next tick.
542 
543  wt = FApp::GetFixedDeltaTime() * 0.5;
544 
545  DesiredTime = now + wt;
546 
547  }
548 
549  // define lambda
550 
551  GetWorld()->GetTimerManager().SetTimer(TimerHandle, TimerDelegate, wt, false);
552 
553  }
554 
555 };
556 
557 
558 
559 
564 class UROS2Utils : public UBlueprintFunctionLibrary
565 
566 {
567 
568 
569 
570 public:
571 
572  static builtin_interfaces__msg__Time FloatToROSStamp(const float InTimeSec)
573 
574  {
575 
576  builtin_interfaces__msg__Time stamp;
577 
578  stamp.sec = static_cast<int32>(InTimeSec);
579 
580  stamp.nanosec = uint32((InTimeSec - stamp.sec) * 1e+09f);
581 
582  return stamp;
583 
584  }
585 
586 
587 
588  static builtin_interfaces__msg__Time GetCurrentROS2Time(const UObject* InContextObject)
589 
590  {
591 
592  return FloatToROSStamp(UGameplayStatics::GetTimeSeconds(InContextObject->GetWorld()));
593 
594  }
595 
596 
597 
598  static float ROSStampToFloat(const builtin_interfaces__msg__Time& InTimeStamp)
599 
600  {
601 
602  return InTimeStamp.sec + InTimeStamp.nanosec * 1e-09f;
603 
604  }
605 
606 
607 
608  static void GenerateRandomUUID16(TArray<uint, TFixedAllocator<16>>& OutUUID)
609 
610  {
611 
612  OutUUID.Reset();
613 
614  for (int8 i = 0; i < 16; i++)
615 
616  {
617 
618  OutUUID.Add(std::random_device{}());
619 
620  }
621 
622  }
623 
624 
625 
626  static int32 GetStringRequiredCapacity(const FString& InStr)
627 
628  {
629 
630  FTCHARToUTF8 strUtf8(*InStr);
631 
632  return (strUtf8.Length() + 1) + sizeof(size_t) + sizeof(size_t);
633 
634  }
635 
636 
637 
638  static int32 GetStringArrayRequiredCapacity(const TArray<FString>& InStrList)
639 
640  {
641 
642  int32 totalCapacity = 0;
643 
644  for (const auto& str : InStrList)
645 
646  {
647 
648  totalCapacity += GetStringRequiredCapacity(str);
649 
650  }
651 
652  return totalCapacity;
653 
654  }
655 
656 
657 
658  static void StringUEToStdMsg(const FString& InStr, std_msgs__msg__String& OutStdMsg)
659 
660  {
661 
662  const unsigned int msgStringCapacity = InStr.Len() + 1;
663 
664  if (OutStdMsg.data.data != nullptr)
665 
666  {
667 
668  free(OutStdMsg.data.data);
669 
670  }
671 
672  OutStdMsg.data.data = (char*)malloc(msgStringCapacity);
673 
674  OutStdMsg.data.capacity = msgStringCapacity;
675 
676  snprintf(OutStdMsg.data.data, OutStdMsg.data.capacity, "%s", TCHAR_TO_UTF8(*InStr));
677 
678  OutStdMsg.data.size = strlen(OutStdMsg.data.data);
679 
680  }
681 
682 
683 
684  // mainly used by SetFromROS2 and SetROS2 in the autogenerated msg files
685 
686  // General type and specific types, i.e. FString, FVector, FQuat, FTransform and array of those types
687 
688 
689 
704  template<typename TSequence>
705 
706  static void ROSSequenceResourceAllocation(TSequence& InSequence, const int size)
707 
708  {
709 
710  if (InSequence.data != nullptr)
711 
712  {
713 
714  free(InSequence.data);
715 
716  InSequence.data = nullptr;
717 
718  }
719 
720  InSequence.data = (decltype(InSequence.data))malloc(size * sizeof(decltype(*(InSequence.data))));
721 
722  InSequence.size = size;
723 
724  InSequence.capacity = size;
725 
726  }
727 
728 
729 
748  template<typename TSequence, typename T>
749 
750  static void ArrayUEToROSSequence(const TArray<T>& InArray, TSequence* OutSequence, const int size)
751 
752  {
753 
754  for (auto i = 0; i < size; ++i)
755 
756  {
757 
758  if constexpr (TIsArithmetic<T>::Value)
759 
760  {
761 
762  OutSequence[i] = InArray[i];
763 
764  }
765 
766  else
767 
768  {
769 
770  InArray[i].SetROS2(OutSequence[i]);
771 
772  }
773 
774  }
775 
776  }
777 
778 
779 
798  template<typename TSequence, typename T>
799 
800  static void SequenceROSToUEArray(const TSequence* InSequence, TArray<T>& OutArray, const int size)
801 
802  {
803 
804  OutArray.SetNum(size);
805 
806  for (auto i = 0; i < size; ++i)
807 
808  {
809 
810  if constexpr (TIsArithmetic<T>::Value)
811 
812  {
813 
814  OutArray[i] = InSequence[i];
815 
816  }
817 
818  else
819 
820  {
821 
822  OutArray[i].SetFromROS2(InSequence[i]);
823 
824  }
825 
826  }
827 
828  }
829 
830 
831 
832  // String
833 
848  template<typename T>
849 
850  static FString StringROSToUE(const T& InStr)
851 
852  {
853 
854  FString outStr;
855 
856  if (InStr.data)
857 
858  {
859 
860  outStr.AppendChars(InStr.data, InStr.size);
861 
862  }
863 
864  return outStr;
865 
866  }
867 
868 
869 
886  template<typename T>
887 
888  static void StringSequenceROSToUEArray(const T* InStrSequence, TArray<FString>& OutStrArray, const int size)
889 
890  {
891 
892  OutStrArray.Empty();
893 
894  for (size_t i = 0; i < size; ++i)
895 
896  {
897 
898  OutStrArray.Emplace(StringROSToUE<T>(InStrSequence[i]));
899 
900  }
901 
902  }
903 
904 
905 
922  static bool StringUEToROS(const FString& InStr, rosidl_runtime_c__String& OutStr)
923 
924  {
925 
926  if (!OutStr.data)
927 
928  {
929 
930  rosidl_runtime_c__String__init(&OutStr);
931 
932  }
933 
934  bool succeeded = rosidl_runtime_c__String__assign(&OutStr, TCHAR_TO_ANSI(*InStr));
935 
936  if (!succeeded)
937 
938  {
939 
940  UE_LOG_WITH_INFO(LogTemp, Error, TEXT("failed to assign string : %s"), *InStr);
941 
942  return false;
943 
944  }
945 
946 
947 
948  return true;
949 
950  }
951 
952 
953 
970  static bool U16StringUEToROS(const FString& InStr, rosidl_runtime_c__U16String& OutStr)
971 
972  {
973 
974  if (!OutStr.data)
975 
976  {
977 
978  rosidl_runtime_c__U16String__init(&OutStr);
979 
980  }
981 
982  bool succeeded = rosidl_runtime_c__U16String__assignn_from_char(&OutStr, TCHAR_TO_ANSI(*InStr), InStr.Len());
983 
984  if (!succeeded)
985 
986  {
987 
988  UE_LOG_WITH_INFO(LogTemp, Error, TEXT("failed to assign u16string : %s"), *InStr);
989 
990  return false;
991 
992  }
993 
994 
995 
996  return true;
997 
998  }
999 
1000 
1001 
1016  static void StringArrayUEToROSSequence(const TArray<FString>& InStrList,
1017 
1018  rosidl_runtime_c__String* OutStrSequence,
1019 
1020  const int size)
1021 
1022  {
1023 
1024  for (auto i = 0; i < size; ++i)
1025 
1026  {
1027 
1028  StringUEToROS(InStrList[i], OutStrSequence[i]);
1029 
1030  }
1031 
1032  }
1033 
1034 
1035 
1050  static void U16StringArrayUEToROSSequence(const TArray<FString>& InStrList,
1051 
1052  rosidl_runtime_c__U16String* OutStrSequence,
1053 
1054  const int size)
1055 
1056  {
1057 
1058  for (auto i = 0; i < size; ++i)
1059 
1060  {
1061 
1062  U16StringUEToROS(InStrList[i], OutStrSequence[i]);
1063 
1064  }
1065 
1066  }
1067 
1068 
1069 
1070  // Vectpr
1071 
1086  template<typename TVector>
1087 
1088  static FVector VectorROSToUE(const TVector& InROSVector)
1089 
1090  {
1091 
1092  return FVector(InROSVector.x, InROSVector.y, InROSVector.z);
1093 
1094  }
1095 
1096 
1097 
1114  template<typename TVector>
1115 
1116  static void VectorSequenceROSToUEArray(const TVector* InROSVector, TArray<FVector>& OutUEVector, const int size)
1117 
1118  {
1119 
1120  OutUEVector.Empty();
1121 
1122  for (auto i = 0; i < size; ++i)
1123 
1124  {
1125 
1126  OutUEVector.Emplace(InROSVector[i].x, InROSVector[i].y, InROSVector[i].z);
1127 
1128  }
1129 
1130  }
1131 
1132 
1133 
1148  template<typename TVector>
1149 
1150  static TVector VectorUEToROS(const FVector& InUEVector)
1151 
1152  {
1153 
1154  TVector OutROSVector;
1155 
1156  OutROSVector.x = InUEVector.X;
1157 
1158  OutROSVector.y = InUEVector.Y;
1159 
1160  OutROSVector.z = InUEVector.Z;
1161 
1162 
1163 
1164  return OutROSVector;
1165 
1166  }
1167 
1168 
1169 
1186  template<typename TVector>
1187 
1188  static void VectorArrayUEToROSSequence(const TArray<FVector>& InUEVector, TVector* OutROSVector, const int size)
1189 
1190  {
1191 
1192  for (auto i = 0; i < size; ++i)
1193 
1194  {
1195 
1196  OutROSVector[i].x = InUEVector[i].X;
1197 
1198  OutROSVector[i].y = InUEVector[i].Y;
1199 
1200  OutROSVector[i].z = InUEVector[i].Z;
1201 
1202  }
1203 
1204  }
1205 
1206 
1207 
1208  // Quat
1209 
1222  static FQuat QuatROSToUE(const geometry_msgs__msg__Quaternion& InROSQuat)
1223 
1224  {
1225 
1226  return FQuat(InROSQuat.x, InROSQuat.y, InROSQuat.z, InROSQuat.w);
1227 
1228  }
1229 
1230 
1231 
1246  static void QuatSequenceROSToUEArray(const geometry_msgs__msg__Quaternion* InROSQuat, TArray<FQuat> OutUEQuat, const int size)
1247 
1248  {
1249 
1250  OutUEQuat.Empty();
1251 
1252  for (auto i = 0; i < size; ++i)
1253 
1254  {
1255 
1256  OutUEQuat.Emplace(InROSQuat[i].x, InROSQuat[i].y, InROSQuat[i].z, InROSQuat[i].w);
1257 
1258  }
1259 
1260  }
1261 
1262 
1263 
1276  static geometry_msgs__msg__Quaternion QuatUEToROS(const FQuat& InUEQuat)
1277 
1278  {
1279 
1280  geometry_msgs__msg__Quaternion OutROSQuat;
1281 
1282  OutROSQuat.x = InUEQuat.X;
1283 
1284  OutROSQuat.y = InUEQuat.Y;
1285 
1286  OutROSQuat.z = InUEQuat.Z;
1287 
1288  OutROSQuat.w = InUEQuat.W;
1289 
1290 
1291 
1292  return OutROSQuat;
1293 
1294  }
1295 
1296 
1297 
1312  static void QuatArrayUEToROSSequence(const TArray<FQuat>& InUEQuat, geometry_msgs__msg__Quaternion* OutROSQuat, const int size)
1313 
1314  {
1315 
1316  for (auto i = 0; i < size; ++i)
1317 
1318  {
1319 
1320  OutROSQuat[i].x = InUEQuat[i].X;
1321 
1322  OutROSQuat[i].y = InUEQuat[i].Y;
1323 
1324  OutROSQuat[i].x = InUEQuat[i].Z;
1325 
1326  OutROSQuat[i].w = InUEQuat[i].W;
1327 
1328  }
1329 
1330  }
1331 
1332 
1333 
1334  // Transform
1335 
1348  static FTransform TransformROSToUE(const geometry_msgs__msg__Transform& InROSTF)
1349 
1350  {
1351 
1352  return FTransform(QuatROSToUE(InROSTF.rotation), VectorROSToUE<geometry_msgs__msg__Vector3>(InROSTF.translation));
1353 
1354  }
1355 
1356 
1357 
1372  static void TransformSequenceROSToUEArray(const geometry_msgs__msg__Transform* InROSTF,
1373 
1374  TArray<FTransform>& OutUETF,
1375 
1376  const int size)
1377 
1378  {
1379 
1380  OutUETF.Empty();
1381 
1382  for (auto i = 0; i < size; ++i)
1383 
1384  {
1385 
1386  OutUETF.Emplace(QuatROSToUE(InROSTF[i].rotation), VectorROSToUE<geometry_msgs__msg__Vector3>(InROSTF[i].translation));
1387 
1388  }
1389 
1390  }
1391 
1392 
1393 
1406  static geometry_msgs__msg__Transform TransformUEToROS(const FTransform& InUETF)
1407 
1408  {
1409 
1410  geometry_msgs__msg__Transform OutROSTF;
1411 
1412  OutROSTF.translation = VectorUEToROS<geometry_msgs__msg__Vector3>(InUETF.GetTranslation());
1413 
1414  OutROSTF.rotation = QuatUEToROS(InUETF.GetRotation());
1415 
1416 
1417 
1418  return OutROSTF;
1419 
1420  }
1421 
1422 
1423 
1438  static void TransformArrayUEToROSSequence(const TArray<FTransform>& InUETF,
1439 
1440  geometry_msgs__msg__Transform* OutROSTF,
1441 
1442  const int size)
1443 
1444  {
1445 
1446  for (auto i = 0; i < size; ++i)
1447 
1448  {
1449 
1450  OutROSTF[i].translation = VectorUEToROS<geometry_msgs__msg__Vector3>(InUETF[i].GetTranslation());
1451 
1452  OutROSTF[i].rotation = QuatUEToROS(InUETF[i].GetRotation());
1453 
1454  }
1455 
1456  }
1457 
1458 };
1459 
UROS2Utils::VectorSequenceROSToUEArray
static void VectorSequenceROSToUEArray(const TVector *InROSVector, TArray< FVector > &OutUEVector, const int size)
Convert ROS geometry_msgs__msg__Vector3 or geometry_msgs__msg__Point to UE FVector.
Definition: rclcUtilities.h:1116
URRTimerManager
Custom timer manager. This try to execute delegate at a given fixed rate.
Definition: rclcUtilities.h:356
UROS2Utils::StringArrayUEToROSSequence
static void StringArrayUEToROSSequence(const TArray< FString > &InStrList, rosidl_runtime_c__String *OutStrSequence, const int size)
Convert UE FString array to ROS sequence.
Definition: rclcUtilities.h:1016
UROS2QoS::Services
@ Services
UMETA(DisplayName = "Parameters"),.
UROS2QoS::Parameters
@ Parameters
UMETA(DisplayName = "KeepLast"),.
UROS2Utils::StringROSToUE
static FString StringROSToUE(const T &InStr)
Convert ROS string to UE FString.
Definition: rclcUtilities.h:850
URRTimerManager::Rate
float Rate
Definition: rclcUtilities.h:382
UROS2Utils::QuatSequenceROSToUEArray
static void QuatSequenceROSToUEArray(const geometry_msgs__msg__Quaternion *InROSQuat, TArray< FQuat > OutUEQuat, const int size)
Convert ROS geometry_msgs__msg__Quaternion to UE FQuat.
Definition: rclcUtilities.h:1246
UE_LOG_WITH_INFO
#define UE_LOG_WITH_INFO(CategoryName, Verbosity,...)
Definition: logUtilities.h:83
UROS2QoS
UROS2QoS
used to set QoS policies
Definition: rclcUtilities.h:177
UROS2QoS::SensorData
@ SensorData
UMETA(DisplayName = "Default"),.
rclUE_qos_profile_static_broadcaster
static const rmw_qos_profile_t rclUE_qos_profile_static_broadcaster
profiles provided by rclUE
Definition: rclcUtilities.h:297
UROS2Utils
Definition: rclcUtilities.h:564
UROS2QoS::UnknownQoS
@ UnknownQoS
UMETA(DisplayName = "System"),.
rclUE_qos_profile_sensor_data
static const rmw_qos_profile_t rclUE_qos_profile_sensor_data
profiles provided by rclUE
Definition: rclcUtilities.h:231
UE_LOG_THROTTLE
#define UE_LOG_THROTTLE(InRate, InLastHit,...)
UE_LOG_THROTTLE will print a message at most once per InRate.
Definition: logUtilities.h:181
UROS2QoS::System
@ System
UMETA(DisplayName = "ParameterEvents"),.
UROS2Utils::TransformSequenceROSToUEArray
static void TransformSequenceROSToUEArray(const geometry_msgs__msg__Transform *InROSTF, TArray< FTransform > &OutUETF, const int size)
Convert ROS geometry_msgs__msg__Transform to UE FTransform.
Definition: rclcUtilities.h:1372
UROS2Utils::QuatROSToUE
static FQuat QuatROSToUE(const geometry_msgs__msg__Quaternion &InROSQuat)
Convert ROS geometry_msgs__msg__Quaternion to UE FQuat.
Definition: rclcUtilities.h:1222
UROS2Utils::TransformArrayUEToROSSequence
static void TransformArrayUEToROSSequence(const TArray< FTransform > &InUETF, geometry_msgs__msg__Transform *OutROSTF, const int size)
Convert ROS geometry_msgs__msg__Transform to UE FTransform.
Definition: rclcUtilities.h:1438
rclUE_qos_profile_dynamic_broadcaster
static const rmw_qos_profile_t rclUE_qos_profile_dynamic_broadcaster
profiles provided by rclUE
Definition: rclcUtilities.h:275
UROS2Utils::QuatArrayUEToROSSequence
static void QuatArrayUEToROSSequence(const TArray< FQuat > &InUEQuat, geometry_msgs__msg__Quaternion *OutROSQuat, const int size)
Convert UE FQuat to ROS geometry_msgs__msg__Quaternion.
Definition: rclcUtilities.h:1312
QoS_LUT
static const TMap< UROS2QoS, rmw_qos_profile_t > QoS_LUT
Look-Up Table matching enum with rcl profiles.
Definition: rclcUtilities.h:319
UROS2Utils::ArrayUEToROSSequence
static void ArrayUEToROSSequence(const TArray< T > &InArray, TSequence *OutSequence, const int size)
Convert UE array to ROSSequence.
Definition: rclcUtilities.h:750
UROS2Utils::VectorArrayUEToROSSequence
static void VectorArrayUEToROSSequence(const TArray< FVector > &InUEVector, TVector *OutROSVector, const int size)
Convert UE FVector to ROS geometry_msgs__msg__Vector3 or geometry_msgs__msg__Point.
Definition: rclcUtilities.h:1188
URRTimerManager::LogLastHit
float LogLastHit
internal property used to log throttle.
Definition: rclcUtilities.h:421
UROS2Utils::TransformUEToROS
static geometry_msgs__msg__Transform TransformUEToROS(const FTransform &InUETF)
Convert UE FTransform to ROS geometry_msgs__msg__Transform.
Definition: rclcUtilities.h:1406
UROS2Utils::U16StringArrayUEToROSSequence
static void U16StringArrayUEToROSSequence(const TArray< FString > &InStrList, rosidl_runtime_c__U16String *OutStrSequence, const int size)
Convert UE FString array to ROS sequence.
Definition: rclcUtilities.h:1050
UROS2Utils::SequenceROSToUEArray
static void SequenceROSToUEArray(const TSequence *InSequence, TArray< T > &OutArray, const int size)
Convert ROSSequence to UE Array.
Definition: rclcUtilities.h:800
UROS2Utils::VectorROSToUE
static FVector VectorROSToUE(const TVector &InROSVector)
Convert ROS geometry_msgs__msg__Vector3 or geometry_msgs__msg__Point to UE FVector.
Definition: rclcUtilities.h:1088
UROS2Utils::StringUEToROS
static bool StringUEToROS(const FString &InStr, rosidl_runtime_c__String &OutStr)
Convert UE FString to ros string.
Definition: rclcUtilities.h:922
UROS2State
UROS2State
used to add states to classes (e.g. to avoid double initializations)
Definition: rclcUtilities.h:152
UROS2QoS::DynamicBroadcaster
@ DynamicBroadcaster
UMETA(DisplayName = "SensorData"),.
UROS2QoS::ClockPub
@ ClockPub
UMETA(DisplayName = "StaticBroadcaster"),.
UROS2Utils::StringSequenceROSToUEArray
static void StringSequenceROSToUEArray(const T *InStrSequence, TArray< FString > &OutStrArray, const int size)
Convert ROS string sequence to UE FString array.
Definition: rclcUtilities.h:888
rclUE_qos_profile_clock_pub
static const rmw_qos_profile_t rclUE_qos_profile_clock_pub
profiles provided by rclUE
Definition: rclcUtilities.h:253
UROS2Utils::VectorUEToROS
static TVector VectorUEToROS(const FVector &InUEVector)
Convert UE FVector to ROS geometry_msgs__msg__Vector3 or geometry_msgs__msg__Point.
Definition: rclcUtilities.h:1150
rclUE_qos_profile_keep_last
static const rmw_qos_profile_t rclUE_qos_profile_keep_last
profiles provided by rclUE
Definition: rclcUtilities.h:209
UROS2QoS::KeepLast
@ KeepLast
UMETA(DisplayName = "ClockPub"),.
UROS2QoS::ParameterEvents
@ ParameterEvents
UMETA(DisplayName = "Services"),.
URRTimerManager::TimerHandle
FTimerHandle TimerHandle
Timer handler for periodic publisher.
Definition: rclcUtilities.h:402
UROS2Utils::U16StringUEToROS
static bool U16StringUEToROS(const FString &InStr, rosidl_runtime_c__U16String &OutStr)
Convert UE FString to ros string.
Definition: rclcUtilities.h:970
UROS2QoS::StaticBroadcaster
@ StaticBroadcaster
UMETA(DisplayName = "DynamicBroadcaster"),.
Initialized
@ Initialized
UMETA(DisplayName = "Created"),.
Definition: rclcUtilities.h:158
UROS2Utils::TransformROSToUE
static FTransform TransformROSToUE(const geometry_msgs__msg__Transform &InROSTF)
Convert ROS geometry_msgs__msg__Transform to UE FTransform.
Definition: rclcUtilities.h:1348
UROS2Utils::QuatUEToROS
static geometry_msgs__msg__Quaternion QuatUEToROS(const FQuat &InUEQuat)
Convert UE FQuat to ROS geometry_msgs__msg__Quaternion.
Definition: rclcUtilities.h:1276
URRTimerManager::bEnabled
bool bEnabled
Definition: rclcUtilities.h:373
URRTimerManager::DesiredTime
float DesiredTime
Definition: rclcUtilities.h:391
UROS2Utils::ROSSequenceResourceAllocation
static void ROSSequenceResourceAllocation(TSequence &InSequence, const int size)
Allocate resources for ROS array.
Definition: rclcUtilities.h:706
logUtilities.h
Header containing utilities for logging.