2025-04-30 21:28:42 +07:00
|
|
|
|
#pragma once
|
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
|
#include "RobotPilotComponent.generated.h"
|
|
|
|
|
|
2025-05-06 19:13:41 +07:00
|
|
|
|
struct FRemoteControlPayload;
|
|
|
|
|
|
2025-04-30 21:28:42 +07:00
|
|
|
|
USTRUCT(BlueprintType)
|
|
|
|
|
struct FRobotActuators
|
|
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
// Do we need a prent struct?
|
|
|
|
|
// What will be in common?
|
|
|
|
|
};
|
|
|
|
|
|
2025-05-07 15:43:18 +07:00
|
|
|
|
USTRUCT(BlueprintType)
|
|
|
|
|
struct FTrainingEpisodeData
|
|
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
FJsonObject JointsStates; // The total series of joint values per frame
|
|
|
|
|
FJsonObject ControlsStates; // The total series of joint values per frame
|
|
|
|
|
FJsonObject JointsStats; // The min / max / mean / std for joints series
|
|
|
|
|
FJsonObject ControlsStats; // The min / max / mean / std for controls series
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2025-04-30 21:28:42 +07:00
|
|
|
|
class ARobotPawn;
|
|
|
|
|
|
|
|
|
|
UCLASS(Blueprintable)
|
|
|
|
|
class LUCKYWORLDV2_API URobotPilotComponent : public UActorComponent
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
URobotPilotComponent();
|
|
|
|
|
|
|
|
|
|
virtual void BeginPlay() override;
|
|
|
|
|
virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
|
|
|
|
virtual void InitPilotComponent();
|
2025-05-01 03:11:58 +07:00
|
|
|
|
virtual void PostPhysicStepUpdate(const float SimulationTime);
|
2025-05-03 01:45:06 +07:00
|
|
|
|
virtual FTransform GetReachableTransform();
|
2025-05-04 01:04:44 +07:00
|
|
|
|
virtual bool GetIsReadyForTraining();
|
|
|
|
|
virtual bool GetIsInRestState();
|
|
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable)
|
|
|
|
|
virtual void SetRobotTarget(const FTransform& TargetTransformIn);
|
|
|
|
|
virtual void SetRobotCurrentRewardZone(const FTransform& RewardTransformIn);
|
2025-05-06 19:13:41 +07:00
|
|
|
|
|
|
|
|
|
UFUNCTION()
|
|
|
|
|
virtual void ReceiveRemoteCommand(const FRemoteControlPayload& RemoteRobotPayload);
|
2025-05-07 15:43:18 +07:00
|
|
|
|
|
|
|
|
|
// Data
|
|
|
|
|
virtual FJsonObject GetBufferedControlsData();
|
|
|
|
|
virtual FJsonObject GetBufferedJointsData();
|
|
|
|
|
virtual FTrainingEpisodeData GetTrainingEpisodeData();
|
|
|
|
|
|
|
|
|
|
|
2025-04-30 21:28:42 +07:00
|
|
|
|
|
2025-05-01 03:11:58 +07:00
|
|
|
|
protected: // Child class need access
|
2025-04-30 21:28:42 +07:00
|
|
|
|
// Only to easy access within the component
|
2025-05-01 03:11:58 +07:00
|
|
|
|
TObjectPtr<ARobotPawn> RobotOwner = nullptr;
|
2025-04-30 21:28:42 +07:00
|
|
|
|
|
|
|
|
|
// ----------------
|
|
|
|
|
// ----- ANIM -----
|
|
|
|
|
// ----------------
|
2025-05-01 03:11:58 +07:00
|
|
|
|
protected: // Child class need access
|
2025-04-30 21:28:42 +07:00
|
|
|
|
float AnimationStartTime = 0.f;
|
2025-05-01 03:11:58 +07:00
|
|
|
|
float AnimationDuration = 0.f;
|
2025-04-30 21:28:42 +07:00
|
|
|
|
};
|