Merge remote-tracking branch 'carla/dev' into berndgassmann/rework_ros2_step_1_harmonize_build

This commit is contained in:
berndgassmann 2024-07-08 18:30:03 +02:00
commit fa5b123c48
5 changed files with 34 additions and 6 deletions

View File

@ -12,11 +12,11 @@ namespace carla {
namespace rpc { namespace rpc {
enum class ActorAttributeType : uint8_t { enum class ActorAttributeType : uint8_t {
Bool, Bool = 1u,
Int, Int = 2u,
Float, Float = 3u,
String, String = 4u,
RGBColor, RGBColor = 5u,
SIZE, SIZE,
INVALID INVALID

View File

@ -37,7 +37,7 @@ namespace client {
std::ostream &operator<<(std::ostream &out, const ActorAttribute &attr) { std::ostream &operator<<(std::ostream &out, const ActorAttribute &attr) {
using Type = carla::rpc::ActorAttributeType; using Type = carla::rpc::ActorAttributeType;
static_assert(static_cast<uint8_t>(Type::SIZE) == 5u, "Please update this function."); static_assert(static_cast<uint8_t>(Type::SIZE) == 6u, "Please update this function.");
out << "ActorAttribute(id=" << attr.GetId(); out << "ActorAttribute(id=" << attr.GetId();
switch (attr.GetType()) { switch (attr.GetType()) {
case Type::Bool: case Type::Bool:

View File

@ -1593,6 +1593,12 @@ void UActorBlueprintFunctionLibrary::MakePedestrianDefinition(
EActorAttributeType::String, EActorAttributeType::String,
GetAge(Parameters.Age)}); GetAge(Parameters.Age)});
Definition.Attributes.Emplace(FActorAttribute{
TEXT("can_use_wheel_chair"),
EActorAttributeType::Bool,
Parameters.bCanUseWheelChair ? TEXT("true") : TEXT("false") });
if (Parameters.Speed.Num() > 0) if (Parameters.Speed.Num() > 0)
{ {
FActorVariation Speed; FActorVariation Speed;
@ -1606,6 +1612,8 @@ void UActorBlueprintFunctionLibrary::MakePedestrianDefinition(
Definition.Variations.Emplace(Speed); Definition.Variations.Emplace(Speed);
} }
bool bCanUseWheelChair = Parameters.bCanUseWheelChair;
FActorVariation IsInvincible; FActorVariation IsInvincible;
IsInvincible.Id = TEXT("is_invincible"); IsInvincible.Id = TEXT("is_invincible");
IsInvincible.Type = EActorAttributeType::Bool; IsInvincible.Type = EActorAttributeType::Bool;
@ -1613,6 +1621,20 @@ void UActorBlueprintFunctionLibrary::MakePedestrianDefinition(
IsInvincible.bRestrictToRecommended = false; IsInvincible.bRestrictToRecommended = false;
Definition.Variations.Emplace(IsInvincible); Definition.Variations.Emplace(IsInvincible);
FActorVariation WheelChairVariation;
WheelChairVariation.Id = TEXT("use_wheelchair");
WheelChairVariation.Type = EActorAttributeType::Bool;
if(bCanUseWheelChair)
{
WheelChairVariation.RecommendedValues = { TEXT("true"), TEXT("false") };
}
else
{
WheelChairVariation.RecommendedValues = { TEXT("false") };
}
WheelChairVariation.bRestrictToRecommended = true;
Definition.Variations.Emplace(WheelChairVariation);
Success = CheckActorDefinition(Definition); Success = CheckActorDefinition(Definition);
} }

View File

@ -55,4 +55,7 @@ struct CARLA_API FPedestrianParameters
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 Generation = 0; int32 Generation = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool bCanUseWheelChair = false;
}; };

View File

@ -24,6 +24,9 @@ public:
UPROPERTY(Category="Walker Base", BlueprintReadWrite, EditAnywhere) UPROPERTY(Category="Walker Base", BlueprintReadWrite, EditAnywhere)
float AfterLifeSpan = 10.0f; float AfterLifeSpan = 10.0f;
UPROPERTY(Category="Walker Base", BlueprintReadWrite, EditAnywhere)
bool bUsesWheelChair = false;
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void StartDeathLifeSpan() void StartDeathLifeSpan()
{ {