Description
Habitat-Sim version
v0.3.3
Problem
For my current project, I generate randomized data via habitat-sim. One of the parameters I want to randomize is camera FOV.
For this, I was trying to update the camera's FOV on-the-go (without constructing a new sim object). I was hoping to make use of agent.reconfigure
, docs with the original agent spec but updated FOV.
However, when rendering new images, the updated FOV is not reflected, the rendered images have the old FOV. When inspecting Simulator._Simulator__sensors[agent_id].items()
and the _sensor_object.fov
attribute of the sensors found there, I can see that those still have the old FOV.
Does this mean that the sensorsuite somehow does not receive the updated sensor specs? If so, what can I do?
Of course I could just overwrite the _sensor_object.fov
value, and that gives the expected result but this seems messy and leads to mismatch between agent spec and actual sensor FOV.
EDIT:
Figured the issue is that this line will not actually create the sensor if it already exists (with that uuid?).
My current workaround is this:
for _, sensor in sim._Simulator__sensors[agent_id].items():
habitat_sim.SensorFactory.delete_sensor(sensor._sensor_object)
before reconfiguring the agent, and then:
agent_config = sim.get_agent(agent_id).agent_config
for i, sensor in enumerate(agent_config.sensor_specifications):
if isinstance(sensor, habitat_sim.sensor.CameraSensorSpec):
sensor.hfov = fov
sensor.fov = fov
sim.get_agent(agent_id).reconfigure(agent_config, reconfigure_sensors=True)
sim._update_simulator_sensors(sensor.uuid, agent_id)
Is this how it's supposed to be done?