foxglove / community

This repo hosts our org-wide discussion board
0 stars 0 forks source link

Issue with hide/unhide on pointcloud topics #958

Closed harveybia closed 7 months ago

harveybia commented 7 months ago

Description There might be a bug with visibility toggle for point clouds. When I hide and unhide the topic, the points no longer show up. This is different behavior than SceneUpdate where toggling visible / invisible works fine without needing to republish the topic.

What is interesting is that if you keep the topic view open for the point cloud topic, this behavior gets fixed. Possible lifecycle management issue? I attached a video of this behavior as well.

Steps To Reproduce We have our own visualization wrapper so the code is not for foxglove API directly. However, here's the point cloud I constructed:

    SegmentedCloudTypeT::Ptr seg(new SegmentedCloudTypeT);
    SegmentedPointT p1;
    p1.x = 0;
    p1.y = 0;
    p1.z = 0;
    p1.r = 255;
    p1.g = 0;
    p1.b = 0;
    seg->push_back(p1);

    SegmentedPointT p2;
    p2.x = 1;
    p2.y = 0;
    p2.z = 0;
    p2.r = 0;
    p2.g = 255;
    p2.b = 0;
    seg->push_back(p2);
    vis::show(seg, "cloud", "root");

https://github.com/foxglove/studio/assets/8027401/347951fc-0765-452f-903d-ee58311d366a https://github.com/foxglove/studio/assets/8027401/7053d281-537c-4c16-841d-6f9f9d07ee18

This is how we send the point cloud over websocket:

    async def send_cloud(channel_name, frame_id):
        try:
            body = request.get_data()
            cloud = PointCloud()
            cloud.frame_id = frame_id
            cloud.point_stride = 16
            for idx, name in enumerate(['x', 'y', 'z']):
                f = cloud.fields.add()
                f.name = name
                f.offset = idx * 4
                f.type = 7
            for idx, name in enumerate(['red', 'green', 'blue', 'alpha']):
                f = cloud.fields.add()
                f.name = name
                f.offset = idx + 12
                f.type = 1

            cloud.data = body
            channel_id = await channel_manager.get_channel_id(PointCloud, channel_name)
            await server.send_message(channel_id, time.time_ns(), cloud.SerializeToString())
            return "OK"
        except Exception as e:
            print("Exception:", str(e))
            return "Error", 500

...

async def main():
    async with FoxgloveServer("0.0.0.0", 8765, "example server") as server:
        await server.wait_opened()
        print("started server")

        app = await create_app(server)
        print("created app")
        await run_flask(app)

Expected Behavior Point cloud should show up after toggling visibility.

linear[bot] commented 7 months ago

FG-6819 Issue with hide/unhide on pointcloud topics