[Sensor] Fix hab-lab examples to work with Hierarchical SensorSpec changes#598
Conversation
| sensor_specifications = [] | ||
| for sensor in _sensor_suite.sensors.values(): | ||
| sim_sensor_cfg = habitat_sim.SensorSpec() | ||
| sim_sensor_cfg = habitat_sim.CameraSensorSpec() |
There was a problem hiding this comment.
Hi @Skylion007 ! I noticed that in hab-lab sensors we don't have SensorSubTypes, and was wondering what the reasoning for that was - would it be a good idea to add this enum?
For context, I check that SensorSubTypes are correct before initializing a CameraSensorSpec() here:
https://github.com/facebookresearch/habitat-sim/pull/1090/files#diff-1c82f32ca8e8fe4738a140dd923ac12f5d482300e28446788e41eafa248a62a1R66-R103
There was a problem hiding this comment.
I'm also not sure how BumpSensor is initialized, since this isn't something I was able to find in hab-sim or hab-lab. I know we can't initialize it with CameraSensorSpec as we do the other sensors though. Any insight to this would be appreciated! @Skylion007 @bigbike @mathfac @erikwijmans @abhiskk
There was a problem hiding this comment.
We don't actually have implementations of BumpSensor, I don't believe.
There was a problem hiding this comment.
Yes, we have only CollisionMeasure, but that would be great to have BumpSensor, but it looks like it can be HabitatLab Task sensor, not Simulator one.
|
I started doing that here: #533 |
| sensor_specifications.append(sim_sensor_cfg) | ||
|
|
||
| # Check if type VisualSensorSpec, we know that Sensor is one of HabitatSimRGBSensor, HabitatSimDepthSensor, HabitatSimSemanticSensor | ||
| if ( |
There was a problem hiding this comment.
Not all sensors are VisualSensor in Habitat.
There was a problem hiding this comment.
Not all sensors are VisualSensors but VisualSensorSpecs are the only kinds of specs that can be initialized at the moment.
Skylion007
left a comment
There was a problem hiding this comment.
This is fine as a cludge, but there are some issues with support multiple sensor types n the future. Also, some issues with the current error handling / indentation
| @registry.register_sensor | ||
| class HabitatSimSemanticSensor(SemanticSensor): | ||
| sim_sensor_type: habitat_sim.SensorType | ||
| sim_sensor_subtype: habitat_sim.SensorSubType |
There was a problem hiding this comment.
I suppose, we could tie the SensorSubtype to the Sensor Class like this, but I was thinking about having it be a SensorConfig string that determined it (similar to how we do for UUIDs now). Any reason why not do it that way? It would give the user more flexability down the road (unless you expect SensorSubtypes to have entirely different config types).
Doing it like this though causes a quadratic explosion in the number of Sensor modalities -> sensor_subtypes though.
In other words, is there a good reason this cannot/should not be read from the config?
This is all fine for now since we only support PINHOLE, but will be annoying later when we supports RGBFisheye/DepthFisheye etc...
There was a problem hiding this comment.
Hi Aaron! I did this because this file goes through some defined configs and initializes the right sensorSpec.
So far, only CameraSensorSpec exists, but I'm adding the structure for checks so that when Fisheye/Equirectangular sensors are implemented, we can follow the logic to initialize the right sensorSpec.
There was a problem hiding this comment.
Does Subtype infer how observation space will be defined? Does different Subtypes of sensors require separate classes wrappers in HabLab?
There was a problem hiding this comment.
Hi @mathfac , I think I don't understand enough about how observation space is defined in hablab vs habsim. What is the difference there and what should I be aware of?
There was a problem hiding this comment.
Exactly, I don't think they should require separate wrappers, they should be set by the config.
| ) | ||
|
|
||
| sensor_specifications = [] | ||
| VisualSensorTypeSet = { |
There was a problem hiding this comment.
We can programatically get the values from a enum by iterating through them with .value()
Also wouldn't this be better defined by some inheritance structure?
There was a problem hiding this comment.
Are you saying that instead of checking if it's in a set we should get the value it and compare it with the enum numbers? This is just a way to check which type of SensorSpec to initialize based on the values in the config.
|
Looking forward for this change. |
|
Want to let @erikwijmans to take a look at this before merging. Otherwise, looks good to me. We may want to add an error to upgrade habitat_sim though. |
erikwijmans
left a comment
There was a problem hiding this comment.
This looks fine to me!
* --Rework PhysicsManager instantiation; PhysicsManagerAttributes has had often-used getter/setters added in the manner of PhysicsObjectAttributes; PhysicsManagers are now passed their defining attributes upon construction; ResourceManager now has separate method to create PhysicsManagers; * --Groundwork for instancing primitive objects; Have rigid body's retain copy of Attributes object at the time of their creation. * Update src/utils/viewer/viewer.cpp Co-Authored-By: Vladimír Vondruš <mosra@centrum.cz> * Update viewer.cpp * --Undo incorrect spelling changes. Should actually be "reseat" when discussing a pointer. * --Address review suggestion * --Minor fixes and updates * --Primitive physical object code; Set up primitive-type specific attributes to organize prim-required constructor info as specified in Magnum implementations; Build enum to describe supported primitives; * --add default constructors to attributes * --Attempt to get bindings to work with intermediate Attributes class; * --more groundwork for instancing primitive objects * -- stub message * --Propagate fix to address double rotation; * --Address reviewer comments * --Modify Primitive Attributes to inherit directly from configuration; * --Address further reviewer comments; Co-authored-by: Vladimír Vondruš <mosra@centrum.cz>
…nsor-spec [Sensor] Fix hab-lab examples to work with Hierarchical SensorSpec changes
…nsor-spec [Sensor] Fix hab-lab examples to work with Hierarchical SensorSpec changes
Motivation and Context
See: facebookresearch/habitat-sim#1090
PR#1090 in habitat-sim introduces a Hierarchical SensorSpec to match the new sensor framework for VisualSensor.
SensorSpec::create()is no longer used, use correct SensorSpec initialization to create correct sensor, such asCameraSensorSpec::create().This PR fixes examples to use CameraSensorSpec() to initialize sensorSpecs
How Has This Been Tested
Built and tested locally with version of hab-sim in PR#1090, checked that tests passed
Types of changes
Checklist