Skip to content

Carla 0.10.0 not able to spawn any Walkers. #8827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
NeoGruber opened this issue Apr 10, 2025 · 7 comments
Closed

Carla 0.10.0 not able to spawn any Walkers. #8827

NeoGruber opened this issue Apr 10, 2025 · 7 comments

Comments

@NeoGruber
Copy link

NeoGruber commented Apr 10, 2025

Setup
Describe the setup you are using to run CARLA along with its version:

  • CARLA version: 0.10.0
  • Platform: Ubuntu 22.04
  • Python version: 3.10
  • GPU: RTX 2080
  • GPU Drivers: NVIDIA-SMI 560.35.03

Describe the bug
I am failing to spawn Walkers in Carla. Inside the Unreal Project, the different Assets are available. But when I start the Simulation, I am not able to spawn the Pedestrians.

Steps to reproduce
I installed the UE5 dev branch by the Extended build instructions.
And I tried to spawn the walkers by this script:

import carla
import random

client = carla.Client("localhost", 2000)
client.set_timeout(5.0)
world = client.get_world()
map = world.get_map()

spawn_point = random.choice(map.get_spawn_points())
print("Map:", map.name)
print("Spawn Point:", spawn_point)

bp_lib = world.get_blueprint_library()
walker_bp = bp_lib.find("walker.pedestrian.0015")
ai_bp = bp_lib.find("controller.ai.walker")

walker = world.try_spawn_actor(walker_bp, spawn_point)
world.tick()

if walker:
    walker_controller = world.try_spawn_actor(ai_bp, carla.Transform(), walker)
    world.tick()

    if walker_controller:
        walker_controller.start()
        target = world.get_random_location_from_navigation()
        if not target:
            target = spawn_point.location
        walker_controller.go_to_location(target)
        walker_controller.set_max_speed(1.5)
        print("Walker is moving to:", target)
    else:
        print("Failed to spawn controller.")
else:
    print("Failed to spawn walker.")

The output:

 python src/test.py 
Map: Carla/Maps/Town10HD_Opt
Spawn Point: Transform(Location(x=-41.668877, y=48.905540, z=0.600000), Rotation(pitch=0.000000, yaw=-90.161217, roll=0.000000))
Failed to spawn walker.

And on the Carla side:

LogCarla: Error: Actor Description Class is null.
LogCarla: Warning: Failed to spawn actor 'walker.pedestrian.0015'
LogCarla: Error: Actor not Spawned
LogCarlaServer: Responding error: Spawn failed because of invalid actor description

Expected behavior
The Walker should be spawnable.

@batuhanayfer
Copy link

I'm having the same problem but with spawning traffic cones. Did you find a fix for it ?

@NeoGruber
Copy link
Author

Hey @batuhanayfer, as far as i understood there was a commit 3 Weeks ago that refactored the Actor Factories. For my problem, I managed to track the issue down to the FActorSpawnResult AWalkerActorFactory::SpawnActor method in this commit: ac66720#diff-42c021b581fb5913c53ac02c3c74022d24604689a7c1b377032c5cda65b5b836

FActorSpawnResult AWalkerActorFactory::SpawnActor(
    const FTransform &SpawnAtTransform,
    const FActorDescription &ActorDescription)
{
  FActorSpawnResult SpawnResult;
  if(!IsValid(ActorDescription.Class)) // The actual Actor description class is a nullptr so something wents wrong in the initialization. 
  {
    UE_LOG(LogCarla, Error, TEXT("Actor Description Class is null.")); // this is the log that is the one that crashes
    SpawnResult.Status = EActorSpawnResultStatus::InvalidDescription;
    return SpawnResult;
  }

  AActor* SpawnedActor = GetWorld()->SpawnActor<AActor>(ActorDescription.Class, SpawnAtTransform);
  SpawnResult.Actor = SpawnedActor;

  if(SpawnedActor == nullptr)
  {
    SpawnResult.Status = EActorSpawnResultStatus::Collision;
    return SpawnResult;
  }

  if(PostProcessWalker(SpawnedActor, ActorDescription))
  {
    SpawnResult.Status = EActorSpawnResultStatus::Success;
    return SpawnResult;
  }

  SpawnResult.Status = EActorSpawnResultStatus::UnknownError;
  return SpawnResult;
}

As far as I can guess, something in the LoadWalkerParametersArrayFromFile method wents wrong. I don't have a final fix yet. The commit says there is still wip stuff. So probably there will be a fix soon. :)

TArray<FActorDefinition> AWalkerActorFactory::GetDefinitions()
{
  LoadWalkerParametersArrayFromFile("WalkerParameters.json", WalkersParams); // something wents wrong here? 
  
  UActorBlueprintFunctionLibrary::MakePedestrianDefinitions(WalkersParams, Definitions);
  return Definitions;
}

@nick-bluespace
Copy link

nick-bluespace commented Apr 14, 2025

I had a similar issue to this. For me it looked like the Unreal Engine cook stage wasn't creating all the artifacts I needed, hence LogCarla: Error: Actor Description Class is null. but the blueprint name is still listed from the config.

Editing Unreal/CarlaUnreal/Config/DefaultGame.ini and adding a new line with +DirectoriesToAlwaysCook=(Path="/Game/Carla/Blueprints/<subdir>") worked for me. In my local build from source in <path>/Build/Release/Package/Carla-0.10.0-Linux-Shipping/Linux/CarlaUnreal/Content/Carla/Blueprints/Walkers/ I don't see artifacts for all the source content in <path>/Unreal/CarlaUnreal/Content/Carla/Blueprints/Walkers so my guess is replacing <subdir> with Walkers might unblock.

I don't have enough insight into the full build process to know if this is a hack or bug somewhere else. If lots of blueprints aren't building correctly I think the always cook logic is smart enough where a single +DirectoriesToAlwaysCook=(Path="/Game/Carla/Blueprints") might capture all the missing runtime artifacts.

@NeoGruber
Copy link
Author

Hey @nick-bluespace,

thanks for your advice! Unfortunetly that did not work for me. I also had the issue you described with cars, and there I was able to solve it the same way as you approach, but with the pedestrians I still to get this error.

To clarify my problem: No matter inside the engine or as a coocked binary, I do get the Pedestrian loading issue. So I am pretty sure there is something happening wrong in the loading of the pedestrians.

@zmd-cc
Copy link

zmd-cc commented Apr 21, 2025

Got the same issue.
So I changed to use the release instead of build from source by my self, and this goes well.
https://github.com/carla-simulator/carla/releases/tag/0.10.0

Hope it helps.

@NeoGruber
Copy link
Author

@zmd-cc

Thanks, but unfortunately it does not...
I have built everything from source in order to customize some things.

@NeoGruber
Copy link
Author

NeoGruber commented May 6, 2025

@batuhanayfer
SOLVED:
My Issue was because of the different namings of the Walkers inside:
/path/to/your/carla/Unreal/CarlaUnreal/Content/Carla/Config/WalkerParameters.json

And the actual Walkers located in:
/path/to/your/carla/Unreal/CarlaUnreal/Content/Carla/Blueprints/Walkers

Seems like I got an unlucky state of the content in the manual installation instructions:
https://github.com/carla-simulator/carla.git

The replicated bug looks like:

Warning      LogStreaming              LoadPackage: SkipPackage: /Game/Carla/Blueprints/Walkers/BP_AfroF01_v1_G2_FOO (0x4369952E611DB8E0) - The package to load does not exist on disk or in the loader

Which basically lead into the Failure of loading the Pedestrian:

Log          LogCarla                  Spawning actor 'walker.pedestrian.0015'
Error        LogCarla                  Actor Description Class is null.
Warning      LogCarla                  Failed to spawn actor 'walker.pedestrian.0015'
Error        LogCarla                  Actor not Spawned

I think the new Factory functionality offers great extensibility but lacks in terms of a proper error logging. As the bottom error is clearly related to the upper one.

Thanks to all people that participated and tried to Help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants