RapyutaSimulationPlugins
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
URRPhysicsJointComponent Class Reference

Physics Joint component. More...

#include <RRPhysicsJointComponent.h>

Inheritance diagram for URRPhysicsJointComponent:
Inheritance graph
[legend]
Collaboration diagram for URRPhysicsJointComponent:
Collaboration graph
[legend]

Public Member Functions

 URRPhysicsJointComponent ()
 
virtual bool IsValid () override
 
virtual void InitializeComponent () override
 Initialize Constraint JointToChildLink and ParentLinkToJoint. More...
 
virtual void SetVelocity (const FVector &InLinearVelocity, const FVector &InAngularVelocity) override
 Do nothing since can't set velocity directly to physics joint. More...
 
virtual void SetVelocityTarget (const FVector &InLinearVelocity, const FVector &InAngularVelocity) override
 Call SetLinearVelocityTarget and SetAngularVelocityTarget. More...
 
virtual void SetPose (const FVector &InPosition, const FRotator &InOrientation) override
 Do nothing since can't set pose directly to physics joint. More...
 
virtual void SetPoseTarget (const FVector &InPosition, const FRotator &InOrientation) override
 Call SetLinearPositionTarget and SetAngularOrientationTarget. More...
 
virtual void Teleport (const FVector &InPosition, const FRotator &InOrientation) override
 Disable collision and set target pose to given pose. More...
 
virtual void MoveToInitPose ()
 
virtual void SetJoint ()
 
- Public Member Functions inherited from URRJointComponent
 URRJointComponent ()
 
virtual void TickComponent (float DeltaTime, ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override
 Call #UpdatePose after update PositionTarget and OrientationTarget with LinearVelocity and AngularVelocity. More...
 
virtual void SetSingleLinearVelocityTarget (const float Input)
 Utility wrapper of SetVelocityTarget to provide 1 DoF target orientation. More...
 
virtual void SetSingleAngularVelocityTarget (const float Input)
 Utility wrapper of SetVelocityTarget to provide 1 DoF target position. More...
 
virtual void SetVelocityTargetWithDelegates (const FVector &InLinearVelocity, const FVector &InAngularVelocity, const FJointCallback &InOnControlSuccessDelegate, const FJointCallback &InOnControlFailDelegate, const float InLinearTolerance=-1.0, const float InAngularTolerance=-1.0, const float InTimeOut=-1.0)
 Set the Velocity Target With Delegates object. More...
 
virtual void SetSingleLinearVelocityTargetWithDelegates (const float Input, const FJointCallback &InOnControlSuccessDelegate, const FJointCallback &InOnControlFailDelegate, const float InLinearTolerance=-1.0, const float InTimeOut=-1.0)
 Utility wrapper of SetVelocityTargetWithDelegates to provide 1 DoF targetlinear velocity. More...
 
virtual void SetSingleAngularVelocityTargetWithDelegates (const float Input, const FJointCallback &InOnControlSuccessDelegate, const FJointCallback &InOnControlFailDelegate, const float InAngularTolerance=-1.0, const float InTimeOut=-1.0)
 Utility wrapper of SetVelocityTargetWithDelegates to provide 1 DoF target angular velocity. More...
 
virtual void SetVelocityWithArray (const TArray< float > &InVelocity)
 Set the Velocity With TArray. More...
 
virtual void SetVelocityTargetWithArray (const TArray< float > &InVelocity)
 Set the Velocity Target. More...
 
virtual void SetVelocityTargetWithArrayWithDelegates (const TArray< float > &InVelocity, const FJointCallback &InOnControlSuccessDelegate, const FJointCallback &InOnControlFailDelegate, const float InLinearTolerance=-1.0, const float InAngularTolerance=-1.0, const float InTimeOut=-1.0)
 Set the Velocity Target With Array With Delegates object. More...
 
virtual bool HasReachedVelocityTarget (const float InLinearTolerance=-1.f, const float InAngularTolerance=-1.f)
 Check Pose reach the target pose. More...
 
virtual void SetSinglePositionTarget (const float Input)
 Utility wrapper of SetPoseTarget to provide 1 DoF target orientation. More...
 
virtual void SetSingleOrientationTarget (const float Input)
 Utility wrapper of SetPoseTarget to provide 1 DoF target position. More...
 
virtual void SetPoseTargetWithDelegates (const FVector &InPosition, const FRotator &InOrientation, const FJointCallback &InOnControlSuccessDelegate, const FJointCallback &InOnControlFailDelegate, const float InPositionTolerance=-1.0, const float InOrientationTolerance=-1.0, const float InTimeOut=-1.0)
 Set Pose Target. More...
 
virtual void SetSinglePositionTargetWithDelegates (const float Input, const FJointCallback &InOnControlSuccessDelegate, const FJointCallback &InOnControlFailDelegate, const float InPositionTolerance=-1.0, const float InTimeOut=-1.0)
 Utility wrapper of SetPoseTargetWithDelegates to provide 1 DoF target position. More...
 
virtual void SetSingleOrientationTargetWithDelegates (const float Input, const FJointCallback &InOnControlSuccessDelegate, const FJointCallback &InOnControlFailDelegate, const float InOrientationTolerance=-1.0, const float InTimeOut=-1.0)
 Utility wrapper of SetPoseTargetWithDelegates to provide 1 DoF target orientation. More...
 
virtual bool HasReachedPoseTarget (const float InPositionTolerance=-1.f, const float InOrientationTolerance=-1.f)
 Check Pose reach the target pose. More...
 
virtual void SetPoseWithArray (const TArray< float > &InPose)
 Directly set pose. More...
 
virtual void SetPoseTargetWithArray (const TArray< float > &InPose)
 Set Pose Target. More...
 
virtual void SetPoseTargetWithArrayWithDelegates (const TArray< float > &InPose, const FJointCallback &InOnControlSuccessDelegate, const FJointCallback &InOnControlFailDelegate, const float InPositionTolerance=-1.0, const float InOrientationTolerance=-1.0, const float InTimeOut=-1.0)
 Set Pose Target. More...
 
FTransform GetJointToChildLink ()
 
FTransform GetParentLinkToJoint ()
 

Public Attributes

UPhysicsConstraintComponent * Constraint = nullptr
 Physics Constraints. More...
 
bool bSmoothing = false
 Smoothing TargetPose to Constraint. More...
 
float Kvp = 10.f
 Position Velocity Gain used with bSmoothing = false. More...
 
float Kva = 10.f
 Angular Velocity Gain used with bSmoothing = false. More...
 
float Kip = 0.f
 Position Integral Gain used with bSmoothing = false. More...
 
float Kia = 0.f
 Angular Integral Gain used with bSmoothing = false. More...
 
float LinearVelocitySmoothingAcc = 10.f
 Acceleration[cm/ss] used by velocity smoothing if #bVelocitySmoothing = true. More...
 
float AngularVelocitySmoothingAcc = 10.f
 Acceleration[deg/ss] used by velocity smoothing if #bVelocitySmoothing = true. More...
 
float LinearSpring = 1000
 [kg/ss] More...
 
float LinearDamper = 10
 [kg/s] More...
 
float LinearForceLimit = UE_BIG_NUMBER
 [kg.cm/ss] More...
 
float AngularSpring = 100000
 [kg.cm/ss] More...
 
float AngularDamper = 10000
 [kg.cm/s] More...
 
float AngularForceLimit = UE_BIG_NUMBER
 [kg.deg.deg/ss] More...
 
bool bManualConstraintSetting = false
 if false, physics constraints parameters are set from SetJoint . More...
 
- Public Attributes inherited from URRJointComponent
FVector LinearVelocity = FVector::ZeroVector
 
FVector AngularVelocity = FVector::ZeroVector
 
FVector LinearVelocityTarget = FVector::ZeroVector
 
FVector AngularVelocityTarget = FVector::ZeroVector
 
FVector PositionTarget = FVector::ZeroVector
 
FRotator OrientationTarget = FRotator::ZeroRotator
 
FVector Position = FVector::ZeroVector
 
FRotator Orientation = FRotator::ZeroRotator
 
float PositionTolerance = 1.f
 [cm] tolerance for control More...
 
float OrientationTolerance = 1.f
 [degree] tolerance for control More...
 
float LinearVelocityTolerance = 10.f
 [cm/s] tolerance for control More...
 
float AngularVelocityTolerance = 10.f
 [degree/s] tolerance for control More...
 
UStaticMeshComponent * ParentLink
 
UStaticMeshComponent * ChildLink
 
ERRJointControlType ControlType = ERRJointControlType::POSITION
 
uint8 LinearDOF = 0
 Linear Degrees Of Freedom. More...
 
uint8 RotationalDOF = 1
 Rotational Degrees Of Freedom. More...
 
FVector PositionMax = FVector(1000, 1000, 1000)
 Pose Limitations[cm]. More...
 
FVector PositionMin = FVector(-1000, -1000, -1000)
 Pose Limitations[cm]. More...
 
FRotator OrientationMax = FRotator(180.f)
 Orientation Limitations[deg]. More...
 
FRotator OrientationMin = FRotator(-180, -180, -180)
 Orientation Limitations[deg]. More...
 
FVector LinearVelMax = FVector(1000, 1000, 1000)
 Linear Velocity Limitations[cm/s]. More...
 
FVector AngularVelMax = FVector(180.f)
 Angular Velocity Limitations[deg/s]. More...
 
bool bLimitRoll = true
 
bool bLimitPitch = true
 
bool bLimitYaw = true
 
FVector InitialPosition = FVector::ZeroVector
 
FRotator InitialOrientation = FRotator::ZeroRotator
 

Protected Member Functions

virtual void UpdateState (const float DeltaTime) override
 
virtual void UpdateControl (const float DeltaTime) override
 
virtual void UpdateIntegral (const FVector &InPositionDiff, const FVector &InOrientationDiff, const float DeltaTime)
 Update LinearVelocityTarget from InPositionDiff and Kvp. More...
 
virtual void UpdateVelocityTargetFromPose (const FVector InPositionDiff, const FVector InOrientationDiff)
 Update LinearVelocityTarget from InPositionDiff and Kvp. More...
 
virtual FRotator GetOrientationTargetFromEuler (const FVector &InOrientationTarget)
 Get the Orientation Target to SetAngularOrientationTarget from Euler angle. More...
 
- Protected Member Functions inherited from URRJointComponent
virtual void PoseFromArray (const TArray< float > &InPose, FVector &OutPosition, FRotator &OutOrientation)
 
virtual void VelocityFromArray (const TArray< float > &InVelocity, FVector &OutLinearVelocity, FVector &OutAngularVelocity)
 
virtual void SetDelegates (const FJointCallback &InOnControlSuccessDelegate, const FJointCallback &InOnControlFailDelegate, const float InPositionTolerance=-1.0, const float InOrientationTolerance=-1.0, const float InLinearTolerance=-1.0, const float InAngularTolerance=-1.0, const float InTimeOut=-1.0f)
 Set Delegates which will be unbounded when move is completed or timeouthappen. More...
 
virtual void ResetControl ()
 

Protected Attributes

FVector MidLinearVelocityTarget = FVector::ZeroVector
 LinearVelocityTarget for smoothing. More...
 
FVector MidAngularVelocityTarget = FVector::ZeroVector
 AngularVelocityTarget for smoothing. More...
 
FVector MidPositionTarget = FVector::ZeroVector
 PositionTarget for smoothing. More...
 
FRotator MidOrientationTarget = FRotator::ZeroRotator
 OrientationTarget for smoothing. More...
 
TStaticArray< TwoPointInterpolation, 3 > PositionTPI
 Position Two Point Interpolation used with bSmoothing = true. More...
 
TStaticArray< TwoAngleInterpolation, 3 > OrientationTPI
 Angular Two Point Interpolation used with bSmoothing = true. More...
 
FVector PErrInt = FVector::ZeroVector
 Position Error Integral used with bSmoothing = false. More...
 
FVector AErrInt = FVector::ZeroVector
 Angular Error Integral used with bSmoothing = false. More...
 
- Protected Attributes inherited from URRJointComponent
FTransform JointToChildLink = FTransform::Identity
 
FTransform ParentLinkToJoint = FTransform::Identity
 
bool bMovingToTargetPose = false
 true if joint is moving to target pose More...
 
bool bMovingToTargetVelocity = false
 true if joint is moving to target velocity More...
 
FJointCallback OnControlSuccessDelegate
 Delegate which is called when joint reach target vel/pose. More...
 
FJointCallback OnControlFailDelegate
 Delegate which is called whenjoint failed to reach target vel/pose. More...
 
float ControlStartTime = 0.f
 time when target pose/vel are set. More...
 
float ControlTimeout = -1.0f
 timeout. If joint can't reach target in this duration, OnControlFailDelegate should be called. More...
 

Detailed Description

Physics Joint component.

PhysicsConstraintsComponent needs to be defined outside of this class and passed to Constraint in construction.

See also
PhysicsConstraints

UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))

Constructor & Destructor Documentation

◆ URRPhysicsJointComponent()

URRPhysicsJointComponent::URRPhysicsJointComponent ( )

Member Function Documentation

◆ GetOrientationTargetFromEuler()

virtual FRotator URRPhysicsJointComponent::GetOrientationTargetFromEuler ( const FVector &  InOrientationTarget)
protectedvirtual

Get the Orientation Target to SetAngularOrientationTarget from Euler angle.

Parameters
InOrientationTarget
Returns
FRotator

UFUNCTION()

◆ InitializeComponent()

virtual void URRPhysicsJointComponent::InitializeComponent ( )
overridevirtual

Initialize Constraint JointToChildLink and ParentLinkToJoint.

Reimplemented from URRJointComponent.

◆ IsValid()

virtual bool URRPhysicsJointComponent::IsValid ( )
overridevirtual

Reimplemented from URRJointComponent.

◆ MoveToInitPose()

virtual void URRPhysicsJointComponent::MoveToInitPose ( )
virtual

◆ SetJoint()

virtual void URRPhysicsJointComponent::SetJoint ( )
virtual

Set joints parameter and etc

UFUNCTION(BlueprintCallable)

◆ SetPose()

virtual void URRPhysicsJointComponent::SetPose ( const FVector &  InPosition,
const FRotator &  InOrientation 
)
overridevirtual

Do nothing since can't set pose directly to physics joint.

Parameters
InPosition
InOrientation

Reimplemented from URRJointComponent.

◆ SetPoseTarget()

virtual void URRPhysicsJointComponent::SetPoseTarget ( const FVector &  InPosition,
const FRotator &  InOrientation 
)
overridevirtual

Call SetLinearPositionTarget and SetAngularOrientationTarget.

See also
SetLinearPositionTarget
SetAngularVelocityTarget

Reimplemented from URRJointComponent.

◆ SetVelocity()

virtual void URRPhysicsJointComponent::SetVelocity ( const FVector &  InLinearVelocity,
const FVector &  InAngularVelocity 
)
overridevirtual

Do nothing since can't set velocity directly to physics joint.

Parameters
InLinearVelocity
InAngularVelocity

Reimplemented from URRJointComponent.

◆ SetVelocityTarget()

virtual void URRPhysicsJointComponent::SetVelocityTarget ( const FVector &  InLinearVelocity,
const FVector &  InAngularVelocity 
)
overridevirtual

Call SetLinearVelocityTarget and SetAngularVelocityTarget.

See also
SetLinearVelocityTarget
SetAngularVelocityTarget

Reimplemented from URRJointComponent.

◆ Teleport()

virtual void URRPhysicsJointComponent::Teleport ( const FVector &  InPosition,
const FRotator &  InOrientation 
)
overridevirtual

Disable collision and set target pose to given pose.

Note
temporary implementation. it should teleported target pose instantly.
Parameters
InPosition
InOrientation

Reimplemented from URRJointComponent.

◆ UpdateControl()

virtual void URRPhysicsJointComponent::UpdateControl ( const float  DeltaTime)
overrideprotectedvirtual

UFUNCTION()

Reimplemented from URRJointComponent.

◆ UpdateIntegral()

virtual void URRPhysicsJointComponent::UpdateIntegral ( const FVector &  InPositionDiff,
const FVector &  InOrientationDiff,
const float  DeltaTime 
)
protectedvirtual

Update LinearVelocityTarget from InPositionDiff and Kvp.

UFUNCTION() And update AngularVelocityTarget from InOrientationDiff and Kva.

Parameters
InPositionDiff
InPositionDiff
InOrientationDiff
DeltaTime

◆ UpdateState()

virtual void URRPhysicsJointComponent::UpdateState ( const float  DeltaTime)
overrideprotectedvirtual

UFUNCTION()

Reimplemented from URRJointComponent.

◆ UpdateVelocityTargetFromPose()

virtual void URRPhysicsJointComponent::UpdateVelocityTargetFromPose ( const FVector  InPositionDiff,
const FVector  InOrientationDiff 
)
protectedvirtual

Update LinearVelocityTarget from InPositionDiff and Kvp.

And update AngularVelocityTarget from InOrientationDiff and Kva.

Parameters
InPositionDiff
InOrientationDiff

UFUNCTION()

Member Data Documentation

◆ AErrInt

FVector URRPhysicsJointComponent::AErrInt = FVector::ZeroVector
protected

Angular Error Integral used with bSmoothing = false.

UPROPERTY(VisibleAnywhere)

◆ AngularDamper

float URRPhysicsJointComponent::AngularDamper = 10000

◆ AngularForceLimit

float URRPhysicsJointComponent::AngularForceLimit = UE_BIG_NUMBER

◆ AngularSpring

float URRPhysicsJointComponent::AngularSpring = 100000

◆ AngularVelocitySmoothingAcc

float URRPhysicsJointComponent::AngularVelocitySmoothingAcc = 10.f

Acceleration[deg/ss] used by velocity smoothing if #bVelocitySmoothing = true.

UPROPERTY(EditAnywhere, BlueprintReadWrite)

◆ bManualConstraintSetting

bool URRPhysicsJointComponent::bManualConstraintSetting = false

if false, physics constraints parameters are set from SetJoint .

Plese set true if you want to set physics constraints parameter manually.

UPROPERTY(EditAnywhere, BlueprintReadWrite)

◆ bSmoothing

bool URRPhysicsJointComponent::bSmoothing = false

Smoothing TargetPose to Constraint.

If this is false, step pose target are used by SetPoseTarget If this is true, pose target changes linearly with max vel in TickComponent

UPROPERTY(EditAnywhere, BlueprintReadWrite)

◆ Constraint

UPhysicsConstraintComponent* URRPhysicsJointComponent::Constraint = nullptr

◆ Kia

float URRPhysicsJointComponent::Kia = 0.f

Angular Integral Gain used with bSmoothing = false.

UPROPERTY(EditAnywhere, BlueprintReadWrite)

◆ Kip

float URRPhysicsJointComponent::Kip = 0.f

Position Integral Gain used with bSmoothing = false.

UPROPERTY(EditAnywhere, BlueprintReadWrite)

◆ Kva

float URRPhysicsJointComponent::Kva = 10.f

Angular Velocity Gain used with bSmoothing = false.

UPROPERTY(EditAnywhere, BlueprintReadWrite)

◆ Kvp

float URRPhysicsJointComponent::Kvp = 10.f

Position Velocity Gain used with bSmoothing = false.

UPROPERTY(EditAnywhere, BlueprintReadWrite)

◆ LinearDamper

float URRPhysicsJointComponent::LinearDamper = 10

◆ LinearForceLimit

float URRPhysicsJointComponent::LinearForceLimit = UE_BIG_NUMBER

◆ LinearSpring

float URRPhysicsJointComponent::LinearSpring = 1000

◆ LinearVelocitySmoothingAcc

float URRPhysicsJointComponent::LinearVelocitySmoothingAcc = 10.f

Acceleration[cm/ss] used by velocity smoothing if #bVelocitySmoothing = true.

UPROPERTY(EditAnywhere, BlueprintReadWrite)

◆ MidAngularVelocityTarget

FVector URRPhysicsJointComponent::MidAngularVelocityTarget = FVector::ZeroVector
protected

AngularVelocityTarget for smoothing.

UPROPERTY(VisibleAnywhere)

◆ MidLinearVelocityTarget

FVector URRPhysicsJointComponent::MidLinearVelocityTarget = FVector::ZeroVector
protected

LinearVelocityTarget for smoothing.

UPROPERTY(VisibleAnywhere)

◆ MidOrientationTarget

FRotator URRPhysicsJointComponent::MidOrientationTarget = FRotator::ZeroRotator
protected

OrientationTarget for smoothing.

UPROPERTY(VisibleAnywhere)

◆ MidPositionTarget

FVector URRPhysicsJointComponent::MidPositionTarget = FVector::ZeroVector
protected

PositionTarget for smoothing.

UPROPERTY(VisibleAnywhere)

◆ OrientationTPI

TStaticArray<TwoAngleInterpolation, 3> URRPhysicsJointComponent::OrientationTPI
protected

Angular Two Point Interpolation used with bSmoothing = true.

◆ PErrInt

FVector URRPhysicsJointComponent::PErrInt = FVector::ZeroVector
protected

Position Error Integral used with bSmoothing = false.

UPROPERTY(VisibleAnywhere)

◆ PositionTPI

TStaticArray<TwoPointInterpolation, 3> URRPhysicsJointComponent::PositionTPI
protected

Position Two Point Interpolation used with bSmoothing = true.


The documentation for this class was generated from the following file: