carla-simulator / carla

Open-source simulator for autonomous driving research.
http://carla.org
MIT License
11.39k stars 3.7k forks source link

Parked cars are not actors #2343

Closed carlaUser closed 3 years ago

carlaUser commented 4 years ago

The parked cars loaded by default in the maps are not listed as actors by world.get_actors(). This is due to the fact that it is only the static meshes that are deployed in the map in the Unreal Editor, instead of the corresponding actors (due to performance reasons, I guess?).

The problem with this is that they are not accessible from the Python client as far as I know, and I cannot, therefore, get their positions or bounding boxes when generating the ground truth of a scene.

Is there any way to access this information (without having to alter the maps in the editor) that I might have missed?

jeffreykxiao commented 4 years ago

Unfortunately, I don't believe there is any way to handle this from outside the Unreal project. You're correct about the proximal reason: the parked cars in the maps are indeed StaticMeshActors and Carla's API abstracts away the Unreal notion of "actor" in favor of their own Actor/Vehicle/etc classes used in their EpisodeState and ActorList. When you query the Carla World class, it sends you info from these.

However, based on the documentation it seemed to me that the get_actors function you're calling should be able to get other UE4 actors in the scene. I was able to find the culprit in CarlaEpisode Line196:

https://github.com/carla-simulator/carla/blob/954f36b6a039134e15c2a08945ad8517a871f691/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Game/CarlaEpisode.cpp#L196

This InitializeAtBeginPlay() function is responsible for registering other actor types in the ActorList and this line ensures that we don't get static meshes with mobility set to Static/Stationary (like buildings and the such). Unfortunately, the parked car StaticMeshActors also have mobility set to Static, so they get excluded (mistakenly, IMO) by this code.

My suggestion would be for the parked cars to have their mobility changed to Movable, so that they will no longer be ignored. This is both simple and resolves your problem. I would also be fine with the concept of parked cars being removed entirely from maps and instead transferred to an external concept such as a Scenario and spawned in at the start of a run.

stevelaclasse commented 4 years ago

I have edited the those cars with the mobility Movable, but they don't get them in the actor list, i d´think because they are tagged as "Static Mesh" in Unreal.

the other method would be to remove all the parked cars from the Maps, but would have preferred letting there and get their information.

jeffreykxiao commented 4 years ago

Yeah, looking at the code it would seem that even if they are set as movable, they'll still be of type "prop" in the blueprint API (since all StaticMeshActors get tagged as props), meaning they won't show up as actors in the actor list. What a bummer.

stevelaclasse commented 4 years ago

in which file could it be possible to edit those properties ?

stevelaclasse commented 4 years ago

I have edited the Maps of Town 1 to 5 and removed all the parked cars,

https://github.com/stevelaclasse/Carla_Test/blob/master/Edited%20Maps%200.9.6.zip

xinshuoweng commented 4 years ago

having static vehicles parked on the map is good and increases the diversity and reality of the data. So it would be very nice if the Carla team can help add features that can control those vehicles in the future release.

germanros1987 commented 4 years ago

I agree. @XGodina @doterop let's make all our vehicles actors, even if by default they are in an "idle" state.

JMorceaux commented 4 years ago

I have edited the Maps of Town 1 to 5 and removed all the parked cars,

https://github.com/stevelaclasse/Carla_Test/blob/master/Edited%20Maps%200.9.6.zip

Thanks, really helpful !

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

xinshuoweng commented 4 years ago

I agree. @XGodina @doterop let's make all our vehicles actors, even if by default they are in an "idle" state.

Thanks, German! It would be nice to see this feature of controlling static vehicles as actors soon.

p-testolina commented 4 years ago

I'm working on the bounding box extraction as well, this would be a nice feature to have! Thanks for your work guys.

arashroomi commented 4 years ago

I have a similar issue but I am interested to extract more than just parked cars. In specific buildings, parked vehicles, and other obstacles. Is there a solution to extract their bounding boxes before rendering?

stevelaclasse commented 4 years ago

I had tried to edit parked cars properties from UE4 engine, i have tried to assign some properties of the mobile cars to the parked cars for them to be recognized by the Carla API, but with no success. I have only made some change in the properties, but with changes also in the categories and classes, it may be possible to achieved it.

doterop commented 4 years ago

Hi to everyone,

We added a method in our last release 0.9.10 to retrieve all the bounding boxes of all the elements of the level. So, if you need to get the bb of the parked vehicles call: bboxes = world.get_level_bbs(carla.CityObjectLabel.Vehicles) This call will include every vehicle in the level, so if you only need the parked vehicles call it after loading the level and before spawning any other.

Besides, we are working on the possibility to disable specific elements of the level, thus you can disable specific parked cars or all of them, and convert the parked cars into actors so you can control them. But this will come on the next release 0.9.11.

Ping me if you need any help.

tinmodeHuang commented 4 years ago

Hi to everyone,

We added a method in our last release 0.9.10 to retrieve all the bounding boxes of all the elements of the level. So, if you need to get the bb of the parked vehicles call: bboxes = world.get_level_bbs(carla.CityObjectLabel.Vehicles) This call will include every vehicle in the level, so if you only need the parked vehicles call it after loading the level and before spawning any other.

Besides, we are working on the possibility to disable specific elements of the level, thus you can disable specific parked cars or all of them, and convert the parked cars into actors so you can control them. But this will come on the next release 0.9.11.

Ping me if you need any help.

could you tell me when it will be released? in addition, is that to say that I can easily have access to states of all actors such as posititon, velocity and heading, etc?

arashroomi commented 4 years ago

Hi to everyone,

We added a method in our last release 0.9.10 to retrieve all the bounding boxes of all the elements of the level. So, if you need to get the bb of the parked vehicles call: bboxes = world.get_level_bbs(carla.CityObjectLabel.Vehicles) This call will include every vehicle in the level, so if you only need the parked vehicles call it after loading the level and before spawning any other.

Besides, we are working on the possibility to disable specific elements of the level, thus you can disable specific parked cars or all of them, and convert the parked cars into actors so you can control them. But this will come on the next release 0.9.11.

Ping me if you need any help.

So will it also contain the bounding boxes of the buildings and trees and other objects?

doterop commented 4 years ago

Hi @tinmodeHuang ,

could you tell me when it will be released? in addition, is that to say that I can easily have access to states of all actors such as posititon, velocity and heading, etc?

The 0.9.11 should be released between the end of this year and beginning of the next one. Unfortunately, I can't be more precise about it. When you say actors here, I guess that you mean Unreal actors right? Because you already can know the position, orientation and velocity of a Carla actor. If this is not the case, can you elaborate the question a bit further please?

Hi @arashroomi ,

So will it also contain the bounding boxes of the buildings and trees and other objects?

This is already added. There is a function called get_level_bbs in world and you can filter it by the object type. Is the same type used in the semantic segmentation. Example:

// Retrieve the BBs of all the vehicles of the level. Spawned cars and parked cars
vehicles_bbs = world.get_level_bbs(carla.CityObjectLabel.Vehicles)

// Retrieve the BBs of all the traffic lights of the level (only the box that contains the lights).
tl_bbs = world.get_level_bbs(carla.CityObjectLabel.TrafficLight)

There is a new enum called CityObjectLabel where all the object types are defined.

tinmodeHuang commented 4 years ago

@doterop they refer to actors in Carla such as vehicle, motorcyclist, pedestrian, bicyclist and even parked car. In my implementation of reinforment learning, it acquires real-time information about surrounding traffic aprticipants in Carla to help make a decision.

doterop commented 4 years ago

@tinmodeHuang So, right now with the last release, you could only get the BBs of the parked vehicles and that will give you the position and orientation.

tinmodeHuang commented 4 years ago

@tinmodeHuang So, right now with the last release, you could only get the BBs of the parked vehicles and that will give you the position and orientation.

in that case, only velocity of parked vehicles remains to be determined, so for getting it I just call that function above after loading the level and before spawning any other during the beginning of simulation

doterop commented 4 years ago

Yes @tinmodeHuang , Parked vehicles will not move, so their velocity will be always zero.

tinmodeHuang commented 4 years ago

it turns out that the bounding boxes of all of actors specified are returned only once after calling get_level_bbs() once, instead of all the time at fixed frequency

doterop commented 4 years ago

Can you show at example please to clarify your question?

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stevelaclasse commented 3 years ago

Thank you first of all for providing us the coordinate of parked cars, i have try et_level_bbs() for vehicles and somehow the client_bounding_box.py in Example Folder (that i have updated to work with the new function) does the wrong calculation and the bounding boxes are really bad located. I have tested the two method:

germanros1987 commented 3 years ago

@doterop could you please follow up on this to close this issue for good?

doterop commented 3 years ago

Hi @stevelaclasse

Which values did you receive from both functions on the same bounding box? Could you provide a bit more info with code or images?

Also, the bounding box that you get from the actor is in local coordinates while the bounding boxes from get_level_bbs are in world coordinates since they don't have any reference to any actor.

BuLuNuoCAF commented 1 year ago

I'm having an issue with the designed solution for fetching the bounding boxes for static objects. From the instance segmentation camera I can check which objects are being seen, but when they are non-actor objects, there's no way to recover their bounding box from the encoded GB id. If I use get_level_bbs instead, I can't tell which objects are actually in the field of view of the camera. I can try filtering for near objects but that still doesn't rule out nearby objects hidden behind a wall or any obstacle, thus creating a sort of "x-ray" bug.

Does anyone have a workaround for this situation?