You've already forked LuckyWorld
+ This feature was missing from the plugin while being necessary for robots to work + e.g. SO100 requires the main body and the first arm to have contact exclusion, I guess the piece are too tight in the model? + This is not clean, but making it right requires to have a better understanding of how the MuJoCo actor works - problem for future self
53 lines
2.5 KiB
C++
53 lines
2.5 KiB
C++
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Misc/MujocoOptions.h"
|
|
#include "tinyxml2.h"
|
|
|
|
class UMujocoGeomComponent;
|
|
class UMujocoJointComponent;
|
|
class UMujocoSiteComponent;
|
|
class UMujocoActuatorComponent;
|
|
class UMujocoEqualityComponent;
|
|
class UMujocoTendonComponent;
|
|
class UCameraComponent;
|
|
class USpringArmComponent;
|
|
class UMujocoBodyComponent;
|
|
class USCS_Node;
|
|
class UStaticMesh;
|
|
class UBlueprint;
|
|
|
|
class LUCKYMUJOCO_API FMujocoXmlGenerator
|
|
{
|
|
bool VisitGeomComponent(USCS_Node* SCSNode, UMujocoGeomComponent* GeomComponent, tinyxml2::XMLElement* Element);
|
|
bool VisitJointComponent(USCS_Node* SCSNode, UMujocoJointComponent* JointComponent, tinyxml2::XMLElement* Element);
|
|
bool VisitSiteComponent(USCS_Node* SCSNode, UMujocoSiteComponent* SiteComponent, tinyxml2::XMLElement* Element);
|
|
bool VisitActuatorComponent(USCS_Node* SCSNode, UMujocoActuatorComponent* ActuatorComponent, tinyxml2::XMLElement* Element);
|
|
bool VisitEqualityComponent(USCS_Node* SCSNode, UMujocoEqualityComponent* EqualityComponent, tinyxml2::XMLElement* Element);
|
|
bool VisitTendonComponent(USCS_Node* SCSNode, UMujocoTendonComponent* TendonComponent, tinyxml2::XMLElement* Element);
|
|
bool VisitCameraComponent(USCS_Node* SCSNode, UCameraComponent* CameraComponent, tinyxml2::XMLElement* Element, USpringArmComponent* SpringArmComponent = nullptr);
|
|
bool VisitSpringArm(USCS_Node* SCSNode, USpringArmComponent* SpringArmComponent, tinyxml2::XMLElement* Element);
|
|
bool VisitBodyComponent(USCS_Node* SCSNode, UMujocoBodyComponent* BodyComponent, tinyxml2::XMLElement* Element);
|
|
|
|
bool ParseExportOptions(UMujocoExportOptions* Data, tinyxml2::XMLElement* Element);
|
|
bool ParseBlueprintAsset(UBlueprint* BlueprintAsset, tinyxml2::XMLElement* Root);
|
|
bool ParseActorAsset(AActor* Actor, tinyxml2::XMLElement* Root);
|
|
|
|
TMap<FString, TSoftObjectPtr<UObject>> ObjectMap;
|
|
|
|
public:
|
|
|
|
/**
|
|
* Generate the XML file used by the MuJoCo headless scene representing the physics simulation
|
|
* @param ExportOptions TODO - What they can be?
|
|
* @param Objects Actors and Components to be added to the scene
|
|
* @param ExportFilename pretty much that
|
|
* @param ContactExclusion a list of pairs that should be patched in the xml file for contact exclusion (no friction, no collision)
|
|
* TODO ContactExclusion should be stored as a property of MujocoActor and not passed in the scene init
|
|
*/
|
|
TUniquePtr<tinyxml2::XMLDocument> GenerateMujocoXml(
|
|
const TObjectPtr<UMujocoExportOptions>& ExportOptions,
|
|
const TArray<UObject*>& Objects,
|
|
const FString& ExportFilename,
|
|
TMap<FString, FString> ContactExclusion);
|
|
}; |