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

Headless mode option #8

Open
wangce94 opened this issue Nov 28, 2023 · 6 comments
Open

Headless mode option #8

wangce94 opened this issue Nov 28, 2023 · 6 comments

Comments

@wangce94
Copy link

I am trying to run fluidlab on a remote pc. As such, I am trying to save the frames generated using the save variable in fluidlab.optimizer.recorder.py. However, I am running into an issue regarding the display:

(fluidlab) cewang@blackcoffee:~/FluidLab_SLURM$ python fluidlab/run.py --cfg_file configs/exp_latteart.yaml --record --renderer_type GL
[Taichi] version 1.1.0, llvm 10.0.0, commit f5bb6464, linux, python 3.7.13
[Taichi] Starting on arch=cuda
===>  TaichiEnv created.
===>    60000 particles of     milk  nowhere added.
===>    55480 particles of   coffee cylinder added.
===>  LatteArtEnv built successfully.
qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/cewang/miniconda3/envs/fluidlab/lib/python3.7/site-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb.

Aborted (core dumped)

I am wondering if there is a headless mode where I can bypass the cv2.imshow, or will I have to implement it myself. Thank you!

@zhouxian
Copy link
Owner

@wangce94
Copy link
Author

I'm not quite sure if I understand what you mean. Do you mean that I should edit the render_frame() function in gl_renderer.py to disable imshow?

@zhouxian
Copy link
Owner

When calling render_frame(), you can specify the render mode: either 'human' or 'rgb_array'. The latter will simply return a rendered image array without showing a window.

For details, see:

@zhouxian
Copy link
Owner

BTW, I am not sure what your exact need is and your timeline, but in case your need for fluid simulation is not urgent, this repo(https://github.com/Genesis-Embodied-AI/Genesis) might be of interest to you. It's a superset of FluidLab with a lot more features, and way easier to use. We expect to release it in 2~3 months.

@wangce94
Copy link
Author

I took a look at the code, and under 'rgb_array', there is still imshow under mode == 'rgb_array':

        if mode == 'human':
            cv2.imshow('FluidLab', img[..., ::-1])
            cv2.setWindowTitle('FluidLab', f'FluidLab [FPS: {self.fps:.2f}]')
            cv2.waitKey(1)
            return None

        elif mode == 'rgb_array':
            cv2.imshow('FluidLab', img[..., ::-1])
            cv2.setWindowTitle('FluidLab', f'FluidLab [FPS: {self.fps:.2f}]')
            cv2.waitKey(1)
            return img

@zhouxian
Copy link
Owner

I see. I don't remember exactly why it's there, but i think you can comment out those code. The image is generated here:

img = flex_renderer.render()

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