Hi there, i got confused by using carla.World().on_tick function. Just take the official example manual_contro.py , in this script in the World class, there is one command:“self.world.on_tick(hud.on_world_tick)”, in which the parameter is hud.on_world_tick, but hud.on_world_tick function should be needing a parameter timestamp, then i refer to python API reference page, and got this:" callback – A defined function with a snapshot as compulsory parameter that will be called every tick." How does it work? Anyone gives me a hint?
Hello, I agree that it is confusing. This timestamp parameter is automatically given by the on_tick call. Basically, a way to see it is, you aren’t calling this hud.on_world_tick function directly, but telling to the on_tick to do so, which it internally adds the timestamp parameter to the callback. I’m not saying this is how its done, but a way to understand what’s happening.
Also, as of right now, when you use on_tick, the function cannot have any parameters other than self, if its part of a class, and timestamp.
Amazing! thanks for the reply