Skip to content

Commit 74a4ed9

Browse files
authored
Fix/relax open3d version (#118)
* relaxing open3d version requirement * relaxing open3d version requirement * update documentation
1 parent 4e4aa41 commit 74a4ed9

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

client/python/projectairsim/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ dependencies = [
3636
"jsonlines",
3737
"Shapely",
3838
"azure-storage-blob",
39-
"open3d==0.16.*"
39+
"open3d>=0.16.0"
4040
]
4141

4242
[project.optional-dependencies]

client/python/projectairsim/src/projectairsim/lidar_utils.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from argparse import ArgumentError
22
import multiprocessing as mp
3+
import time
34

45
import numpy as np
56
import open3d as o3d
@@ -24,8 +25,8 @@ def __init__(self):
2425
class SetViewBoundsRequest:
2526
"""Class for requesting the display loop recalculate the view bounds"""
2627

27-
def __init__(self):
28-
pass
28+
def __init__(self, view_bounds):
29+
self.view_bounds = view_bounds
2930

3031
class ViewChangeRequest:
3132
"""Class for making a view change request to the display loop"""
@@ -96,7 +97,7 @@ def __init__(
9697
if (view == self.VIEW_CUSTOM) and (
9798
not lookat_xyz or not view_front or not view_up
9899
):
99-
raise ArgumentError(
100+
raise ValueError(
100101
"LidarDisplay: View is VIEW_CUSTOM but one or more of lookat_xyz,"
101102
" view_front, or view_up arguments are missing"
102103
)
@@ -116,7 +117,7 @@ def __init__(
116117
self.PLASMA_PALLETE.shape[0],
117118
)
118119
else:
119-
raise ArgumentError("LidarDisplay: Invalid color_intensity_range")
120+
raise ValueError("LidarDisplay: Invalid color_intensity_range")
120121

121122
def set_view_preset(self, view: int, lookat_xyz=None):
122123
if view == self.VIEW_TOPDOWN:
@@ -138,11 +139,11 @@ def set_view_preset(self, view: int, lookat_xyz=None):
138139
self.lookat_xyz = [0.0, 0.0, 5.0] if not lookat_xyz else lookat_xyz
139140
self.view = view
140141
elif view == self.VIEW_CUSTOM:
141-
raise ArgumentError(
142+
raise ValueError(
142143
"VIEW_CUSTOM is not valid here--call set_view_custom() instead"
143144
)
144145
else:
145-
raise ArgumentError(f"Unrecognized preset view ID {view}")
146+
raise ValueError(f"Unrecognized preset view ID {view}")
146147

147148
if self.running:
148149
self.control_q.put(
@@ -366,13 +367,22 @@ def display_loop(self):
366367
self.set_view()
367368

368369
# Do Open3D processing
369-
self.o3d_vis.poll_events()
370-
self.o3d_vis.update_renderer()
370+
if self.window_created:
371+
# check if window is still open
372+
if not self.o3d_vis.poll_events():
373+
self.running = False
374+
break
375+
self.o3d_vis.update_renderer()
376+
377+
# Cap frame rate to reduce CPU usage and avoid issues with DWM/WGL on Windows
378+
time.sleep(0.01)
371379

372380
except KeyboardInterrupt:
373381
pass # Just exit normally
374382

375383
finally:
384+
if self.window_created:
385+
self.o3d_vis.destroy_window()
376386
self.window_created = False
377387

378388
def receive(self, lidar_data):

docs/client_setup.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
A Python client uses the following to communicate with the Project AirSim simulation server:
66

7-
- Python 3.7-3.9, 64-bit
7+
- Python 3.7 or newer, 64-bit
88
- **[pynng](https://github.com/codypiersall/pynng)** nanomsg-next-gen wrapper pip package
99

1010
### Setting Up the Client on **Windows**
1111

12-
1. Install Python 3.7-3.9 for Windows. There are many options for installing Python, but one recommended way is to:
12+
1. Install Python 3.7 or newer for Windows. There are many options for installing Python, but one recommended way is to:
1313

1414
- Download the official **[Windows installer for Python](https://www.python.org/downloads/windows/)**. Please note that the 64-bit version is required.
1515

@@ -21,12 +21,12 @@ A Python client uses the following to communicate with the Project AirSim simula
2121

2222
2. Activate the Python environment to use with Project AirSim.
2323

24-
If you don't have a suitable Python environment yet, do the following. Here, we assume we're using Python 3.8 installed in the directory `C:\Python38`, but use the version and directory of your installation of Python:
24+
If you don't have a suitable Python environment yet, do the following. Use the version and directory of your installation of Python:
2525

2626
A) Install `virtualenv` and create a new environment (here named `airsim-venv` but you may choose any convenient name):
2727

28-
C:\Python310\python -m pip install virtualenv
29-
C:\Python310\python -m venv C:\path\to\airsim-venv
28+
python -m pip install virtualenv
29+
python -m venv C:\path\to\airsim-venv
3030

3131
B) Activate your environment:
3232

@@ -72,9 +72,9 @@ A Python client uses the following to communicate with the Project AirSim simula
7272

7373
### Setting Up the Client on **Linux**
7474

75-
1. Install Python 3.7-3.9 to your system:
75+
1. Install Python 3.7 or newer to your system:
7676

77-
Ubuntu 20.04 comes with Python 3.8, but Project AirSim requires additional packages:
77+
Ubuntu 20.04 comes with Python 3.8, while newer versions like Ubuntu 24.04 come with Python 3.12:
7878

7979
sudo apt install python3-dev python3-venv
8080

0 commit comments

Comments
 (0)