-
Notifications
You must be signed in to change notification settings - Fork 454
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
Sync carla actor creation #571
base: master
Are you sure you want to change the base?
Conversation
Wait one tick before creating carla actors to ensure the transforms of the newly spawned actors have been updated by the server
Hi @berndgassmann , I've tested this pr with roslaunch command. However, sometimes there are exception messages that prevent the vehicle from being generated properly. Maybe it has something to do with the order in which the objects are spawned?
|
ok, seems like the pseudo object in your case requires the real actor that is postponed to the next tick. So we should also postpone those... I thought it might be sufficient to postpone the actual carla actors. I'll change that and provide an update here, then all commands are executed in the next tick. |
Sometimes I still get the wrong transformation message, especially for relative_transform = trans.carla_transform_to_ros_pose(carla_actor.get_transform()) During my testing, I added one more frame delay here and the problem did not recur. I don't know if you are having the same problem, maybe this is due to differences in hardware performance? Thanks a lot for your replies. if timestamp and task[2] and task[2].frame+1 >= timestamp.frame:
task_queue.put(task) |
@berndgassmann @KevinLADLee I've been testing this PR and this solution may still lead to the same behavior as before. Most of the times is working as expected but there is a race condition that reproduces the same issue as before (actually, I've only reproduced the problem once after several tests). The problem is that the update cycle and the spawning service run in different threads. It may be the case where we Also, we need to check that this change doesn't break the asynchronous mode. |
@KevinLADLee Yeah, I think this can be happening due to that race condition. In principle, once you spawn the actor you only need one |
and fix task_queue assignment
Yes, I encountered the same. Now it should be robust (at least time now starting 15 times one after another all worked). I also added some notes on why this is required. Hope now all works reliably. |
@joel-mb I added the frame information also to async mode, even though there the 2 frame might sill not be enough since the server can rush in the meantime and multiple frames theoretically can already be in the processing queue inside the client. |
Hmm, maybe we can also deploy the actor.is_alive flag to get rid of this problem (for both). At least if it's getting valid if data has been received via rpc from server, that should then also work. |
Alive flag is already True directly after creation at client side ... but actually the actor is not yet fully alive after creation. At least this could be an option of how this might be solved in future versions; the actor on client side is kept in state e.g. ActorState::PendingCreation until the server had actually created it and sent back a message with ActorState::Active state. Then one would be able to differentiate between those locally at client side. For now looks as if we have to stick in async mode with this solution, I guess. |
@KevinLADLee |
@Roosstef I've just checked the markers without this fix. And they look the same (below the streetlevel). Therefore, it's a separate issue. |
@joel-mb can we then merge this one, as it's definitely solving the issue with current CALRA version. |
@berndgassmann Sorry for the delay, Basically, the root of the problem is a bug in CARLA. Right now, when you spawn an actor in CARLA and you try to get its information with the same client without doing a tick you get wrong information. This bug will be fixed for the next release. Actors spawned by other clients (e.g., manual control, scenario runner, ...) don't have this problem because for the ROS bridge to be aware of them a tick is necessary. Probably we will need to revisit this part of the code for the next release, when fixed this bug in CARLA. |
PR #576 also solves the issue without delaying. So we might want to go with Joel's one. |
@berndgassmann Thanks for testing the PR. #576 has already been merged. I'm closing this one. |
Seems like this PR is still relevant, as with larger maps the #576 still doesn't fix the issue. |
Wait one tick before creating carla actors to ensure the transforms of
the newly spawned actors have been updated by the server.
closes #565
This change is