Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vizard unable to load my spacecraft OBJ models (since 2.1.6 or 2.1.6.1) #861

Closed
GorgiAstro opened this issue Nov 26, 2024 · 2 comments
Closed

Comments

@GorgiAstro
Copy link

Describe the bug
Vizard is stuck to "Loading custom model from .obj with OBJ importer", does not show my OBJ model and does not allow starting the simulation.

To reproduce
Here's a stripped-down version of my code:

viz = vizSupport.enableUnityVisualization(scSim,
        dyn_task_name,
        scObject,
        saveFile=f'{scenario_name}.bin',
        liveStream=False,
    )

viz.epochInMsg.subscribeTo(epochMsg)

threed_model: str = self.spacecraft_config['3d-model']
model_path = (Path(self.scripts_folder) / '3d-models' / threed_model).resolve()
simBodiesToModify=[self.spacecraft_config["name"]]
print(model_path, simBodiesToModify)

vizSupport.createCustomModel(viz,
                             modelPath=str(model_path),
                             simBodiesToModify=simBodiesToModify,
                             )

This will print /home/yzokras/git/tbx20bsk/tbx20bsk/res/3d-models/queen_bsk.obj ['QUEEN'], which allowed me to verify that the path to the OBJ file is correct, and that the simBodiesToModify name matches the spacecraft name.

Steps to reproduce the behavior:

  1. Add module '...'
  2. Simulate with the configuration '....'
  3. See error

Expected behavior
Vizard displays the following message in the top right of the window: "Loading custom model from .obj with OBJ importer". Vizard does not show my OBJ model (and instead the default BSK Sat) and does not allow starting the simulation (the last part being expected according to the Vizard 2.1.6 release notes).

Whereas in Vizard 2.1.5 it worked as expected, the model was loaded nearly instantly.

Desktop (please complete the following information):

  • OS: Ubuntu
  • Version 24.04
  • Python version 3.11
  • Basilisk version 2.5.0 (but also seems to be the case with 2.2.0)
  • Vizard version 2.1.6.1 and 2.2.0

Additional context
When loading the OBJ model and adding it to my spacecraft via "View>Model Inventory", the model is properly loaded (nearly instantaneously). However, it is still not possible to start the simulation because Vizard still tries "Loading custom model from .obj with OBJ importer".

** Files to reproduce the issue**
Here are the .obj and the viz .bin files, although it's not super useful as the path to the .obj file is absolute.
viz_obj_issue.zip

Side notes
One more question barely related to this issue: it looks like Vizard expects an absolute path to the OBJ model. I tried with a relative path too but Vizard didn't find the model (either in 2.1.5, 2.1.6.1 and 2.2.0). Is it possible to have Vizard load OBJ from relative paths as well? Where the path would be relative to the viz .bin file.

@woodj80
Copy link

woodj80 commented Nov 26, 2024

Thank you for the test files, that really helped! I tracked the bug down to a raycast call to check if the sun was in the frame that failed because Vizard was in the process of loading the obj model. The fix will be in the Vizard 2.3.0 release.

We'll add the relative path as a feature request on our list, thank you for the idea.

@woodj80 woodj80 closed this as completed Nov 26, 2024
@GorgiAstro
Copy link
Author

Great, thank you so much for the swift fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants