Skip to content
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

A question about the explanation of World.wait_for_tick() method in official document #3283

Closed
huan0808 opened this issue Sep 11, 2020 · 4 comments
Assignees
Labels

Comments

@huan0808
Copy link

Hi,
I think this function is a asynchronous method to make client wait server to compute a frame.And if it hasn't done,we can make a loop in client to wait the server.
image
But in document's explanation it seems like a Synchronize method.
image
This confuzed me and if my understand is wrong please tell me why.
Thanks!

@germanros1987
Copy link
Member

@sergi-e could you clarify this?

@yaknostoyok
Copy link
Contributor

yaknostoyok commented Sep 24, 2020

Hi, @huan0808!

You are correct, the Python API docs are misleading. What do you think of these changes?

  • on_tick(self, callback)
    This method is used in asynchronous mode. It starts callbacks from the client for the function defined as callback, and returns the ID of the callback. The function will be called everytime the server ticks. It requires a carla.WorldSnapshot as argument, which can be retrieved from wait_for_tick(). Use remove_on_tick() to stop the callbacks.
    • Parameters:
      • callback (carla.WorldSnapshot) – Function with a snapshot as compulsory parameter that will be called when the client receives a tick.
    • Return: int
  • remove_on_tick(self, callback_id)
    Stops the callback for callback_id started with on_tick().
    • Parameters:
      • callback_id (callback) – The callback to be removed. The ID is returned when creating the callback.
  • tick(self, seconds=10.0)
    This method is used in synchronous mode, when the server waits for a client tick before computing the next frame. This method will send the tick, and give way to the server. It returns the ID of the new frame computed by the server.
    • Parameters:
      • seconds (float) – Maximum time in seconds the server should wait for a tick. It is set to 10.0 by default.
    • Return: int
    • Note: _If no tick is received in synchronous mode, the simulation will freeze. Also, if many ticks are received from different clients, there may be synchronization issues. Please read the docs about synchronous mode to learn more.
      _
  • wait_for_tick(self, seconds=10.0)
    This method is used in asynchronous mode. It makes the client wait for a server tick. When the next frame is computed, the server will tick and return a snapshot describing the new state of the world.
    • Parameters:
      • seconds (float) – Maximum time in seconds the server should wait for a tick. It is set to 10.0 by default.
    • Return: carla.WorldSnapshot

@huan0808
Copy link
Author

I think it's good now,thank you :)

@yshen47
Copy link

yshen47 commented Nov 7, 2020

I also find it's misleading. could you update the documentation in the latest version? it is still like before

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

No branches or pull requests

4 participants