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 {
enum class ActorAttributeType : uint8_t {
Bool,
Int,
Float,
String,
RGBColor,
Bool = 1u,
Int = 2u,
Float = 3u,
String = 4u,
RGBColor = 5u,
SIZE,
INVALID

View File

@ -37,7 +37,7 @@ namespace client {
std::ostream &operator<<(std::ostream &out, const ActorAttribute &attr) {
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();
switch (attr.GetType()) {
case Type::Bool:

View File

@ -1593,6 +1593,12 @@ void UActorBlueprintFunctionLibrary::MakePedestrianDefinition(
EActorAttributeType::String,
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)
{
FActorVariation Speed;
@ -1606,6 +1612,8 @@ void UActorBlueprintFunctionLibrary::MakePedestrianDefinition(
Definition.Variations.Emplace(Speed);
}
bool bCanUseWheelChair = Parameters.bCanUseWheelChair;
FActorVariation IsInvincible;
IsInvincible.Id = TEXT("is_invincible");
IsInvincible.Type = EActorAttributeType::Bool;
@ -1613,6 +1621,20 @@ void UActorBlueprintFunctionLibrary::MakePedestrianDefinition(
IsInvincible.bRestrictToRecommended = false;
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);
}

View File

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

View File

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