Skip to content

Commit f5efe57

Browse files
authored
Merge pull request #17 from ScaledFoundations/thermal_image
add thermal image capture example notebook
2 parents c92ff9b + f9b9ca3 commit f5efe57

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed

airgen-samples/notebook.ipynb

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "3a638623",
7+
"metadata": {},
8+
"outputs": [
9+
{
10+
"name": "stdout",
11+
"output_type": "stream",
12+
"text": [
13+
"Connected!\n",
14+
"Client Ver:1 (Min Req: 1), Server Ver:1 (Min Req: 1)\n",
15+
"\n"
16+
]
17+
}
18+
],
19+
"source": [
20+
"from grid.robot.airgen_drone import AirGenDrone\n",
21+
"airgen_drone_0 = AirGenDrone()"
22+
]
23+
},
24+
{
25+
"cell_type": "code",
26+
"execution_count": null,
27+
"id": "de35f3bc",
28+
"metadata": {},
29+
"outputs": [],
30+
"source": [
31+
"airgen_drone_0.client.takeoffAsync().join()\n",
32+
"airgen_drone_0.client.moveToZAsync(-25, 2).join()\n",
33+
"airgen_drone_0.client.rotateToYawAsync(-90).join()"
34+
]
35+
},
36+
{
37+
"cell_type": "code",
38+
"execution_count": null,
39+
"id": "0baa40c4",
40+
"metadata": {},
41+
"outputs": [],
42+
"source": [
43+
"# Let's capture and display an infrared image\n",
44+
"import airgen\n",
45+
"import rerun as rr\n",
46+
"\n",
47+
"ir_image, camera_pose = airgen_drone_0.client.getImages(\"front_center\", [airgen.ImageType.Infrared])[0]\n",
48+
"\n",
49+
"rr.log(\"infrared\", rr.Image(ir_image))\n"
50+
]
51+
},
52+
{
53+
"cell_type": "code",
54+
"execution_count": null,
55+
"id": "f9db538a",
56+
"metadata": {},
57+
"outputs": [
58+
{
59+
"name": "stdout",
60+
"output_type": "stream",
61+
"text": [
62+
"['Fire_Grd_BP_00_0']\n"
63+
]
64+
},
65+
{
66+
"data": {
67+
"text/plain": [
68+
"True"
69+
]
70+
},
71+
"execution_count": 1,
72+
"metadata": {},
73+
"output_type": "execute_result"
74+
}
75+
],
76+
"source": [
77+
"# Let's now make the fire the highest intensity in the infrared camera\n",
78+
"\n",
79+
"# Get a list of all objects in the scene with the name Fire*\n",
80+
"fire_obj_refs = airgen_drone_0.client.simListSceneObjects(\"Fire.*\")\n",
81+
"print(fire_obj_refs)\n",
82+
"\n",
83+
"fire_obj = fire_obj_refs[0]\n",
84+
"\n",
85+
"airgen_drone_0.client.simSetSegmentationObjectID(fire_obj, 255, True)\n"
86+
]
87+
},
88+
{
89+
"cell_type": "code",
90+
"execution_count": null,
91+
"id": "9049bc5e",
92+
"metadata": {},
93+
"outputs": [],
94+
"source": [
95+
"# Capture and display an infrared image again\n",
96+
"import airgen\n",
97+
"import rerun as rr\n",
98+
"\n",
99+
"ir_image, camera_pose = airgen_drone_0.client.getImages(\"front_center\", [airgen.ImageType.Infrared])[0]\n",
100+
"\n",
101+
"rr.log(\"infrared_new\", rr.Image(ir_image))\n"
102+
]
103+
}
104+
],
105+
"metadata": {
106+
"language_info": {
107+
"name": "python"
108+
}
109+
},
110+
"nbformat": 4,
111+
"nbformat_minor": 5
112+
}

0 commit comments

Comments
 (0)