You've already forked LuckyWorld
FT - EpisodeSubSystem
+ Integrate DataTransfer plugin into project + Raw architecture of EpisodeSubSystem
This commit is contained in:
@ -23,7 +23,7 @@ public class LuckyWorldV2 : ModuleRules
|
||||
"RenderCore"
|
||||
});
|
||||
|
||||
PrivateDependencyModuleNames.AddRange(new string[] { });
|
||||
PrivateDependencyModuleNames.AddRange(new string[] {"LuckyDataTransfer"});
|
||||
|
||||
// Uncomment if you are using Slate UI
|
||||
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
|
||||
|
51
Source/LuckyWorldV2/Private/Episode/EpisodeSubSystem.cpp
Normal file
51
Source/LuckyWorldV2/Private/Episode/EpisodeSubSystem.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
#include "Episode/EpisodeSubSystem.h"
|
||||
|
||||
|
||||
UEpisodeSubSystem::UEpisodeSubSystem()
|
||||
{
|
||||
}
|
||||
|
||||
void UEpisodeSubSystem::Initialize(FSubsystemCollectionBase& Collection)
|
||||
{
|
||||
Super::Initialize(Collection);
|
||||
}
|
||||
|
||||
void UEpisodeSubSystem::Deinitialize()
|
||||
{
|
||||
Super::Deinitialize();
|
||||
}
|
||||
|
||||
void UEpisodeSubSystem::Tick(float DeltaTime)
|
||||
{
|
||||
// if capture has started
|
||||
if (!bIsCapturing) return;
|
||||
|
||||
// Flow that we need to figure out
|
||||
|
||||
// ProceduralSceneController - is object spawned? -> If not spawn it
|
||||
// if object spawned && !robot.hasTarget -> Robot -> SetTarget
|
||||
// if object.IsSpawned && robot.hasTarget -> Capture and send data
|
||||
// ProceduralSceneController -> is object collected?
|
||||
// How to reset the episode?
|
||||
}
|
||||
|
||||
void UEpisodeSubSystem::StartNewEpisode()
|
||||
{
|
||||
// Noah
|
||||
// Configure the DataTransfer -> Use CurrentRobot->Cameras
|
||||
// Start the Capture
|
||||
// Make specs for JB to add API on the robot data
|
||||
|
||||
// JB
|
||||
// Find the current Robot in Scene
|
||||
// Store as CurrentRobot
|
||||
// Order the robot to go fetch an object
|
||||
|
||||
// Both of us once we finished our own tasks and synced
|
||||
// - Spawn the shape at random locations -> might need another controller like ProceduralSceneSubSystem?
|
||||
// - Add the timestamp debug component on the scene to check if the rendered frame and the data are in sync
|
||||
|
||||
// TODO Which Tick is responsible of the scene capture?
|
||||
|
||||
bIsCapturing = true;
|
||||
}
|
@ -1,10 +1,7 @@
|
||||
#include "Robot/PilotComponent/RobotPilotSO100Component.h"
|
||||
|
||||
#include "Actors/MujocoVolumeActor.h"
|
||||
#include "Kismet/KismetMathLibrary.h"
|
||||
#include "Kismet/KismetSystemLibrary.h"
|
||||
#include "Robot/RobotPawn.h"
|
||||
#include "Serialization/ShaderKeyGenerator.h"
|
||||
|
||||
URobotPilotSO100Component::URobotPilotSO100Component()
|
||||
{
|
||||
|
@ -1,5 +1,9 @@
|
||||
#include "Robot/RobotPawn.h"
|
||||
|
||||
#include "LuckySensorPawnBase.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "Kismet/KismetMathLibrary.h"
|
||||
#include "Kismet/KismetSystemLibrary.h"
|
||||
#include "Robot/PilotComponent/RobotPilotMultiRotorDrone.h"
|
||||
#include "Robot/PilotComponent/RobotPilotSO100Component.h"
|
||||
|
||||
@ -10,13 +14,13 @@ ARobotPawn::ARobotPawn()
|
||||
void ARobotPawn::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
InitRobot(); // TODO Maybe move to GameInstance to control when we initialize the robot completely
|
||||
// InitRobot(); // TODO Maybe move to GameInstance to control when we initialize the robot completely
|
||||
}
|
||||
|
||||
void ARobotPawn::InitRobot()
|
||||
{
|
||||
InitPilotComponent();
|
||||
// Other initialization tasks
|
||||
InitCamera();
|
||||
}
|
||||
|
||||
void ARobotPawn::InitPilotComponent()
|
||||
@ -65,3 +69,18 @@ void ARobotPawn::InitPilotComponent()
|
||||
RobotPilotComponent->RegisterComponent();
|
||||
}
|
||||
}
|
||||
|
||||
void ARobotPawn::InitCamera()
|
||||
{
|
||||
// TODO Fix the spawning of sensors in Cpp and spawn them using a config?
|
||||
// TODO How people can move the camera themselves?
|
||||
|
||||
// Find all sensors in the scene
|
||||
TArray<AActor*> Sensors;
|
||||
UGameplayStatics::GetAllActorsOfClass(this->GetWorld(), ALuckySensorPawnBase::StaticClass(), Sensors);
|
||||
|
||||
for (const auto Sensor : Sensors)
|
||||
{
|
||||
if (const auto Camera = Cast<ALuckySensorPawnBase>(Sensor)) Cameras.Add(Camera);
|
||||
}
|
||||
}
|
||||
|
35
Source/LuckyWorldV2/Public/Episode/EpisodeSubSystem.h
Normal file
35
Source/LuckyWorldV2/Public/Episode/EpisodeSubSystem.h
Normal file
@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
#include "CoreMinimal.h"
|
||||
#include "Subsystems/WorldSubsystem.h"
|
||||
#include "EpisodeSubSystem.generated.h"
|
||||
|
||||
|
||||
class ARobotPawn;
|
||||
|
||||
UCLASS()
|
||||
class LUCKYWORLDV2_API UEpisodeSubSystem : public UWorldSubsystem
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Setup
|
||||
UEpisodeSubSystem();
|
||||
virtual void Initialize(FSubsystemCollectionBase& Collection);
|
||||
virtual void Deinitialize();
|
||||
|
||||
virtual void Tick(float DeltaTime);
|
||||
|
||||
// ---------------------
|
||||
// ------- START -------
|
||||
// ---------------------
|
||||
/**
|
||||
* Called by the UI when pressing the "Capture" button
|
||||
*/
|
||||
void StartNewEpisode();
|
||||
|
||||
private:
|
||||
bool bIsCapturing = false;
|
||||
|
||||
UPROPERTY()
|
||||
TObjectPtr<ARobotPawn> CurrentRobot;
|
||||
};
|
@ -3,6 +3,7 @@
|
||||
#include "SharedDef.h"
|
||||
#include "RobotPawn.generated.h"
|
||||
|
||||
class ALuckySensorPawnBase;
|
||||
class AMujocoVolumeActor;
|
||||
class URobotPilotComponent;
|
||||
|
||||
@ -19,6 +20,7 @@ public:
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
// TODO Called by GameInstance after robot has been spawned
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void InitRobot();
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
@ -37,5 +39,13 @@ public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
URobotPilotComponent* RobotPilotComponent = nullptr;
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void InitPilotComponent(); // This should have Robot type as parameter?
|
||||
void InitPilotComponent(); // This should have Robot type as parameter?
|
||||
|
||||
|
||||
// ---------------------
|
||||
// ------ SENSORS ------
|
||||
// ---------------------
|
||||
void InitCamera();
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TArray<TObjectPtr<ALuckySensorPawnBase>> Cameras;
|
||||
};
|
||||
|
Reference in New Issue
Block a user