How to use Foxglove WebSocket server to transmit protobuf-encoded data and display a model file in the studio?(python) Thanks
display a model file in the studio?
How to use Foxglove WebSocket server to transmit protobuf-encoded data and display a model file in the studio?(python) Thanks
display a model file in the studio?
You'll need to create a SceneUpdate message that includes a SceneEntity. Include a ModelPrimitive in the scene entity to display a model. (The model's data can be embedded in the ModelPrimitive, or it can come from a URL.)
Here's an example script you can use. It uses the Protobuf generated types from foxglove_schemas_protobuf and the example
Flamingo.glbmodel from three.js.To demonstrate sending embedded data with the model, I loaded the flamingo model using
requests.get, but you could also load it from a file usingwith open(...) as f: model_data = f.read(). If your model is accessible at a public URL, you can simply setmodel.urlinstead ofmodel.data.I included, as an optimization, a FoxgloveServerListener in order to send the model only when a client subscribes to the SceneUpdate channel. This avoids sending a large amount of data on every frame.