I am trying to use streamlit with ROS where I get PointCloud2 messages which I can convert to numpy arrays - Nx4
I want to be able to display these in real-time - something like in RVIZ in ROS.
How may I do that?
Basically, I would like to plot the 3D points, be able to zoom, pan, rotate and also update the points every frame.
Please advise.
Steps to reproduce
Code snippet:
add code here
If applicable, please provide the steps we should take to reproduce the error or specified behavior.
Expected behavior:
Explain what you expect to happen when you run the code above.
Actual behavior:
Explain the undesired behavior or error you see when you run the code above.
If youāre seeing an error message, share the full contents of the error message here.
Debug info
Streamlit version: (get it with $ streamlit version)
Python version: (get it with $ python --version)
Using Conda? PipEnv? PyEnv? Pex?
OS version:
Browser version:
Requirements file
Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.
Links
Link to your GitHub repo:
Link to your deployed app:
Additional information
If needed, add any other context about the problem here.
Hi,
Thank you for the reply.
Getting data from ros is not the main problem, I already have code for that.
Problem is, plotly scatter_3d or matplotlib 3d produce very bad 3D visualizations.
I use mayavi generally or rviz if withing ros.
So, is it somehow possible to use mayavi or PyVista or something that produces nice 3D point cloud visualizations?
Itās a case of automotive dataset - point clouds are generally 120000x4
Thanks for the link, looks promising. I will check it out.
However, based on my use case, there is another problem - how do I make certain widgets update automatically at intervals?
The idea is - click and button (draw point clouds) and then the Pyvista widget should update with new point clouds from the ROS backend.
I know we can use a for loop or call the st.experimental_rerun(), but I just donāt feel this is a very nice way to update just 1 widget. This will basically re-run the entire script.
I am aware of this. I have a somewhat similar way of refreshing. But I am looking for something more robust and proper.
Nevertheless, thanks a lot. I will try out the 3D point cloud plot and update in a day or two.
But - you have created a great framework, I really like it and would love to see it grow and be more stable for multiple use cases.
I am fairly new to streamlit and learning it while working on my case. Some nice things I imagine (may be already present):
Download button that opens up a certain public directory allowing user to select file to download
A modal dialog that allows for user input - usable for password authentication when logging into the app
Upload button that allows user to select where to upload a file to on server - easier workflow with binary and image files etc.
Coordinate based layout system for better usage of screen space - user getās to select
More stability in multi-page apps - I encountered st.session_state loses parameters when page is changed in multi-page apps unless we do a st.update_session(st.session_state).
To your point 5, you may be interested in the discussion about changing keyed widget behavior. Session state ālosingā parameters is tied to the widget cleanup process and Iām guessing thatās what you came across. Namely, when a widget is not rendered on the screen, itās data gets deleted (including its value in session state). This is entirely expected, and you mentioned a solution that āinterruptsā the cleanup process thereby keeping the keys. (My usual preferred solution is to treat all data assigned to widget keys as transient and have separate keys for keeping data between pages. This also keeps the solution on the page with the affected key and doesnāt require a copy-paste script at the top of every page in the app. )