Solving Inverse-Kinematic Problem for PUMA via Position Based Dynamics
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

70 lines
1.4 KiB

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Joint.h"
#include "Components/StaticMeshComponent.h"
#include "Eigen/Dense"
#include "Link.generated.h"
using namespace Eigen;
/**
*
*/
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class PBDROBOTICS_API ULink : public UStaticMeshComponent
{
GENERATED_BODY()
public:
// Properties in World space
Vector3d Position;
Vector3d Velocity;
double Mass;
Quaterniond Orientation;
Vector3d AngularVelocity;
Vector3d Last_Position;
Quaterniond Last_Orientation;
UPROPERTY()
UJoint* PrevJoint;
UPROPERTY()
UJoint* NextJoint;
UFUNCTION(BlueprintCallable)
FVector GetPosition() const;
UFUNCTION(BlueprintCallable)
FQuat GetOrientation() const;
void Update(const double H, const Vector3d& ExtTransForce, const Vector3d& ExtRotForce);
void UpdateVelocity(const double H);
void UpdateInternalTransform();
// Inertia tensor in world space
Matrix3d GetInertia() const;
double GetPositionalInverseMass(const Vector3d& R, const Vector3d& N) const;
double GetRotationalInverseMass(const Vector3d& N) const;
void Setup();
UPROPERTY(EditAnywhere)
bool IsEffector = false;
Vector3d GetGravityForce() const;
private:
UPROPERTY(EditAnywhere)
bool IsBase = false;
Matrix3d Inertia_Tensor_Local;
void SetupJoints() const;
void SetupProperties();
};