Skip to content

Commit

Permalink
--[BE] - Miscellaneous minor refactors and cleanup (#2516)
Browse files Browse the repository at this point in the history
* --This needs to assert; means an expected filetype has no support yet
* --properly instantiate light attr mgr test specialization
Have to put specialization in namespace due to  C++03, §14.7.3/2 standard.
* --clean up docstrings
* --must import quaternion library before habitat_sim for audio compile
If not imported here and sim is compiled with audio support, python tests will abort due to the habitat_sim import causing an invalid free() error
* --due to quaternion library dtypes, numpy must be version 1.26.4
* --add quaternion reference to files missing it.
  • Loading branch information
jturner65 authored Dec 17, 2024
1 parent a48e2c0 commit 338fb2f
Show file tree
Hide file tree
Showing 21 changed files with 204 additions and 152 deletions.
2 changes: 1 addition & 1 deletion .github/actions/install_ubuntu_deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ runs:
run: |-
echo "Install conda and dependencies"
conda install -y pytorch==1.12.1 torchvision==0.13.1 -c pytorch -c nvidia
conda install -y -c conda-forge ninja numpy pytest pytest-cov ccache hypothesis pytest-mock
conda install -y -c conda-forge ninja numpy=1.26.4 pytest pytest-cov ccache hypothesis pytest-mock
pip install pytest-sugar pytest-xdist pytest-benchmark opencv-python cython mock
shell: bash -el {0}
- name: Validate Pytorch Installation
Expand Down
5 changes: 5 additions & 0 deletions examples/tutorials/async_rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
back to the main thread by calling sim.get_sensor_observations_async_finish() by default.
"""


# Need to import quaternion library here despite it not being used or else importing
# habitat_sim below will cause an invalid free() when audio is enabled in sim compilation
import quaternion # noqa: F401

import habitat_sim


Expand Down
4 changes: 4 additions & 0 deletions examples/tutorials/stereo_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

import numpy as np

# Need to import quaternion library here despite it not being used or else importing
# habitat_sim below will cause an invalid free() when audio is enabled in sim compilation
import quaternion # noqa: F401

import habitat_sim

cv2 = None
Expand Down
18 changes: 11 additions & 7 deletions src/esp/core/managedContainers/ManagedFileBasedContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class ManagedFileBasedContainer : public ManagedContainer<T, Access> {
} // ManagedFileBasedContainer::createObjectFromJSONString

/**
* @brief Method to load a Managed Object's data from a file. If the file
* @brief Method to load a Managed Object's data from a file. If the file
* type is not supported by specialization of this method, this method
* executes and an error is thrown.
* @tparam type of document to load.
Expand All @@ -131,15 +131,19 @@ class ManagedFileBasedContainer : public ManagedContainer<T, Access> {
template <typename U>
ManagedFileIOPtr buildManagedObjectFromDoc(const std::string& filename,
CORRADE_UNUSED const U& config) {
ESP_ERROR(Mn::Debug::Flag::NoSpace)
<< "<" << this->objectType_
<< "> : Failure loading attributes from document `" << filename
<< "` of unknown type `" << typeid(U).name()
<< "` so unable to build object.";
CORRADE_ASSERT(false,
Cr::Utility::formatString(
"<{}> : Failure loading attributes from document `{}` "
"of unsupported file type `{}` so unable to build "
"object. Make sure a specialization of "
"ManagedFileBasedContainer::buildManagedObjectFromDoc() "
"supporting this file type has been implemented.",
this->objectType_, filename, typeid(U).name()),
nullptr);
} // ManagedFileBasedContainer::buildManagedObjectFromDoc

/**
* @brief Method to load a Managed Object's data from a file. This is the
* @brief Method to load a Managed Object's data from a file. This is the
* JSON specialization, using type inference.
* @param filename name of file document to load from
* @param config JSON document to read for data
Expand Down
2 changes: 0 additions & 2 deletions src/esp/physics/objectWrappers/ManagedArticulatedObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,6 @@ class ManagedArticulatedObject
/**
* @brief Retrieve a comma-separated string holding the header values for the
* info returned for this managed object, type-specific.
* TODO : once Magnum supports retrieving key-values of configurations, use
* that to build this data.
*/

std::string getPhyObjInfoHeaderInternal() const override {
Expand Down
2 changes: 0 additions & 2 deletions src/esp/physics/objectWrappers/ManagedPhysicsObjectBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,6 @@ class AbstractManagedPhysicsObject
/**
* @brief Retrieve a comma-separated string holding the header values for
* the info returned for this managed object, type-specific.
* TODO : once Magnum supports retrieving key-values of configurations, use
* that to build this data.
*/

virtual std::string getPhyObjInfoHeaderInternal() const = 0;
Expand Down
4 changes: 0 additions & 4 deletions src/esp/physics/objectWrappers/ManagedRigidBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,6 @@ class AbstractManagedRigidBase
/**
* @brief Retrieve a comma-separated string holding the header values for the
* info returned for this managed object, type-specific.
* TODO : once Magnum supports retrieving key-values of configurations, use
* that to build this data.
*/

std::string getPhyObjInfoHeaderInternal() const override {
Expand All @@ -263,8 +261,6 @@ class AbstractManagedRigidBase
/**
* @brief Retrieve a comma-separated string holding the header values for
* the info returned for this managed object, rigid-base-specific.
* TODO : once Magnum supports retrieving key-values of configurations, use
* that to build this data.
*/
virtual std::string getRigidBaseInfoHeaderInternal() const = 0;
/**
Expand Down
2 changes: 0 additions & 2 deletions src/esp/physics/objectWrappers/ManagedRigidObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ class ManagedRigidObject
/**
* @brief Retrieve a comma-separated string holding the header values for
* the info returned for this managed object, rigid-base-specific.
* TODO : once Magnum supports retrieving key-values of configurations, use
* that to build this data.
*/
std::string getRigidBaseInfoHeaderInternal() const override {
return "Creation Attributes Name";
Expand Down
Loading

0 comments on commit 338fb2f

Please sign in to comment.