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

How to find specific controllable with Python API #1928

Open
krtt opened this issue Dec 22, 2021 · 1 comment
Open

How to find specific controllable with Python API #1928

krtt opened this issue Dec 22, 2021 · 1 comment
Labels
answered Waiting for response

Comments

@krtt
Copy link

krtt commented Dec 22, 2021

Sim v2021.3 (Linux)

How to find one specific traffic light on a map (we have ~70 in total) if Python API only has the following information (documentation):

For a controllable object of interest, you can get following information:

signal = controllables[0]
print("Type:", signal.type)
print("Transform:", signal.transform)
print("Current state:", signal.current_state)
print("Valid actions:", signal.valid_actions)

But if I want to see in VSE where is the traffic light of my interest, then there is only this info per controllable:

{"uid":"310e0042-66ad-4f60-8029-66e6b54d6e47","policy":[],"spawned":false}

How to connect what is what if one has only transform and other only uid?
Unity did not help to connect them either. How do you do it?

@EricBoiseLGSVL
Copy link
Contributor

We connect them by noting the position of the map signal controllable. We compare the transform data.

From python api quick scripts 27-control-trafficlights.py

# # Get a list of controllable objects
controllables = sim.get_controllables("signal")
print("\n# List of controllable objects in {} scene:".format(lgsvl.wise.DefaultAssets.map_borregasave))
for c in controllables:
    print(c)

signal = sim.get_controllable(lgsvl.Vector(15.5, 4.7, -23.9), "signal")
print("\n# Signal of interest:")
print(signal)

Having 70+ map signals in a single map worries me that your map is too large. It's best to take map sections and test very specific use case test for small areas instead of a large map. You can have issues with memory with a large map.

@EricBoiseLGSVL EricBoiseLGSVL added the answered Waiting for response label Dec 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered Waiting for response
Projects
None yet
Development

No branches or pull requests

2 participants