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

get vehicle bounding box #31

Closed
qazi2 opened this issue Oct 3, 2019 · 3 comments
Closed

get vehicle bounding box #31

qazi2 opened this issue Oct 3, 2019 · 3 comments

Comments

@qazi2
Copy link

qazi2 commented Oct 3, 2019

Hi guys,

I am not able to get vehicle bounding box by given bng.get_vehicle_bbox(vehicle2) after starting the scenario.

bng.load_scenario(scenario)
bng.start_scenario()
vehicle.ai_set_line(path1)
vehicle2.ai_set_line(path2)
vehicle3.ai_set_line(path3)
bng.get_vehicle_bbox(vehicle2)
# Following error occurs:

bbox = bng.get_vehicle_bbox(vehicle2)
  File "D:\Beamng_qazi_data\Thesis_final_code\venv\lib\site-packages\beamngpy\beamng.py", line 1130, in get_vehicle_bbox
    resp = self.recv()
  File "D:\Beamng_qazi_data\Thesis_final_code\venv\lib\site-packages\beamngpy\beamng.py", line 241, in recv
    return recv_msg(self.skt)
  File "D:\Beamng_qazi_data\Thesis_final_code\venv\lib\site-packages\beamngpy\beamngcommon.py", line 155, in recv_msg
    length = int(str(length, 'ascii'))

According to the function it should return:
near_bottom_left: Bottom left point of the near rectangle as an (x, y ,z) triplet
• near_bottom_right: Bottom right point of the near rectangle as an (x, y, z) triplet
• near_top_left: Top left point of the near rectangle as an (x, y, z) triplet
• near_top_right: Top right point of the near rectangle as an (x, y, z) triplet
• far_bottom_left: Bottom left point of the far rectangle as an (x, y, z) triplet
• far_bottom_right: Bottom right point of the far rectangle as an (x, y, z) triplet
• far_top_left: Top left point of the far rectangle as an (x, y, z) triplet
• far_top_right: Top right point of the far rectangle as an (x, y, z) triplet

@Palculator
Copy link
Contributor

I can't reproduce this. I've created a small unit test that spawns two vehicles, makes one drive across the map, and compares the bounding box of the moving vehicle before driving and after 2000 frames to ensure the bounding box moves: https://github.com/BeamNG/BeamNGpy/blob/master/tests/test_vehicle.py#L102

No exceptions when running it and the assertions hold true.

@alessiogambi
Copy link
Contributor

@Palculator: @qazi2 was one of my students in Passau working on creating simulations from videos. He might have misunderstood the meaning of BBox in this context. So to clarify, BBox given by BeamNG.py are NOT the bounding boxes in the image around the cars.

BTW, this might be a very nice feature to add to the camera sensor!

In summary, I think you can close this issues with no remorse.

@Palculator
Copy link
Contributor

Yeah, object bounding boxes for the camera sensor are on my to-do list.

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

No branches or pull requests

3 participants