diff --git a/PyFlyt/core/abstractions/base_wind_field.py b/PyFlyt/core/abstractions/base_wind_field.py index 1ccefd72..388a161b 100644 --- a/PyFlyt/core/abstractions/base_wind_field.py +++ b/PyFlyt/core/abstractions/base_wind_field.py @@ -28,7 +28,7 @@ class WindFieldClass(ABC): >>> wind[:, -1] = np.log(position[:, -1]) * self.strength >>> >>> # plus some noise, - >>> wind += self.np_random.randn(*wind.shape) + >>> wind += self.np_random.standard_normal(wind.shape) >>> >>> return wind >>> diff --git a/docs_source/documentation/core/abstractions/base_drone.md b/docs_source/documentation/core/abstractions/base_drone.md index 804773cd..23904990 100644 --- a/docs_source/documentation/core/abstractions/base_drone.md +++ b/docs_source/documentation/core/abstractions/base_drone.md @@ -13,7 +13,7 @@ ```{eval-rst} .. property:: PyFlyt.core.abstractions.DroneClass.np_random - **dtype** - `np.random.RandomState` + **dtype** - `np.random.Generator` .. property:: PyFlyt.core.abstractions.DroneClass.physics_period diff --git a/docs_source/documentation/core/wind.md b/docs_source/documentation/core/wind.md index bda3e19b..ea83037b 100644 --- a/docs_source/documentation/core/wind.md +++ b/docs_source/documentation/core/wind.md @@ -39,7 +39,7 @@ To define custom wind models, refer the the example provided by the `WindFieldCl ```{eval-rst} .. property:: PyFlyt.core.abstractions.WindFieldClass.np_random - **dtype** - `np.random.RandomState` + **dtype** - `np.random.Generator` ``` ### Required Methods diff --git a/examples/core/04_camera.py b/examples/core/04_camera.py index 60740a97..56d79093 100644 --- a/examples/core/04_camera.py +++ b/examples/core/04_camera.py @@ -17,7 +17,7 @@ drone_type="quadx", drone_options=dict( use_camera=True, - camera_angle=30, + camera_angle_degrees=30, camera_FOV_degrees=110, camera_fps=30, # by default, camera_fps=control_hz, @@ -29,7 +29,7 @@ # set to velocity control env.set_mode(6) -# simulate for 1000 steps (1000/120 ~= 8 seconds) +# simulate for 100 steps (100/120 ~= 1 second) for i in range(100): env.step() @@ -38,9 +38,12 @@ DEPTH_img = env.drones[0].depthImg SEG_img = env.drones[0].segImg -plt.imshow(RGBA_img) -# plt.show() -plt.imshow(DEPTH_img) -# plt.show() -plt.imshow(SEG_img) +# show the three images side by side +fig, axes = plt.subplots(1, 3) +for ax, img, title in zip( + axes, [RGBA_img, DEPTH_img, SEG_img], ["RGBA", "Depth", "Segmentation"] +): + ax.imshow(img) + ax.set_title(title) + ax.axis("off") plt.show() diff --git a/examples/core/10_custom_wind.py b/examples/core/10_custom_wind.py index ce2997b9..ec6b1ba4 100644 --- a/examples/core/10_custom_wind.py +++ b/examples/core/10_custom_wind.py @@ -31,7 +31,7 @@ def __call__(self, time: float, position: np.ndarray): """ wind = np.zeros_like(position) wind[:, -1] = np.exp(position[:, -1]) * self.strength - wind += self.np_random.randn(*wind.shape) + wind += self.np_random.standard_normal(wind.shape) return wind