Compare commits

..

No commits in common. "main" and "fix-remove-physic-scene-reference" have entirely different histories.

10 changed files with 7 additions and 62 deletions

Binary file not shown.

View File

@ -17,7 +17,6 @@
#include "JsonObjectConverter.h"
#include "ReviewComments.h"
#include "WebSocketsModule.h"
#include "IWebSocket.h"
#include "Kismet/KismetStringLibrary.h"
#include "Camera/CameraActor.h"
#include "Camera/CameraComponent.h"
@ -56,7 +55,7 @@ void ULuckyDataTransferSubsystem::Deinitialize()
void ULuckyDataTransferSubsystem::Internal_OpenWebsocket(const FString& URL, const FString& Protocol)
{
const FString NewUrl = URL.IsEmpty() ? TEXT("ws://127.0.0.1:3000/world") : URL;
const FString NewUrl = URL.IsEmpty() ? TEXT("ws://127.0.0.1:3000/ws") : URL;
const FString NewProtocol = Protocol.IsEmpty() ? TEXT("ws") : Protocol;
UE_LOG(LogTemp, Warning, TEXT("Opening WebSocket URL: %s"), *NewUrl);
@ -67,9 +66,6 @@ void ULuckyDataTransferSubsystem::Internal_OpenWebsocket(const FString& URL, con
}
Socket = FWebSocketsModule::Get().CreateWebSocket(NewUrl);
if (Socket.IsValid()) UE_LOG(LogTemp, Warning, TEXT("socket Valid %s"), *NewUrl);
Socket->Connect();
//Set up callbacks
@ -84,9 +80,8 @@ void ULuckyDataTransferSubsystem::Callback_OnConnected()
if (OnSocketReady.IsBound())
{
OnSocketReady.Broadcast(true);
UE_LOG(LogTemp, VeryVerbose, TEXT("WebSocket connected successfully"));
}
UE_LOG(LogTemp, Warning, TEXT("WebSocket connected successfully"));
}
void ULuckyDataTransferSubsystem::Callback_OnConnectionError(const FString& Error)
@ -212,7 +207,7 @@ bool ULuckyDataTransferSubsystem::WriteImageToDisk(const FString& inPath, const
return false;
}
FString Path = inPath.IsEmpty() ? TEXT("../Saved/LuckyRobotsData") : inPath; // swap this for const path
FString Path = inPath.IsEmpty() ? TEXT("C:/LuckyRobotsImages") : inPath;
if (!SensorPawns.IsEmpty())
{

View File

@ -58,9 +58,6 @@ public:
UPROPERTY(BlueprintReadWrite, Category = "Observation")
FString filePath = FString();
UPROPERTY(BlueprintReadWrite, Category = "Observation")
FString timeStamp = FString();
};
USTRUCT(BlueprintType)
@ -69,16 +66,12 @@ struct FObservationPayload
GENERATED_USTRUCT_BODY()
public:
UPROPERTY(BlueprintReadWrite, Category = "Observation")
FString type = FString();
UPROPERTY(BlueprintReadWrite, Category = "Observation")
FString request_id = FString();
UPROPERTY(BlueprintReadWrite, Category = "Observation")
FString timeStamp = FString();
UPROPERTY(BlueprintReadWrite, Category = "Observation")
FString id = FString();
UPROPERTY(BlueprintReadWrite, Category = "Observation")
TMap<FString, float> ObservationState;

View File

@ -209,46 +209,6 @@ mjData_& AMujocoVolumeActor::GetMujocoData() const
return *MujocoData.Get();
}
void AMujocoVolumeActor::UpdateGeomPosition(const FString BodyName, const FVector& NewPosition, const FQuat& NewRotation)
{
// Step 1: Get body ID
const int Body_ID = mj_name2id(MujocoModel.Get(), mjOBJ_BODY, TCHAR_TO_ANSI(*BodyName));
if (Body_ID < 0) {
UE_LOG(LogTemp, Error, TEXT("Body not found: %s"), *BodyName);
return;
}
// Step 2: Get the joint ID (assuming one joint per body)
const int Joint_Adr = MujocoModel->body_jntadr[Body_ID];
if (MujocoModel->jnt_type[Joint_Adr] != mjJNT_FREE) {
UE_LOG(LogTemp, Error, TEXT("Body '%s' does not have a free joint."), *BodyName);
return;
}
// Step 3: Get qpos and qvel addresses
const int Qpos_Adr = MujocoModel->jnt_qposadr[Joint_Adr];
const int Qvel_Adr = MujocoModel->jnt_dofadr[Joint_Adr];
// Step 4: Convert position and rotation
MujocoData->qpos[Qpos_Adr + 0] = NewPosition.X / 100.f; // X
MujocoData->qpos[Qpos_Adr + 1] = -NewPosition.Y / 100.f; // Y (flip for Unreal Z-up)
MujocoData->qpos[Qpos_Adr + 2] = NewPosition.Z / 100.f; // Z
// Unreal (X, Y, Z, W) → MuJoCo (W, X, Y, Z)
MujocoData->qpos[Qpos_Adr + 3] = NewRotation.W;
MujocoData->qpos[Qpos_Adr + 4] = NewRotation.X;
MujocoData->qpos[Qpos_Adr + 5] = NewRotation.Y;
MujocoData->qpos[Qpos_Adr + 6] = NewRotation.Z;
// Step 5: Zero velocity
for (int i = 0; i < 6; i++) {
MujocoData->qvel[Qvel_Adr + i] = 0.0;
}
// Step 6: Update MuJoCo state
mj_forward(MujocoModel.Get(), MujocoData.Get());
}
void AMujocoVolumeActor::SetActuatorValue(const FString& ActuatorName, double Value)
{
if (MujocoModel)

View File

@ -109,10 +109,7 @@ public:
* @return mjData_ - Full access to mujoco scene options and data
*/
mjData_& GetMujocoData() const;
UFUNCTION(BlueprintCallable, Category = "Mujoco")
void UpdateGeomPosition(const FString BodyName, const FVector& NewPosition, const FQuat& NewRotation);
// ---------------------------
// ------- POST UPDATE -------
// ---------------------------