Advertisement
Guest User

Untitled

a guest
Jul 25th, 2018
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.92 KB | None | 0 0
  1. UCLASS()
  2. class BLANKCPP_API AVRurdfRobot : public AActor
  3. {
  4.     GENERATED_BODY()
  5.  
  6. protected:
  7.     // Called when the game starts or when spawned
  8.     virtual void BeginPlay() override;
  9.  
  10. public:
  11.     // Sets default values for this actor's properties
  12.     AVRurdfRobot();
  13.  
  14.     // Called every frame
  15.     virtual void Tick(float DeltaTime) override;
  16.  
  17.     // Called at construction
  18.     virtual void OnConstruction(const FTransform &Transform) override;
  19.  
  20.     // urdf link structure
  21.     struct FurdfLink {
  22.         FString Name;
  23.  
  24.         struct {
  25.             FVector Location;
  26.             FRotator Rotation;
  27.             FString MeshName;
  28.             FVector MeshScale;
  29.  
  30.             // unused, apply material manually
  31.             struct {
  32.                 FString Name;
  33.                 FColor Color;
  34.                 FString Texture;
  35.             } Material;
  36.         } Visual;
  37.  
  38.         struct {
  39.             FVector Location;
  40.             FRotator Rotation;
  41.             FString MeshName;
  42.             FVector MeshScale;
  43.         } Collision;
  44.  
  45.         struct {
  46.             FVector Location;
  47.             FRotator Rotation;
  48.             float Mass;
  49.         } Inertial;
  50.  
  51.         bool operator== (const FurdfLink &Link) {
  52.             return Name.Equals(Link.Name);
  53.         }
  54.  
  55.         bool operator== (const FString &String) {
  56.             return Name.Equals(String);
  57.         }
  58.     };
  59.    
  60.     // urdf join structure
  61.     struct FurdfJoint {
  62.         FString Name;
  63.         FString Type;
  64.         FString Parent;
  65.         FString Child;
  66.  
  67.         FVector Location;
  68.         FRotator Rotation;
  69.         FVector Axis;
  70.  
  71.         // Unused
  72.         float LowerLimit;
  73.         float UpperLimit;
  74.         float Effort;
  75.         float Velocity;
  76.  
  77.         // Unused
  78.         float k_velocity;
  79.         float damping;
  80.         float friction;
  81.  
  82.         bool operator== (const FurdfJoint &Joint) {
  83.             return Name.Equals(Joint.Name);
  84.         }
  85.  
  86.         bool operator== (const FString &String) {
  87.             return Name.Equals(String);
  88.         }
  89.     };
  90.  
  91.     // Tree structure
  92.     struct FurdfNode {
  93.         FurdfLink Link;
  94.         FurdfJoint Joint;
  95.  
  96.         FurdfNode* Parent;
  97.         TArray<FurdfNode*> Children;
  98.  
  99.         ~FurdfNode() {
  100.             for (int i = 0; i < Children.Num(); i++)
  101.                 delete Children[i];
  102.         }
  103.     };
  104.  
  105.     // Root node, no parent, only children
  106.     FurdfNode* RootNode;
  107. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement