Skip to content

Commit 0160f2a

Browse files
committed
--properly initialize magnum vectors for sensor spec pos and orientation.
--Need floating point values for list/np.array initialization.
1 parent 8740a27 commit 0160f2a

12 files changed

Lines changed: 44 additions & 40 deletions

examples/motion_viewer.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import time
99
from typing import Any, Callable, Dict, Optional, Tuple
1010

11-
import numpy as np
12-
1311
flags = sys.getdlopenflags()
1412
sys.setdlopenflags(flags | ctypes.RTLD_GLOBAL)
1513

@@ -121,8 +119,8 @@ def reconfigure_sim(self) -> None:
121119
self.sim_settings["height"],
122120
self.sim_settings["width"],
123121
]
124-
camera_sensor_spec.position = np.array([0, 0, 0])
125-
camera_sensor_spec.orientation = np.array([0, 0, 0])
122+
camera_sensor_spec.position = mn.Vector3([0, 0, 0])
123+
camera_sensor_spec.orientation = mn.Vector3([0, 0, 0])
126124
camera_sensor_spec.uuid = "fpov_sensor"
127125

128126
agent_config = habitat_sim.agent.AgentConfiguration(

examples/tutorials/nb_python/ECCV_2020_Advanced_Features.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ def make_cfg(settings):
474474
settings["sensor_height"] + 0.2,
475475
0.2,
476476
]
477-
color_sensor_3rd_person_spec.orientation = [-math.pi / 4, 0, 0]
477+
color_sensor_3rd_person_spec.orientation = [-math.pi / 4, 0.0, 0.0]
478478
color_sensor_3rd_person_spec.sensor_subtype = habitat_sim.SensorSubType.PINHOLE
479479
sensor_specs.append(color_sensor_3rd_person_spec)
480480

@@ -574,8 +574,8 @@ def init_camera_track_config(sim, sensor_name="color_sensor_1st_person", agent_I
574574
init_state["position"] = np.array(visual_sensor._spec.position)
575575
init_state["orientation"] = np.array(visual_sensor._spec.orientation)
576576
# set the color sensor transform to be the agent transform
577-
visual_sensor._spec.position = np.array([0, 0, 0])
578-
visual_sensor._spec.orientation = np.array([0, 0, 0])
577+
visual_sensor._spec.position = np.array([0.0, 0.0, 0.0])
578+
visual_sensor._spec.orientation = np.array([0.0, 0.0, 0.0])
579579
visual_sensor._sensor_object.set_transformation_from_spec()
580580
# save ID of agent being modified
581581
init_state["agent_ID"] = agent_ID
@@ -848,7 +848,7 @@ def build_widget_ui(obj_attr_mgr, prim_attr_mgr):
848848
sim_settings["scene"] = os.path.join(
849849
data_path, "scene_datasets/mp3d_example/17DRP5sb8fy/17DRP5sb8fy.glb"
850850
)
851-
sim_settings["sensor_pitch"] = 0
851+
sim_settings["sensor_pitch"] = 0.0
852852

853853
make_simulator_from_settings(sim_settings)
854854

@@ -870,8 +870,8 @@ def build_widget_ui(obj_attr_mgr, prim_attr_mgr):
870870
initial_sensor_position = np.array(visual_sensor._spec.position)
871871
initial_sensor_orientation = np.array(visual_sensor._spec.orientation)
872872
# set the color sensor transform to be the agent transform
873-
visual_sensor._spec.position = np.array([0, 0, 0])
874-
visual_sensor._spec.orientation = np.array([0, 0, 0])
873+
visual_sensor._spec.position = np.array([0.0, 0.0, 0.0])
874+
visual_sensor._spec.orientation = np.array([0.0, 0.0, 0.0])
875875
visual_sensor._sensor_object.set_transformation_from_spec()
876876

877877
# boost the agent off the floor
@@ -1006,7 +1006,7 @@ def get_2d_point(sim, sensor_name, point_3d):
10061006
sim_settings["scene"] = os.path.join(
10071007
data_path, "scene_datasets/mp3d_example/17DRP5sb8fy/17DRP5sb8fy.glb"
10081008
)
1009-
sim_settings["sensor_pitch"] = 0
1009+
sim_settings["sensor_pitch"] = 0.0
10101010
sim_settings["semantic_sensor_1st_person"] = True
10111011

10121012
make_simulator_from_settings(sim_settings)
@@ -1097,7 +1097,7 @@ def get_2d_point(sim, sensor_name, point_3d):
10971097
sim_settings["scene"] = os.path.join(
10981098
data_path, "scene_datasets/habitat-test-scenes/apartment_1.glb"
10991099
)
1100-
sim_settings["sensor_pitch"] = 0
1100+
sim_settings["sensor_pitch"] = 0.0
11011101

11021102
make_simulator_from_settings(sim_settings)
11031103

examples/tutorials/nb_python/ECCV_2020_Interactivity.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def make_cfg(settings):
178178
settings["sensor_height"] + 0.2,
179179
0.2,
180180
]
181-
color_sensor_3rd_person_spec.orientation = [-math.pi / 4, 0, 0]
181+
color_sensor_3rd_person_spec.orientation = [-math.pi / 4, 0.0, 0.0]
182182
color_sensor_3rd_person_spec.sensor_subtype = habitat_sim.SensorSubType.PINHOLE
183183
sensor_specs.append(color_sensor_3rd_person_spec)
184184

@@ -887,7 +887,7 @@ def build_widget_ui(obj_attr_mgr, prim_attr_mgr):
887887
sim_settings["scene"] = os.path.join(
888888
data_path, "scene_datasets/habitat-test-scenes/apartment_1.glb"
889889
)
890-
sim_settings["sensor_pitch"] = 0
890+
sim_settings["sensor_pitch"] = 0.0
891891

892892
make_simulator_from_settings(sim_settings)
893893

@@ -1180,7 +1180,7 @@ def release(self):
11801180
# fmt: off
11811181
sim_settings["scene"] = os.path.join(data_path, "scene_datasets/mp3d_example/17DRP5sb8fy/17DRP5sb8fy.glb") # @param{type:"string"}
11821182
# fmt: on
1183-
sim_settings["sensor_pitch"] = 0
1183+
sim_settings["sensor_pitch"] = 0.0
11841184
sim_settings["sensor_height"] = 0.6
11851185
sim_settings["color_sensor_3rd_person"] = True
11861186
sim_settings["depth_sensor_1st_person"] = True

examples/tutorials/nb_python/ReplicaCAD_quickstart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def make_default_settings():
136136
"scene": "NONE", # Scene path
137137
"default_agent": 0,
138138
"sensor_height": 1.5, # Height of sensors in meters
139-
"sensor_pitch": 0, # sensor pitch (x rotation in rads)
139+
"sensor_pitch": 0.0, # sensor pitch (x rotation in rads)
140140
"seed": 1,
141141
"enable_physics": True, # enable dynamics simulation
142142
}

examples/tutorials/nb_python/asset_viewer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def make_cfg(settings):
176176
settings["sensor_height"] + 0.2,
177177
0.2,
178178
]
179-
color_sensor_3rd_person_spec.orientation = [-math.pi / 4, 0, 0]
179+
color_sensor_3rd_person_spec.orientation = [-math.pi / 4, 0.0, 0.0]
180180
color_sensor_3rd_person_spec.sensor_subtype = habitat_sim.SensorSubType.PINHOLE
181181
sensor_specs.append(color_sensor_3rd_person_spec)
182182

@@ -720,7 +720,7 @@ def build_widget_ui(obj_attr_mgr, prim_attr_mgr):
720720

721721
sim_settings = make_default_settings()
722722
sim_settings["scene"] = "none"
723-
sim_settings["sensor_pitch"] = 0
723+
sim_settings["sensor_pitch"] = 0.0
724724
sim_settings["override_scene_light_defaults"] = True
725725
sim_settings["scene_light_setup"] = ""
726726

examples/tutorials/nb_python/managed_rigid_object_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def make_configuration():
8181
rgba_camera_3rdperson_spec.sensor_type = habitat_sim.SensorType.COLOR
8282
rgba_camera_3rdperson_spec.resolution = camera_resolution
8383
rgba_camera_3rdperson_spec.position = [0.0, 1.0, 0.3]
84-
rgba_camera_3rdperson_spec.orientation = [-45, 0.0, 0.0]
84+
rgba_camera_3rdperson_spec.orientation = [-45.0, 0.0, 0.0]
8585
rgba_camera_3rdperson_spec.sensor_subtype = habitat_sim.SensorSubType.PINHOLE
8686
sensor_specs.append(rgba_camera_3rdperson_spec)
8787

examples/tutorials/notebooks/ECCV_2020_Advanced_Features.ipynb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@
473473
" settings[\"sensor_height\"] + 0.2,\n",
474474
" 0.2,\n",
475475
" ]\n",
476-
" color_sensor_3rd_person_spec.orientation = [-math.pi / 4, 0, 0]\n",
476+
" color_sensor_3rd_person_spec.orientation = [-math.pi / 4, 0.0, 0.0]\n",
477477
" color_sensor_3rd_person_spec.sensor_subtype = habitat_sim.SensorSubType.PINHOLE\n",
478478
" sensor_specs.append(color_sensor_3rd_person_spec)\n",
479479
"\n",
@@ -580,8 +580,8 @@
580580
" init_state[\"position\"] = np.array(visual_sensor._spec.position)\n",
581581
" init_state[\"orientation\"] = np.array(visual_sensor._spec.orientation)\n",
582582
" # set the color sensor transform to be the agent transform\n",
583-
" visual_sensor._spec.position = np.array([0, 0, 0])\n",
584-
" visual_sensor._spec.orientation = np.array([0, 0, 0])\n",
583+
" visual_sensor._spec.position = np.array([0.0, 0.0, 0.0])\n",
584+
" visual_sensor._spec.orientation = np.array([0.0, 0.0, 0.0])\n",
585585
" visual_sensor._sensor_object.set_transformation_from_spec()\n",
586586
" # save ID of agent being modified\n",
587587
" init_state[\"agent_ID\"] = agent_ID\n",
@@ -875,7 +875,7 @@
875875
"sim_settings[\"scene\"] = os.path.join(\n",
876876
" data_path, \"scene_datasets/mp3d_example/17DRP5sb8fy/17DRP5sb8fy.glb\"\n",
877877
")\n",
878-
"sim_settings[\"sensor_pitch\"] = 0\n",
878+
"sim_settings[\"sensor_pitch\"] = 0.0\n",
879879
"\n",
880880
"make_simulator_from_settings(sim_settings)"
881881
]
@@ -915,8 +915,8 @@
915915
"initial_sensor_position = np.array(visual_sensor._spec.position)\n",
916916
"initial_sensor_orientation = np.array(visual_sensor._spec.orientation)\n",
917917
"# set the color sensor transform to be the agent transform\n",
918-
"visual_sensor._spec.position = np.array([0, 0, 0])\n",
919-
"visual_sensor._spec.orientation = np.array([0, 0, 0])\n",
918+
"visual_sensor._spec.position = np.array([0.0, 0.0, 0.0])\n",
919+
"visual_sensor._spec.orientation = np.array([0.0, 0.0, 0.0])\n",
920920
"visual_sensor._sensor_object.set_transformation_from_spec()\n",
921921
"\n",
922922
"# boost the agent off the floor\n",
@@ -1070,7 +1070,7 @@
10701070
"sim_settings[\"scene\"] = os.path.join(\n",
10711071
" data_path, \"scene_datasets/mp3d_example/17DRP5sb8fy/17DRP5sb8fy.glb\"\n",
10721072
")\n",
1073-
"sim_settings[\"sensor_pitch\"] = 0\n",
1073+
"sim_settings[\"sensor_pitch\"] = 0.0\n",
10741074
"sim_settings[\"semantic_sensor_1st_person\"] = True\n",
10751075
"\n",
10761076
"make_simulator_from_settings(sim_settings)\n",
@@ -1175,7 +1175,7 @@
11751175
"sim_settings[\"scene\"] = os.path.join(\n",
11761176
" data_path, \"scene_datasets/habitat-test-scenes/apartment_1.glb\"\n",
11771177
")\n",
1178-
"sim_settings[\"sensor_pitch\"] = 0\n",
1178+
"sim_settings[\"sensor_pitch\"] = 0.0\n",
11791179
"\n",
11801180
"make_simulator_from_settings(sim_settings)\n",
11811181
"\n",

examples/tutorials/notebooks/ECCV_2020_Interactivity.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
" settings[\"sensor_height\"] + 0.2,\n",
171171
" 0.2,\n",
172172
" ]\n",
173-
" color_sensor_3rd_person_spec.orientation = [-math.pi / 4, 0, 0]\n",
173+
" color_sensor_3rd_person_spec.orientation = [-math.pi / 4, 0.0, 0.0]\n",
174174
" color_sensor_3rd_person_spec.sensor_subtype = habitat_sim.SensorSubType.PINHOLE\n",
175175
" sensor_specs.append(color_sensor_3rd_person_spec)\n",
176176
"\n",
@@ -973,7 +973,7 @@
973973
"sim_settings[\"scene\"] = os.path.join(\n",
974974
" data_path, \"scene_datasets/habitat-test-scenes/apartment_1.glb\"\n",
975975
")\n",
976-
"sim_settings[\"sensor_pitch\"] = 0\n",
976+
"sim_settings[\"sensor_pitch\"] = 0.0\n",
977977
"\n",
978978
"make_simulator_from_settings(sim_settings)"
979979
]
@@ -1304,7 +1304,7 @@
13041304
"# fmt: off\n",
13051305
"sim_settings[\"scene\"] = os.path.join(data_path, \"scene_datasets/mp3d_example/17DRP5sb8fy/17DRP5sb8fy.glb\") # @param{type:\"string\"}\n",
13061306
"# fmt: on\n",
1307-
"sim_settings[\"sensor_pitch\"] = 0\n",
1307+
"sim_settings[\"sensor_pitch\"] = 0.0\n",
13081308
"sim_settings[\"sensor_height\"] = 0.6\n",
13091309
"sim_settings[\"color_sensor_3rd_person\"] = True\n",
13101310
"sim_settings[\"depth_sensor_1st_person\"] = True\n",

examples/tutorials/notebooks/ReplicaCAD_quickstart.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
" \"scene\": \"NONE\", # Scene path\n",
128128
" \"default_agent\": 0,\n",
129129
" \"sensor_height\": 1.5, # Height of sensors in meters\n",
130-
" \"sensor_pitch\": 0, # sensor pitch (x rotation in rads)\n",
130+
" \"sensor_pitch\": 0.0, # sensor pitch (x rotation in rads)\n",
131131
" \"seed\": 1,\n",
132132
" \"enable_physics\": True, # enable dynamics simulation\n",
133133
" }\n",

examples/tutorials/notebooks/asset_viewer.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
" settings[\"sensor_height\"] + 0.2,\n",
168168
" 0.2,\n",
169169
" ]\n",
170-
" color_sensor_3rd_person_spec.orientation = [-math.pi / 4, 0, 0]\n",
170+
" color_sensor_3rd_person_spec.orientation = [-math.pi / 4, 0.0, 0.0]\n",
171171
" color_sensor_3rd_person_spec.sensor_subtype = habitat_sim.SensorSubType.PINHOLE\n",
172172
" sensor_specs.append(color_sensor_3rd_person_spec)\n",
173173
"\n",
@@ -733,7 +733,7 @@
733733
"\n",
734734
"sim_settings = make_default_settings()\n",
735735
"sim_settings[\"scene\"] = \"none\"\n",
736-
"sim_settings[\"sensor_pitch\"] = 0\n",
736+
"sim_settings[\"sensor_pitch\"] = 0.0\n",
737737
"sim_settings[\"override_scene_light_defaults\"] = True\n",
738738
"sim_settings[\"scene_light_setup\"] = \"\"\n",
739739
"\n",

0 commit comments

Comments
 (0)