-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
30 lines (24 loc) · 905 Bytes
/
test.py
File metadata and controls
30 lines (24 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import numpy as np
import airsim
def get_image(client):
responses = client.simGetImages([airsim.ImageRequest("camera_0", airsim.ImageType.DepthPerspective, True, False)], vehicle_name="Drone_0")
response = responses[0]
# Reshape to a 2d array with correct width and height
depth_img_in_meters = airsim.list_to_2d_float_array(response.image_data_float, response.width, response.height)
return depth_img_in_meters
def run():
client = airsim.MultirotorClient()
client.confirmConnection()
client.enableApiControl(True, "Drone_0")
client.armDisarm(True, "Drone_0")
while True:
img_GT = get_image(client)
size = img_GT.shape
noise = np.random.normal(scale=0,size=size)
img_noise = img_GT + noise
pass
if __name__ == '__main__':
try:
run()
except KeyboardInterrupt:
pass