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

Missing lidar chunk os1-128-u #240

Open
JonasTietz opened this issue Oct 24, 2023 · 40 comments · May be fixed by #319 or #321
Open

Missing lidar chunk os1-128-u #240

JonasTietz opened this issue Oct 24, 2023 · 40 comments · May be fixed by #319 or #321
Assignees
Labels
bug Something isn't working

Comments

@JonasTietz
Copy link

JonasTietz commented Oct 24, 2023

Describe the bug
We are using a Nvidia Jetson AGX xavier on a Auvidea X221-AI carriert board and we experience some missing pointcloud chunks on many of the pointclouds we receive. The missing chunk is always in the same spot, but sometimes larger and sometimes smaller. This happens on all udp profiles except for the Low Data Rate Profile. On the dual return profile it is more extreme.

We are on commit 6a7693c and had nothing running in the background on a fresh ubuntu 20.04 install. The lidar is connected to a "RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller". Lidar firmware version is v2.5.2

Here is a video of the behavior.

lidar_missing_chunks_small.mp4

To Reproduce
Steps to reproduce the behavior (steps below are just an example):

  1. source ros environment
  2. ouster-ros
  3. source the project workspace
  4. roslaunch ouster_ros driver.launch ...
  5. observe the issue ...

Platform:

  • Ouster Sensor: OS1-128-U
  • Ouster Firmware Version: v2.5.2
  • ROS version: noetic
  • Operating System: Ubuntu 20.04
  • Machine Architecture: arm64
  • git commit: 6a7693c
@JonasTietz JonasTietz added the bug Something isn't working label Oct 24, 2023
@FabianThomsen
Copy link

I have the same issue with an OS1 128 in ROS2 humble/iron (tested both). The higher the resolution, the more the PointCloud in RVIZ2 is "flickering" and missing chunks. The fix from here - increasing the UDP receive buffer size - seemed to work at first, but after a day, the flickering started again, so it seems to have been pure luck.

I can add, that even in the time, the fix seemed to have worked, it only did so while the ouster driver was running in a docker container started with --network host, while in a container with a dedicated ipvlan for the OS1, it did never work. On the other hand, an older version of the driver (version 0.8.3 in the package.xml, for ROS noetic) does work without any missing chunks.

@Samahu Samahu self-assigned this Nov 1, 2023
@shubham-shahh
Copy link

shubham-shahh commented Nov 2, 2023

any update on this issue? I have noticed it on os0 32 channels as well, running latest driver.

@lionator
Copy link

lionator commented Nov 17, 2023

Any Update? I have the same with OS2-128. When i subscribe to it more often it gets even worse. Also it depends on the lidar_mode. Below 1024x10 it works with rviz as a single subscriber. When i want to do a recording with the record.launch file I get chunks missing again.
Screencast from 17.11.2023 10:26:20.webm

CPU Resources are fine too:
image

I hope we get some advice soon.
I use the ROS2 Humble Version. I checkout out the ros2 branch.
In OusterStudio visualizing and recording at the same time works.

@javierAraluce
Copy link

We are encountering the same issue when configuring our OS1-128 with a resolution of 2048x10. It functions properly in OusterStudio, but when utilizing the ROS2 driver, it experiences flickering.
Currently, we are using:

  • ROS2 Humble
  • Ubuntu 22
  • It is running in a Docker container.

Thanks

@Samahu
Copy link
Contributor

Samahu commented Nov 18, 2023

@lionator and @javierAraluce I have just pushed a new release towards ros2 (rolling,humble, iron) which has several fixes and improvements. Could you try the updated version 0.12.0 and let me know whether this fixes the problem you are observing or not? Thanks

@lionator
Copy link

lionator commented Nov 20, 2023

@lionator and @javierAraluce I have just pushed a new release towards ros2 (rolling,humble, iron) which has several fixes and improvements. Could you try the updated version 0.12.0 and let me know whether this fixes the problem you are observing or not? Thanks

I have done it. It works now with 2048x10 with one subscriber, but if 2 or more subscriber are added it stops working. See here:
Screencast from 20.11.2023 11:50:09.webm
It doesn't matter whether i subscribe with another rviz2 window or in the terminal, it does weird things. I never had this before with our previous Ouster OS1.

@FabianThomsen
Copy link

@lionator and @javierAraluce I have just pushed a new release towards ros2 (rolling,humble, iron) which has several fixes and improvements. Could you try the updated version 0.12.0 and let me know whether this fixes the problem you are observing or not? Thanks

I also tried the new release and it doesn't change anything on my machine. I can also confirm that with more subscribers, a larger portion of the pointcloud is missing on average.

@Samahu
Copy link
Contributor

Samahu commented Nov 21, 2023

@lionator and @javierAraluce I have just pushed a new release towards ros2 (rolling,humble, iron) which has several fixes and improvements. Could you try the updated version 0.12.0 and let me know whether this fixes the problem you are observing or not? Thanks

I have done it. It works now with 2048x10 with one subscriber, but if 2 or more subscriber are added it stops working. See here: Screencast from 20.11.2023 11:50:09.webm It doesn't matter whether i subscribe with another rviz2 window or in the terminal, it does weird things. I never had this before with our previous Ouster OS1.

Thanks for the feedback, I don't usually test with multiple subscribers. I will look into the issue.

@lionator
Copy link

If you test it with the record.launch.xml file and rviz visualisation is active you have 2 subscribers and it does not work.

@javierAraluce
Copy link

Hello all,
We have tested the new release with our lidar, and it still suffers from flickering.

@tom-bu
Copy link

tom-bu commented Nov 28, 2023

Does this have to do with the socket buffer size? ros-drivers/ros2_ouster_drivers#89

@Samahu
Copy link
Contributor

Samahu commented Nov 29, 2023

@JonasTietz I tried to reproduce this issue under ROS1 on NVIDIA AGX with a sensor connected to a switch but I couldn't generate the problem with the latest ouster-ros release. Are you able to generate the problem when connected directly to the sensor or maybe try a different network interface? I remember one of our users noted that there were issues with certain network hardware which could be the cause of the problem. I am running a long term test to check for any degradation in the performance.

I was able to re-produce the issue with ROS2 and looking further into it, but since the issue is specific to ROS2 it might be what @tom-bu had mentioned.

@Samahu
Copy link
Contributor

Samahu commented Nov 29, 2023

@JonasTietz I tried to reproduce this issue under ROS1 on NVIDIA AGX with a sensor connected to a switch but I couldn't generate the problem with the latest ouster-ros release. Are you able to generate the problem when connected directly to the sensor or maybe try a different network interface? I remember one of our users noted that there were issues with certain network hardware which could be the cause of the problem. I am running a long term test to check for any degradation in the performance.

I was able to re-produce the issue with ROS2 and looking further into it, but since the issue is specific to ROS2 it might be what @tom-bu had mentioned.

@JonasTietz I ran 12 hours long test on my setup and I didn't observe any degradation in the driver performance using the ROS1 driver. I used 1024x10 lidar mode and the RNG19_RGL8_SIG16_NIR profile and the frame rate was at the expected 10 Hz. I am going to argue that your network setup has to do with the issue for ROS1. Could you please check if you can produce the problem without using the described network switch?

I am still investigating the issue with the ROS2 driver.

@JonasTietz
Copy link
Author

Hella @Samahu ,
our network setup in this case was the OS1-128 connected via the Interface Box directly to a ethernet port on the Jetson AGX.
We configured the lidar to use a fixed IP address. The latest driver update already helped quite a bit. But we still see it sometimes. The issue is still very prominent when also publishing the lidar images.

We also seen this issue when not using the interface box and directly plugging it into ethernet port. But I wanted to make sure that this is not the issue we were seeing.

@Samahu
Copy link
Contributor

Samahu commented Dec 1, 2023

@JonasTietz thanks for the feedback, will keep the ticket open untill we have the issue fully resolved.

@Imaniac230
Copy link

Hi, we have been encountering the same issues using our OS-0-128 ousters (fw: v3.0.1). I've been doing some quick experiments to see what's going on. I haven't found any obvious root cause, but maybe this information will still be somewhat helpful.

Most of my following assumptions are coming from the fact that I have a hacked-up version of the old community driver (with ported functionality for the new firmware) in this fork branch that does not appear to have any of these issues (or they're at least a lot less prevalent). So, while there might be some hardware-related differences that influence this behavior, that would still not explain why there is one software implementation that works and one that has problems, when using the same hardware. It would be good if someone else could also confirm this.

Here, I am always using the single ouster driver node, so the raw packets must be getting processed directly between the connection and processing threads and are not being sent anywhere through the ros interfaces.

First, by counting up the the accumulated packets in ScanBatcher::operator()() calls and printing them out once the accumulation condition is met, it is visible that the final cloud is never actually accumulated from all of the expected packets.

  • with 1024 columns at 16 columns per packet we should expect a full cloud accumulated from 64 packets,
  • with 4096 columns at 16 columns per packet we should expect a full cloud accumulated from 256 packets.

But those counts are never reached, hence we're missing chunks of the cloud. Going further and printing out the individual frame_id and measurement_id numbers being processed in ScanBatcher::operator()(), there is indeed a gap and some measurement_ids are missing.

I performed various experiments with different lidar output modes and subscriber counts to compare the behavior of the two driver implementations. To make sure I'm doing the counting as close as possible to the actual moment any new packet reaches the socket, I've added the counting directly into the lambda call in OusterSensor::handle_lidar_packet():

lidar_packets->write_overwrite([this, &cli, pf](uint8_t* buffer) {
        ...

        const auto timeStamp = std::chrono::high_resolution_clock::now().time_since_epoch().count();
        if (!success) std::cout << "[" << timeStamp << "] ERROR reading lidar packet!" << std::endl;
        const uint16_t f_id = pf.frame_id(buffer);
        const uint16_t fIDDiff = f_id - lastFrameID;
        if (fIDDiff > 1) {
            std::cout << "[" << timeStamp << "] missing " << (fIDDiff - 1) << " whole frames (last f_id: " << lastFrameID << ", new f_id: " << f_id << ")" << std::endl;
        }
        for (int icol = 0; icol < pf.columns_per_packet; icol++) {
            const uint8_t* col_buf = pf.nth_col(icol, buffer);
            const uint16_t m_id = pf.col_measurement_id(col_buf);
            if (f_id == lastFrameID) {
                const uint16_t mIDDiff = m_id - lastMeasID;
                if (mIDDiff > 1) {
                  std::cout << "[" << timeStamp << "] missing " << (mIDDiff + 1) / 16 << " packets (last m_id: " << lastMeasID << ", new m_id: " << m_id << ")" << std::endl;
                }
                if (mIDDiff < 1) {
                  std::cout << "[" << timeStamp << "] got the same packet again, (last m_id: " << lastMeasID << ", new m_id: " << m_id << ")" << std::endl;
                }
            }
            lastMeasID = m_id;
        }
        lastFrameID = f_id;
});

I've also added the same to my modified version of the community driver, so I can compare the outputs from both, like for like. All of the subscribers were run on the same machine that was running driver node. I haven't performed any tests with subscribers being on a different machine.

Testing configuration 1:

  • CPU: AMD Ryzen 7 3700X @ 4GHz
  • MOBO: Gigabyte B450 AORUS PRO-CF (NIC: Intel I211 )
  • connection: lidar -> router (MikroTik RBM33G) <-> switch <- PC
  1. mode: 1024x20 @ RNG19_RFL8_SIG16_NIR16 (network data rate: ~260Mbps)

    ouster_ros (this)
    • zero subs: no missing packets

    • one sub: cpu ~10%, continuous missing packets - missing chunk

      output sample
      [os_driver-1] [1707163269239530629] missing 24 packets (last m_id: 191, new m_id: 576)
      [os_driver-1] [1707163269290930295] missing 26 packets (last m_id: 191, new m_id: 608)
      [os_driver-1] [1707163269331508908] missing 14 packets (last m_id: 191, new m_id: 416)
      [os_driver-1] [1707163269381766988] missing 14 packets (last m_id: 191, new m_id: 416)
      [os_driver-1] [1707163269431606906] missing 14 packets (last m_id: 191, new m_id: 416)
      [os_driver-1] [1707163269481805224] missing 14 packets (last m_id: 191, new m_id: 416)
      [os_driver-1] [1707163269531601038] missing 14 packets (last m_id: 191, new m_id: 416)
      [os_driver-1] [1707163269582329121] missing 15 packets (last m_id: 191, new m_id: 432)
      [os_driver-1] [1707163269631583257] missing 14 packets (last m_id: 191, new m_id: 416)
      [os_driver-1] [1707163269681783229] missing 14 packets (last m_id: 191, new m_id: 416)
      
    • two subs: cpu ~15%, continuous missing packets - larger missing chunk

      output sample
      [os_driver-1] [1707163300447574796] missing 34 packets (last m_id: 191, new m_id: 736)
      [os_driver-1] [1707163300506336705] missing 45 packets (last m_id: 191, new m_id: 912)
      [os_driver-1] [1707163300555047522] missing 43 packets (last m_id: 191, new m_id: 880)
      [os_driver-1] [1707163300607716686] missing 47 packets (last m_id: 191, new m_id: 944)
      [os_driver-1] [1707163300654530254] missing 43 packets (last m_id: 191, new m_id: 880)
      [os_driver-1] [1707163300702451213] missing 40 packets (last m_id: 191, new m_id: 832)
      [os_driver-1] [1707163300751456307] missing 39 packets (last m_id: 191, new m_id: 816)
      [os_driver-1] [1707163300801424067] missing 39 packets (last m_id: 191, new m_id: 816)
      [os_driver-1] [1707163300850881239] missing 38 packets (last m_id: 191, new m_id: 800)
      [os_driver-1] [1707163300902423877] missing 40 packets (last m_id: 191, new m_id: 832)
      
    • three, four, five subs: cpu ~20%, continuous missing packets - visualization broken

      output sample
      [os_driver-1] [1707163348781286898] missing 1 whole frames (last f_id: 4782, new f_id: 4784)
      [os_driver-1] [1707163348956029059] missing 1 whole frames (last f_id: 4786, new f_id: 4788)
      [os_driver-1] [1707163349143537162] missing 1 whole frames (last f_id: 4790, new f_id: 4792)
      [os_driver-1] [1707163349200339546] missing 1 whole frames (last f_id: 4792, new f_id: 4794)
      [os_driver-1] [1707163349262251900] missing 1 whole frames (last f_id: 4794, new f_id: 4796)
      [os_driver-1] [1707163349518434334] missing 1 whole frames (last f_id: 4799, new f_id: 4801)
      [os_driver-1] [1707163350339333566] missing 1 whole frames (last f_id: 4813, new f_id: 4815)
      [os_driver-1] [1707163350595441348] missing 1 whole frames (last f_id: 4818, new f_id: 4820)
      [os_driver-1] [1707163351198513463] missing 1 whole frames (last f_id: 4829, new f_id: 4831)
      [os_driver-1] [1707163351611743267] missing 1 whole frames (last f_id: 4839, new f_id: 4841)
      
    ros2_ouster (modified-community)
    • zero subs: no missing packets
    • one sub: cpu ~10%, no missing packets
    • two subs: cpu ~15%, no missing packets
    • three subs: cpu ~20%, no missing packets, whole cloud flickers every ~4s, but doesn't break
    • four subs: cpu ~20%, no missing packets, whole cloud flickers every ~2s, but doesn't break
    • five subs: cpu ~20%, no missing packets, whole cloud flickers every ~1s, but doesn't break
  2. mode: 1024x20 @ RNG15_RFL8_NIR8 (network data rate: ~89Mbps)

    ouster_ros (this)
    • zero subs: no missing packets

    • one sub: cpu ~10%, occasional missing pakcets

      output sample
      [os_driver-1] [1707163575991606495] missing 4 packets (last m_id: 511, new m_id: 576)
      [os_driver-1] [1707163576041597038] missing 4 packets (last m_id: 511, new m_id: 576)
      [os_driver-1] [1707163576091604985] missing 4 packets (last m_id: 511, new m_id: 576)
      [os_driver-1] [1707163576142305896] missing 5 packets (last m_id: 511, new m_id: 592)
      [os_driver-1] [1707163576192326356] missing 5 packets (last m_id: 511, new m_id: 592)
      [os_driver-1] [1707163576242450723] missing 5 packets (last m_id: 511, new m_id: 592)
      [os_driver-1] [1707163576291626412] missing 4 packets (last m_id: 511, new m_id: 576)
      [os_driver-1] [1707163576340881059] missing 3 packets (last m_id: 511, new m_id: 560)
      [os_driver-1] [1707163576391543117] missing 4 packets (last m_id: 511, new m_id: 576)
      [os_driver-1] [1707163576441556464] missing 4 packets (last m_id: 511, new m_id: 576)
      
    • two subs: cpu ~15%, continuous missing packets - missing chunk

      output sample
      [os_driver-1] [1707163649809679939] missing 27 packets (last m_id: 511, new m_id: 944)
      [os_driver-1] [1707163649848743083] missing 13 packets (last m_id: 511, new m_id: 720)
      [os_driver-1] [1707163649898893808] missing 13 packets (last m_id: 511, new m_id: 720)
      [os_driver-1] [1707163649948730206] missing 13 packets (last m_id: 511, new m_id: 720)
      [os_driver-1] [1707163649998818924] missing 13 packets (last m_id: 511, new m_id: 720)
      [os_driver-1] [1707163650048721979] missing 13 packets (last m_id: 511, new m_id: 720)
      [os_driver-1] [1707163650100289070] missing 15 packets (last m_id: 511, new m_id: 752)
      [os_driver-1] [1707163650152638035] missing 18 packets (last m_id: 511, new m_id: 800)
      [os_driver-1] [1707163650201093885] missing 16 packets (last m_id: 511, new m_id: 768)
      [os_driver-1] [1707163650251881418] missing 17 packets (last m_id: 511, new m_id: 784)
      
    • three subs: cpu ~20%, continuous missing packets - visualization starts breaking

      output sample
      [os_driver-1] [1707163685773142794] missing 44 packets (last m_id: 271, new m_id: 976)
      [os_driver-1] [1707163685839850174] missing 1 whole frames (last f_id: 2779, new f_id: 2781)
      [os_driver-1] [1707163685973187115] missing 55 packets (last m_id: 31, new m_id: 912)
      [os_driver-1] [1707163686329413568] missing 1 whole frames (last f_id: 2788, new f_id: 2790)
      [os_driver-1] [1707163686445276655] missing 1 whole frames (last f_id: 2791, new f_id: 2793)
      [os_driver-1] [1707163686567583093] missing 42 packets (last m_id: 143, new m_id: 816)
      [os_driver-1] [1707163686682121677] missing 1 whole frames (last f_id: 2796, new f_id: 2798)
      [os_driver-1] [1707163686804033668] missing 47 packets (last m_id: 79, new m_id: 832)
      [os_driver-1] [1707163686977338719] missing 1 whole frames (last f_id: 2802, new f_id: 2804)
      [os_driver-1] [1707163687160186911] missing 50 packets (last m_id: 15, new m_id: 816)
      
    • four, five subs: cpu ~20%, continuous missing packets - visualization broken

      output sample
      [os_driver-1] [1707163745154385379] missing 1 whole frames (last f_id: 3965, new f_id: 3967)
      [os_driver-1] [1707163745456718508] missing 2 whole frames (last f_id: 3968, new f_id: 3971)
      [os_driver-1] [1707163745971153618] missing 4 whole frames (last f_id: 3975, new f_id: 3980)
      [os_driver-1] [1707163746079036789] missing 1 whole frames (last f_id: 3980, new f_id: 3982)
      [os_driver-1] [1707163746188640683] missing 1 whole frames (last f_id: 3982, new f_id: 3984)
      [os_driver-1] [1707163746292554044] missing 1 whole frames (last f_id: 3984, new f_id: 3986)
      [os_driver-1] [1707163746394514240] missing 1 whole frames (last f_id: 3986, new f_id: 3988)
      [os_driver-1] [1707163746497304451] missing 1 whole frames (last f_id: 3988, new f_id: 3990)
      [os_driver-1] [1707163746595475359] missing 1 whole frames (last f_id: 3990, new f_id: 3992)
      [os_driver-1] [1707163746703561906] missing 1 whole frames (last f_id: 3992, new f_id: 3994)
      
    ros2_ouster (modified-community)
    • zero subs: no missing packets
    • one sub: cpu ~10%, no missing packets
    • two subs: cpu ~15%, no missing packets
    • three subs: cpu ~20%, no missing packets, whole cloud flickers every ~3s, but doesn't break
    • four subs: cpu ~20%, no missing packets, whole cloud flickers every ~2s, but doesn't break
    • five subs: cpu ~20%, no missing packets, whole cloud flickers every ~1s, but doesn't break
  3. mode: 1024x10 @ RNG19_RFL8_SIG16_NIR16 (network data rate: ~130Mbps)

    ouster_ros (this)
    • zero subs: no missing packets

    • one sub: cpu ~5%, continuous missing packets - missing chunk

      output sample
      [os_driver-1] [1707163941466608835] missing 3 packets (last m_id: 191, new m_id: 240)
      [os_driver-1] [1707163941563376753] missing 1 packets (last m_id: 191, new m_id: 208)
      [os_driver-1] [1707163941663486879] missing 1 packets (last m_id: 191, new m_id: 208)
      [os_driver-1] [1707163941763586907] missing 1 packets (last m_id: 191, new m_id: 208)
      [os_driver-1] [1707163941871419913] missing 6 packets (last m_id: 191, new m_id: 288)
      [os_driver-1] [1707163941971428957] missing 6 packets (last m_id: 191, new m_id: 288)
      [os_driver-1] [1707163942071464423] missing 6 packets (last m_id: 191, new m_id: 288)
      [os_driver-1] [1707163942171396663] missing 6 packets (last m_id: 191, new m_id: 288)
      [os_driver-1] [1707163942265265050] missing 2 packets (last m_id: 191, new m_id: 224)
      [os_driver-1] [1707163942363622583] missing 1 packets (last m_id: 191, new m_id: 208)
      
    • two subs: cpu ~10%, continuous missing packets - larger missing chunk

      output sample
      [os_driver-1] [1707163981279139525] missing 11 packets (last m_id: 191, new m_id: 368)
      [os_driver-1] [1707163981378924044] missing 11 packets (last m_id: 191, new m_id: 368)
      [os_driver-1] [1707163981478917800] missing 11 packets (last m_id: 191, new m_id: 368)
      [os_driver-1] [1707163981577313625] missing 10 packets (last m_id: 191, new m_id: 352)
      [os_driver-1] [1707163981685079583] missing 15 packets (last m_id: 191, new m_id: 432)
      [os_driver-1] [1707163981777324973] missing 10 packets (last m_id: 191, new m_id: 352)
      [os_driver-1] [1707163981877286738] missing 10 packets (last m_id: 191, new m_id: 352)
      [os_driver-1] [1707163981977512945] missing 10 packets (last m_id: 191, new m_id: 352)
      [os_driver-1] [1707163982078861100] missing 11 packets (last m_id: 191, new m_id: 368)
      [os_driver-1] [1707163982177308343] missing 10 packets (last m_id: 191, new m_id: 352)
      
    • three subs: cpu ~10%, continuous missing packets - larger missing chunk

      output sample
      [os_driver-1] [1707164017000510224] missing 25 packets (last m_id: 191, new m_id: 592)
      [os_driver-1] [1707164017102264269] missing 26 packets (last m_id: 191, new m_id: 608)
      [os_driver-1] [1707164017211446524] missing 32 packets (last m_id: 191, new m_id: 704)
      [os_driver-1] [1707164017306680161] missing 29 packets (last m_id: 191, new m_id: 656)
      [os_driver-1] [1707164017405101394] missing 28 packets (last m_id: 191, new m_id: 640)
      [os_driver-1] [1707164017506765008] missing 29 packets (last m_id: 191, new m_id: 656)
      [os_driver-1] [1707164017605007172] missing 28 packets (last m_id: 191, new m_id: 640)
      [os_driver-1] [1707164017705243288] missing 28 packets (last m_id: 191, new m_id: 640)
      [os_driver-1] [1707164017795995695] missing 22 packets (last m_id: 191, new m_id: 544)
      [os_driver-1] [1707164017895742102] missing 22 packets (last m_id: 191, new m_id: 544)
      
    • four subs: cpu ~15%, continuous missing packets - larger missing chunk

      output sample
      [os_driver-1] [1707164062722875267] missing 39 packets (last m_id: 191, new m_id: 816)
      [os_driver-1] [1707164062826047743] missing 41 packets (last m_id: 191, new m_id: 848)
      [os_driver-1] [1707164062922922092] missing 39 packets (last m_id: 191, new m_id: 816)
      [os_driver-1] [1707164063022947899] missing 39 packets (last m_id: 191, new m_id: 816)
      [os_driver-1] [1707164063122958888] missing 39 packets (last m_id: 191, new m_id: 816)
      [os_driver-1] [1707164063221234495] missing 38 packets (last m_id: 191, new m_id: 800)
      [os_driver-1] [1707164063319929418] missing 37 packets (last m_id: 191, new m_id: 784)
      [os_driver-1] [1707164063419914507] missing 37 packets (last m_id: 191, new m_id: 784)
      [os_driver-1] [1707164063518306004] missing 36 packets (last m_id: 191, new m_id: 768)
      [os_driver-1] [1707164063624299651] missing 40 packets (last m_id: 191, new m_id: 832)
      
    • five subs: cpu ~20%, continuous missing packets - visualization starts breaking

      output sample
      [os_driver-1] [1707164096841226282] missing 51 packets (last m_id: 143, new m_id: 960)
      [os_driver-1] [1707164097064122928] missing 1 whole frames (last f_id: 2318, new f_id: 2320)
      [os_driver-1] [1707164098531192776] missing 52 packets (last m_id: 15, new m_id: 848)
      [os_driver-1] [1707164098723044838] missing 49 packets (last m_id: 79, new m_id: 864)
      [os_driver-1] [1707164099737681881] missing 55 packets (last m_id: 15, new m_id: 896)
      [os_driver-1] [1707164099848484068] missing 58 packets (last m_id: 47, new m_id: 976)
      [os_driver-1] [1707164100714352920] missing 47 packets (last m_id: 31, new m_id: 784)
      [os_driver-1] [1707164102038212540] missing 55 packets (last m_id: 79, new m_id: 960)
      [os_driver-1] [1707164102145944605] missing 59 packets (last m_id: 31, new m_id: 976)
      [os_driver-1] [1707164102538316186] missing 54 packets (last m_id: 111, new m_id: 976)
      
    ros2_ouster (modified-community)
    • zero subs: no missing packets
    • one sub: cpu ~5%, no missing packets
    • two, three subs: cpu ~10%, no missing packets
    • four subs: cpu ~15%, no missing packets
    • five subs: cpu ~20%, no missing packets
  4. mode: 4096x5 @ RNG19_RFL8_SIG16_NIR16 (network data rate: ~260Mbps)

    ouster_ros (this)
    • zero subs: cpu ~1%, continuous missing packets - small missing chunk

      output sample
      [os_driver-1] [1707164302331558969] missing 21 packets (last m_id: 191, new m_id: 528)
      [os_driver-1] [1707164302516656618] missing 2 packets (last m_id: 191, new m_id: 224)
      [os_driver-1] [1707164302716551405] missing 2 packets (last m_id: 191, new m_id: 224)
      [os_driver-1] [1707164302919921503] missing 6 packets (last m_id: 191, new m_id: 288)
      [os_driver-1] [1707164303116906180] missing 2 packets (last m_id: 191, new m_id: 224)
      [os_driver-1] [1707164303317775063] missing 3 packets (last m_id: 191, new m_id: 240)
      [os_driver-1] [1707164303519703057] missing 6 packets (last m_id: 191, new m_id: 288)
      [os_driver-1] [1707164303716988553] missing 3 packets (last m_id: 191, new m_id: 240)
      [os_driver-1] [1707164303928002931] missing 17 packets (last m_id: 191, new m_id: 464)
      [os_driver-1] [1707164304119856094] missing 6 packets (last m_id: 191, new m_id: 288)
      
    • one sub: cpu ~10%, continuous missing packets - missing chunk

      output sample
      [os_driver-1] [1707164351584725805] missing 90 packets (last m_id: 191, new m_id: 1632)
      [os_driver-1] [1707164351782832139] missing 88 packets (last m_id: 191, new m_id: 1600)
      [os_driver-1] [1707164351988373365] missing 95 packets (last m_id: 191, new m_id: 1712)
      [os_driver-1] [1707164352183945523] missing 89 packets (last m_id: 191, new m_id: 1616)
      [os_driver-1] [1707164352382603533] missing 87 packets (last m_id: 191, new m_id: 1584)
      [os_driver-1] [1707164352583146760] missing 88 packets (last m_id: 191, new m_id: 1600)
      [os_driver-1] [1707164352783869757] missing 89 packets (last m_id: 191, new m_id: 1616)
      [os_driver-1] [1707164352982937074] missing 88 packets (last m_id: 191, new m_id: 1600)
      [os_driver-1] [1707164353183111040] missing 88 packets (last m_id: 191, new m_id: 1600)
      [os_driver-1] [1707164353384042943] missing 89 packets (last m_id: 191, new m_id: 1616)
      
    • two subs: cpu ~15%, continuous missing packets - larger missing chunk

      output sample
      [os_driver-1] [1707164393663320528] missing 190 packets (last m_id: 191, new m_id: 3232)
      [os_driver-1] [1707164393861601924] missing 188 packets (last m_id: 191, new m_id: 3200)
      [os_driver-1] [1707164394058264230] missing 184 packets (last m_id: 191, new m_id: 3136)
      [os_driver-1] [1707164394258682569] missing 185 packets (last m_id: 191, new m_id: 3152)
      [os_driver-1] [1707164394460501104] missing 187 packets (last m_id: 191, new m_id: 3184)
      [os_driver-1] [1707164394658347094] missing 184 packets (last m_id: 191, new m_id: 3136)
      [os_driver-1] [1707164394859984085] missing 186 packets (last m_id: 191, new m_id: 3168)
      [os_driver-1] [1707164395059920240] missing 185 packets (last m_id: 191, new m_id: 3152)
      [os_driver-1] [1707164395264114972] missing 191 packets (last m_id: 191, new m_id: 3248)
      [os_driver-1] [1707164395460489031] missing 186 packets (last m_id: 191, new m_id: 3168)
      
    • three, four, five subs: cpu ~20%, continuous missing packets - visualization broken

      output sample
      [os_driver-1] [1707164424918401581] missing 1 whole frames (last f_id: 796, new f_id: 798)
      [os_driver-1] [1707164425932852902] missing 1 whole frames (last f_id: 801, new f_id: 803)
      [os_driver-1] [1707164428157476382] missing 1 whole frames (last f_id: 811, new f_id: 813)
      [os_driver-1] [1707164428641940013] missing 1 whole frames (last f_id: 814, new f_id: 816)
      [os_driver-1] [1707164429128105842] missing 1 whole frames (last f_id: 817, new f_id: 819)
      [os_driver-1] [1707164430139524220] missing 1 whole frames (last f_id: 822, new f_id: 824)
      [os_driver-1] [1707164431344012309] missing 1 whole frames (last f_id: 828, new f_id: 830)
      [os_driver-1] [1707164432587699720] missing 1 whole frames (last f_id: 834, new f_id: 836)
      [os_driver-1] [1707164433321082816] missing 1 whole frames (last f_id: 838, new f_id: 840)
      [os_driver-1] [1707164435316278322] missing 2 whole frames (last f_id: 847, new f_id: 850)
      
    ros2_ouster (modified-community)
    • zero subs: no missing packets
    • one sub: cpu ~10%, no missing packets
    • two subs: cpu ~15%, no missing packets
    • three subs: cpu ~20%, no missing packets, whole cloud flickers every ~2s, but doesn't break
    • four subs: cpu ~20%, no missing packets, whole cloud flickers every ~1s, but doesn't break
    • five subs: cpu ~20%, no missing packets, whole cloud flickers every ~0.5s, but doesn't break
  5. mode: 512x20 @ RNG19_RFL8_SIG16_NIR16 (network data rate: ~130Mbps)

    ouster_ros (this)
    • zero subs: no missing packets

    • one sub: cpu ~5%, no missing packets

    • two subs: cpu ~10%, continuous missing packets - missing chunk

      output sample
      [os_driver-1] [1707164795342982793] missing 4 packets (last m_id: 191, new m_id: 256)
      [os_driver-1] [1707164795438138841] missing 1 packets (last m_id: 191, new m_id: 208)
      [os_driver-1] [1707164795491225944] missing 3 packets (last m_id: 191, new m_id: 240)
      [os_driver-1] [1707164795538135377] missing 1 packets (last m_id: 191, new m_id: 208)
      [os_driver-1] [1707164795588124493] missing 1 packets (last m_id: 191, new m_id: 208)
      [os_driver-1] [1707164795638092108] missing 1 packets (last m_id: 191, new m_id: 208)
      [os_driver-1] [1707164795688198397] missing 1 packets (last m_id: 191, new m_id: 208)
      [os_driver-1] [1707164795738190898] missing 1 packets (last m_id: 191, new m_id: 208)
      [os_driver-1] [1707164795838314837] missing 1 packets (last m_id: 191, new m_id: 208)
      [os_driver-1] [1707164795888055481] missing 1 packets (last m_id: 191, new m_id: 208)
      
    • three subs: cpu ~10%, continuous missing packets - larger missing chunk

      output sample
      [os_driver-1] [1707164833148220273] missing 7 packets (last m_id: 191, new m_id: 304)
      [os_driver-1] [1707164833198215459] missing 7 packets (last m_id: 191, new m_id: 304)
      [os_driver-1] [1707164833251520767] missing 9 packets (last m_id: 191, new m_id: 336)
      [os_driver-1] [1707164833298153715] missing 7 packets (last m_id: 191, new m_id: 304)
      [os_driver-1] [1707164833346666025] missing 6 packets (last m_id: 191, new m_id: 288)
      [os_driver-1] [1707164833394925503] missing 5 packets (last m_id: 191, new m_id: 272)
      [os_driver-1] [1707164833446610472] missing 6 packets (last m_id: 191, new m_id: 288)
      [os_driver-1] [1707164833496430216] missing 6 packets (last m_id: 191, new m_id: 288)
      [os_driver-1] [1707164833544980547] missing 5 packets (last m_id: 191, new m_id: 272)
      [os_driver-1] [1707164833599717937] missing 8 packets (last m_id: 191, new m_id: 320)
      
    • four subs: cpu ~15%, continuous missing packets - larger missing chunk

      output sample
      [os_driver-1] [1707164887209395330] missing 14 packets (last m_id: 191, new m_id: 416)
      [os_driver-1] [1707164887259477683] missing 14 packets (last m_id: 191, new m_id: 416)
      [os_driver-1] [1707164887308082238] missing 13 packets (last m_id: 191, new m_id: 400)
      [os_driver-1] [1707164887359417802] missing 14 packets (last m_id: 191, new m_id: 416)
      [os_driver-1] [1707164887408182210] missing 13 packets (last m_id: 191, new m_id: 400)
      [os_driver-1] [1707164887457792587] missing 13 packets (last m_id: 191, new m_id: 400)
      [os_driver-1] [1707164887507832499] missing 13 packets (last m_id: 191, new m_id: 400)
      [os_driver-1] [1707164887556867171] missing 12 packets (last m_id: 191, new m_id: 384)
      [os_driver-1] [1707164887607863461] missing 13 packets (last m_id: 191, new m_id: 400)
      [os_driver-1] [1707164887657809725] missing 13 packets (last m_id: 191, new m_id: 400)
      
    • five subs: cpu ~20%, continuous missing packets - visualization starts breaking

      output sample
      [os_driver-1] [1707164930317023679] missing 22 packets (last m_id: 111, new m_id: 464)
      [os_driver-1] [1707164930369099089] missing 28 packets (last m_id: 47, new m_id: 496)
      [os_driver-1] [1707164930423634785] missing 1 whole frames (last f_id: 3941, new f_id: 3943)
      [os_driver-1] [1707164931609698588] missing 22 packets (last m_id: 15, new m_id: 368)
      [os_driver-1] [1707164931656728029] missing 25 packets (last m_id: 31, new m_id: 432)
      [os_driver-1] [1707164931703409468] missing 19 packets (last m_id: 95, new m_id: 400)
      [os_driver-1] [1707164931749856844] missing 19 packets (last m_id: 63, new m_id: 368)
      [os_driver-1] [1707164931750534782] missing 18 packets (last m_id: 31, new m_id: 320)
      [os_driver-1] [1707164931904169128] missing 23 packets (last m_id: 31, new m_id: 400)
      [os_driver-1] [1707164931951276678] missing 19 packets (last m_id: 63, new m_id: 368)
      
    ros2_ouster (modified-community)
    • zero subs: no missing packets
    • one sub: cpu ~5%, no missing packets
    • two, three subs: cpu ~10%, no missing packets
    • four subs: cpu ~15%, no missing packets
    • five subs: cpu ~20%, no missing packets

Testing configuration 2:

  • CPU: Intel i5-7600K @ 4.8GHz
  • MOBO: MSI Z270 SLI-PLUS (NIC: Intel I219-V )
  • connection: lidar -> switch <-> router (MikroTik RB750Gr3) <- PC
  1. mode: 1024x20 @ RNG19_RFL8_SIG16_NIR16 (network data rate: ~270Mbps)

    ouster_ros (this)
    • zero subs: no missing packets

    • one sub: cpu ~40%, occasional missing packets

      output sample
      [os_driver-1] [1707078416001219917] missing 8 packets (last m_id: 591, new m_id: 720)
      [os_driver-1] [1707078437058331294] missing 1 packets (last m_id: 431, new m_id: 448)
      [os_driver-1] [1707078444023384659] missing 18 packets (last m_id: 63, new m_id: 352)
      [os_driver-1] [1707078451235695624] missing 1 whole frames (last f_id: 837, new f_id: 839)
      [os_driver-1] [1707078451236153788] missing 13 packets (last m_id: 415, new m_id: 624)
      [os_driver-1] [1707078451301575466] missing 24 packets (last m_id: 543, new m_id: 928)
      [os_driver-1] [1707078462003575861] missing 2 packets (last m_id: 943, new m_id: 976)
      [os_driver-1] [1707078471354333625] missing 3 packets (last m_id: 943, new m_id: 992)
      
    • two subs: cpu ~70%, continuous missing packets - visualization starts breaking

      output sample
      [os_driver-1] [1707078499342109361] missing 22 packets (last m_id: 335, new m_id: 688)
      [os_driver-1] [1707078499394572871] missing 37 packets (last m_id: 143, new m_id: 736)
      [os_driver-1] [1707078499456043470] missing 23 packets (last m_id: 431, new m_id: 800)
      [os_driver-1] [1707078499456544903] missing 41 packets (last m_id: 239, new m_id: 896)
      [os_driver-1] [1707078499565140026] missing 1 whole frames (last f_id: 1805, new f_id: 1807)
      [os_driver-1] [1707078499677102956] missing 10 packets (last m_id: 143, new m_id: 304)
      [os_driver-1] [1707078499785803527] missing 12 packets (last m_id: 367, new m_id: 560)
      [os_driver-1] [1707078499839710981] missing 37 packets (last m_id: 15, new m_id: 608)
      [os_driver-1] [1707078499840437695] missing 25 packets (last m_id: 303, new m_id: 704)
      [os_driver-1] [1707078499944452626] missing 8 packets (last m_id: 623, new m_id: 752)
      
    • three, four, five subs: cpu ~70%, continuous missing packets - visualization broken

      output sample
      [os_driver-1] [1707078642316891140] missing 6 whole frames (last f_id: 4655, new f_id: 4662)
      [os_driver-1] [1707078642692543109] missing 3 whole frames (last f_id: 4663, new f_id: 4667)
      [os_driver-1] [1707078642693357045] missing 1 whole frames (last f_id: 4667, new f_id: 4669)
      [os_driver-1] [1707078642963683775] missing 4 whole frames (last f_id: 4670, new f_id: 4675)
      [os_driver-1] [1707078643111958249] missing 1 whole frames (last f_id: 4676, new f_id: 4678)
      [os_driver-1] [1707078643361102491] missing 1 whole frames (last f_id: 4681, new f_id: 4683)
      [os_driver-1] [1707078643483634619] missing 1 whole frames (last f_id: 4683, new f_id: 4685)
      [os_driver-1] [1707078643609391883] missing 1 whole frames (last f_id: 4686, new f_id: 4688)
      [os_driver-1] [1707078643733400431] missing 1 whole frames (last f_id: 4688, new f_id: 4690)
      [os_driver-1] [1707078644464013814] missing 12 whole frames (last f_id: 4691, new f_id: 4704)
      
    ros2_ouster (modified-community)
    • zero subs: no missing packets

    • one sub: cpu ~40%

    • two subs: cpu ~70%

    • three subs: cpu ~70%, whole cloud flickers every ~2s, but doesn't break

    • four, five subs: cpu ~70%, whole cloud flickers every ~1s, but doesn't break

    • occasional mising packets hapenning randomly throughout the duration (no correlation with subscriber count)

      output sample
      [ouster_driver-1] [1707075847377064069] missing 12 packets (last m_id: 383, new m_id: 576)
      [ouster_driver-1] [1707075847508845281] missing 1 packets (last m_id: 159, new m_id: 176)
      [ouster_driver-1] [1707075861927682552] missing 6 packets (last m_id: 479, new m_id: 576)
      [ouster_driver-1] [1707075874992210797] missing 42 packets (last m_id: 47, new m_id: 720)
      [ouster_driver-1] [1707075881954805507] missing 5 packets (last m_id: 31, new m_id: 112)
      [ouster_driver-1] [1707075884971192420] missing 2 packets (last m_id: 415, new m_id: 448)
      [ouster_driver-1] [1707075888960523667] missing 11 packets (last m_id: 31, new m_id: 208)
      [ouster_driver-1] [1707075890426560684] missing 5 packets (last m_id: 479, new m_id: 560)
      [ouster_driver-1] [1707075896431202892] missing 1 packets (last m_id: 639, new m_id: 656)
      [ouster_driver-1] [1707075900676500689] missing 1 packets (last m_id: 479, new m_id: 496)
      [ouster_driver-1] [1707075902991056600] missing 47 packets (last m_id: 31, new m_id: 784)
      [ouster_driver-1] [1707075910024002145] missing 2 packets (last m_id: 463, new m_id: 496)
      [ouster_driver-1] [1707075916962803417] missing 13 packets (last m_id: 31, new m_id: 240)
      [ouster_driver-1] [1707075923175527514] missing 1 packets (last m_id: 511, new m_id: 528)
      [ouster_driver-1] [1707075923983757574] missing 37 packets (last m_id: 31, new m_id: 624)
      [ouster_driver-1] [1707075925028073644] missing 1 packets (last m_id: 559, new m_id: 576)
      [ouster_driver-1] [1707075925043659119] missing 4 packets (last m_id: 831, new m_id: 896)
      [ouster_driver-1] [1707075925331856526] missing 2 packets (last m_id: 623, new m_id: 656)
      [ouster_driver-1] [1707075926181011495] missing 6 packets (last m_id: 543, new m_id: 640)
      [ouster_driver-1] [1707075926926284670] missing 7 packets (last m_id: 431, new m_id: 544)
      
  2. mode: 1024x20 @ RNG15_RFL8_NIR8 (network data rate: ~88Mbps)

    ouster_ros (this)
    • zero subs: no missing packets

    • one sub: cpu ~40%, no missing packets

    • two subs: cpu ~70%, continuous missing packets - visualization starts breaking

      output sample
      [os_driver-1] [1707078821712936452] missing 1 whole frames (last f_id: 1264, new f_id: 1266)
      [os_driver-1] [1707078822112496841] missing 27 packets (last m_id: 383, new m_id: 816)
      [os_driver-1] [1707078822162662350] missing 28 packets (last m_id: 463, new m_id: 912)
      [os_driver-1] [1707078822744322011] missing 1 whole frames (last f_id: 1283, new f_id: 1285)
      [os_driver-1] [1707078822745083553] missing 14 packets (last m_id: 703, new m_id: 928)
      [os_driver-1] [1707078823066193480] missing 1 whole frames (last f_id: 1290, new f_id: 1292)
      [os_driver-1] [1707078823288936556] missing 24 packets (last m_id: 223, new m_id: 608)
      [os_driver-1] [1707078823395733456] missing 10 packets (last m_id: 783, new m_id: 944)
      [os_driver-1] [1707078823761105275] missing 1 whole frames (last f_id: 1304, new f_id: 1306)
      [os_driver-1] [1707078824178369205] missing 32 packets (last m_id: 31, new m_id: 544)
      
    • three subs: cpu ~70%, continuous missing packets - visualization broken

      output sample
      [os_driver-1] [1707078869332298839] missing 1 whole frames (last f_id: 2214, new f_id: 2216)
      [os_driver-1] [1707078869786746237] missing 4 whole frames (last f_id: 2220, new f_id: 2225)
      [os_driver-1] [1707078870329054671] missing 4 whole frames (last f_id: 2231, new f_id: 2236)
      [os_driver-1] [1707078870619331942] missing 13 packets (last m_id: 415, new m_id: 624)
      [os_driver-1] [1707078870767700281] missing 3 whole frames (last f_id: 2241, new f_id: 2245)
      [os_driver-1] [1707078871254528098] missing 5 whole frames (last f_id: 2250, new f_id: 2256)
      [os_driver-1] [1707078871685898654] missing 2 whole frames (last f_id: 2260, new f_id: 2263)
      [os_driver-1] [1707078871686140568] missing 1 whole frames (last f_id: 2263, new f_id: 2265)
      [os_driver-1] [1707078871921279203] missing 1 whole frames (last f_id: 2269, new f_id: 2271)
      [os_driver-1] [1707078872234017748] missing 2 whole frames (last f_id: 2274, new f_id: 2277)
      
    • four, five subs: cpu ~70%, continuous missing packets - visualization broken

      output sample
      [os_driver-1] [1707078914814305692] missing 3 whole frames (last f_id: 3120, new f_id: 3124)
      [os_driver-1] [1707078915167833303] missing 3 whole frames (last f_id: 3125, new f_id: 3129)
      [os_driver-1] [1707078915168521001] missing 5 whole frames (last f_id: 3130, new f_id: 3136)
      [os_driver-1] [1707078915536374579] missing 3 whole frames (last f_id: 3139, new f_id: 3143)
      [os_driver-1] [1707078916147397378] missing 8 whole frames (last f_id: 3146, new f_id: 3155)
      [os_driver-1] [1707078916881222789] missing 6 whole frames (last f_id: 3158, new f_id: 3165)
      [os_driver-1] [1707078916881428712] missing 1 whole frames (last f_id: 3166, new f_id: 3168)
      [os_driver-1] [1707078916881635922] missing 1 whole frames (last f_id: 3168, new f_id: 3170)
      [os_driver-1] [1707078917782688462] missing 9 whole frames (last f_id: 3173, new f_id: 3183)
      [os_driver-1] [1707078917908426937] missing 5 whole frames (last f_id: 3185, new f_id: 3191)
      
    ros2_ouster (modified-community)
    • zero subs: no missing packets

    • one sub: cpu ~40%

    • two subs: cpu ~70%, whole cloud flickers every ~7s, but doesn't break

    • three subs: cpu ~70%, whole cloud flickers every ~2s, but doesn't break

    • four, five subs: cpu ~70%, whole cloud flickers every ~1s, but doesn't break

    • occasional mising packets hapenning randomly throughout the duration (no correlation with subscriber count)

      full output from whole experiment
      [ouster_driver-1] [1707078055990473230] missing 20 packets (last m_id: 207, new m_id: 528)
      [ouster_driver-1] [1707078062986564926] missing 17 packets (last m_id: 207, new m_id: 480)
      [ouster_driver-1] [1707078069996904091] missing 31 packets (last m_id: 207, new m_id: 704)
      
  3. mode: 1024x10 @ RNG19_RFL8_SIG16_NIR16 (network data rate: ~130Mbps)

    ouster_ros (this)
    • zero subs: no missing packets

    • one sub: cpu ~20%, no missing packets

    • two subs: cpu ~50%, no missing packets

    • three subs: cpu ~50%, occasional missing packets

      full output from experiment part
      [os_driver-1] [1707079136250960626] missing 8 packets (last m_id: 255, new m_id: 384)
      [os_driver-1] [1707079143159455222] missing 1 whole frames (last f_id: 1078, new f_id: 1080)
      [os_driver-1] [1707079164261509954] missing 15 packets (last m_id: 495, new m_id: 736)
      [os_driver-1] [1707079164262704093] missing 20 packets (last m_id: 191, new m_id: 512)
      
    • four subs: cpu ~70%, continuous missing packets - visualization starts breaking

      output sample
      [os_driver-1] [1707079228171241360] missing 17 packets (last m_id: 303, new m_id: 576)
      [os_driver-1] [1707079228172026264] missing 23 packets (last m_id: 239, new m_id: 608)
      [os_driver-1] [1707079228378187042] missing 10 packets (last m_id: 527, new m_id: 688)
      [os_driver-1] [1707079228579261146] missing 7 packets (last m_id: 591, new m_id: 704)
      [os_driver-1] [1707079228783554505] missing 7 packets (last m_id: 607, new m_id: 720)
      [os_driver-1] [1707079228990268493] missing 8 packets (last m_id: 671, new m_id: 800)
      [os_driver-1] [1707079228990561048] missing 49 packets (last m_id: 15, new m_id: 800)
      [os_driver-1] [1707079229515271560] missing 48 packets (last m_id: 239, new m_id: 1008)
      [os_driver-1] [1707079229831828736] missing 1 whole frames (last f_id: 1945, new f_id: 1947)
      [os_driver-1] [1707079230028341273] missing 5 packets (last m_id: 127, new m_id: 208)
      
    • five subs: cpu ~70%, continuous missing packets - visualization broken

      output sample
      [os_driver-1] [1707079247036970651] missing 38 packets (last m_id: 159, new m_id: 768)
      [os_driver-1] [1707079247038496096] missing 1 whole frames (last f_id: 2116, new f_id: 2118)
      [os_driver-1] [1707079247669594431] missing 2 whole frames (last f_id: 2122, new f_id: 2125)
      [os_driver-1] [1707079247908525292] missing 21 packets (last m_id: 495, new m_id: 832)
      [os_driver-1] [1707079248035169988] missing 59 packets (last m_id: 47, new m_id: 992)
      [os_driver-1] [1707079248559504731] missing 1 whole frames (last f_id: 2132, new f_id: 2134)
      [os_driver-1] [1707079248691944407] missing 25 packets (last m_id: 415, new m_id: 816)
      [os_driver-1] [1707079249179694170] missing 1 whole frames (last f_id: 2138, new f_id: 2140)
      [os_driver-1] [1707079249672057999] missing 2 whole frames (last f_id: 2141, new f_id: 2144)
      [os_driver-1] [1707079249905130019] missing 45 packets (last m_id: 63, new m_id: 784)
      
    ros2_ouster (modified-community)
    • zero subs: no missing packets

    • one sub: cpu ~30%

    • two subs: cpu ~40%

    • three subs: cpu ~60%

    • four subs: cpu ~70%

    • five subs: cpu ~70%, whole cloud flickers every ~7s, but doesn't break

    • occasional mising packets hapenning randomly throughout the duration (no correlation with subscriber count)

      full output from whole experiment
      [ouster_driver-1] [1707076714984398784] missing 13 packets (last m_id: 559, new m_id: 768)
      [ouster_driver-1] [1707076728980358500] missing 6 packets (last m_id: 639, new m_id: 736)
      [ouster_driver-1] [1707076742999346976] missing 20 packets (last m_id: 559, new m_id: 880)
      [ouster_driver-1] [1707076749980471714] missing 11 packets (last m_id: 559, new m_id: 736)
      [ouster_driver-1] [1707076756992517135] missing 19 packets (last m_id: 559, new m_id: 864)
      [ouster_driver-1] [1707076763992695519] missing 19 packets (last m_id: 559, new m_id: 864)
      [ouster_driver-1] [1707076770981505856] missing 11 packets (last m_id: 559, new m_id: 736)
      [ouster_driver-1] [1707076868063755725] missing 1 packets (last m_id: 591, new m_id: 608)
      [ouster_driver-1] [1707076961968891196] missing 2 packets (last m_id: 655, new m_id: 688)
      [ouster_driver-1] [1707076982972809021] missing 6 packets (last m_id: 639, new m_id: 736)
      
  4. mode: 4096x5 @ RNG19_RFL8_SIG16_NIR16 (network data rate: ~265Mbps)

    ouster_ros (this)
    • zero subs: no missing packets

    • one sub: cpu ~30%, continuous missing packets - missing chunk

      output sample
      [os_driver-1] [1707079442734938479] missing 93 packets (last m_id: 943, new m_id: 2432)
      [os_driver-1] [1707079442925840089] missing 82 packets (last m_id: 943, new m_id: 2256)
      [os_driver-1] [1707079443128268209] missing 85 packets (last m_id: 943, new m_id: 2304)
      [os_driver-1] [1707079443332981404] missing 91 packets (last m_id: 943, new m_id: 2400)
      [os_driver-1] [1707079443528916571] missing 86 packets (last m_id: 943, new m_id: 2320)
      [os_driver-1] [1707079443732558156] missing 90 packets (last m_id: 943, new m_id: 2384)
      [os_driver-1] [1707079443930715565] missing 88 packets (last m_id: 943, new m_id: 2352)
      [os_driver-1] [1707079444129361700] missing 86 packets (last m_id: 943, new m_id: 2320)
      [os_driver-1] [1707079444329804300] missing 86 packets (last m_id: 943, new m_id: 2320)
      [os_driver-1] [1707079444532477535] missing 90 packets (last m_id: 943, new m_id: 2384)
      
    • two subs: cpu ~70%, continuous missing packets - visualization broken

      output sample
      [os_driver-1] [1707079512105863989] missing 1 whole frames (last f_id: 552, new f_id: 554)
      [os_driver-1] [1707079514487943796] missing 1 whole frames (last f_id: 564, new f_id: 566)
      [os_driver-1] [1707079516001457339] missing 213 packets (last m_id: 95, new m_id: 3504)
      [os_driver-1] [1707079516225771780] missing 232 packets (last m_id: 127, new m_id: 3840)
      [os_driver-1] [1707079516659399688] missing 1 whole frames (last f_id: 575, new f_id: 577)
      [os_driver-1] [1707079518587943896] missing 219 packets (last m_id: 15, new m_id: 3520)
      [os_driver-1] [1707079519031476682] missing 224 packets (last m_id: 415, new m_id: 4000)
      [os_driver-1] [1707079520372967788] missing 1 whole frames (last f_id: 593, new f_id: 595)
      [os_driver-1] [1707079520814657159] missing 229 packets (last m_id: 95, new m_id: 3760)
      [os_driver-1] [1707079522087905653] missing 1 whole frames (last f_id: 602, new f_id: 604)
      
    • three, four, five subs: cpu ~70%, continuous missing packets - visualization broken

      output sample
      [os_driver-1] [1707079575676387585] missing 1 whole frames (last f_id: 870, new f_id: 872)
      [os_driver-1] [1707079577519223861] missing 3 whole frames (last f_id: 877, new f_id: 881)
      [os_driver-1] [1707079577830181868] missing 1 whole frames (last f_id: 881, new f_id: 883)
      [os_driver-1] [1707079578428070097] missing 1 whole frames (last f_id: 884, new f_id: 886)
      [os_driver-1] [1707079579026090177] missing 1 whole frames (last f_id: 887, new f_id: 889)
      [os_driver-1] [1707079579653022543] missing 1 whole frames (last f_id: 890, new f_id: 892)
      [os_driver-1] [1707079579653048655] missing 7 packets (last m_id: 671, new m_id: 784)
      [os_driver-1] [1707079580965913926] missing 1 whole frames (last f_id: 895, new f_id: 897)
      [os_driver-1] [1707079581583998113] missing 1 whole frames (last f_id: 898, new f_id: 900)
      [os_driver-1] [1707079582495431231] missing 1 whole frames (last f_id: 902, new f_id: 904)
      
    ros2_ouster (modified-community)
    • zero subs: no missing packets

    • one sub: cpu ~50%

    • two subs: cpu ~60%, whole cloud flickers every ~3s, but doesn't break

    • three, four subs: cpu ~70%, whole cloud flickers every ~1s, but doesn't break

    • five subs: cpu ~70%, whole cloud flickers every ~0.5s, but doesn't break

    • occasional mising packets hapenning randomly throughout the duration (no correlation with subscriber count)

      output sample
      [ouster_driver-1] [1707077222407644215] missing 12 packets (last m_id: 703, new m_id: 896)
      [ouster_driver-1] [1707077222954607736] missing 4 packets (last m_id: 3871, new m_id: 3936)
      [ouster_driver-1] [1707077228719380233] missing 4 packets (last m_id: 3103, new m_id: 3168)
      [ouster_driver-1] [1707077236956473090] missing 7 packets (last m_id: 3871, new m_id: 3984)
      [ouster_driver-1] [1707077259390902359] missing 3 packets (last m_id: 575, new m_id: 624)
      [ouster_driver-1] [1707077271818504310] missing 1 packets (last m_id: 1167, new m_id: 1184)
      [ouster_driver-1] [1707077281859087661] missing 1 packets (last m_id: 2015, new m_id: 2032)
      [ouster_driver-1] [1707077289423213294] missing 2 packets (last m_id: 1279, new m_id: 1312)
      [ouster_driver-1] [1707077292854235865] missing 2 packets (last m_id: 1919, new m_id: 1952)
      [ouster_driver-1] [1707077292894975928] missing 6 packets (last m_id: 2687, new m_id: 2784
      
  5. mode: 512x20 @ RNG19_RFL8_SIG16_NIR16 (network data rate: ~130Mbps)

    ouster_ros (this)
    • zero subs: no missing packets

    • one sub: cpu ~20%, no missing packets

    • two subs: cpu ~40%, no missing packets

    • three subs: cpu ~60%, occasional missing packets

      full output from experiment part
      [os_driver-1] [1707079877169056261] missing 6 packets (last m_id: 319, new m_id: 416)
      [os_driver-1] [1707079891245717676] missing 22 packets (last m_id: 95, new m_id: 448)
      
    • four subs: cpu ~70%, continuous missing packets - visualization starts breaking

      output sample
      [os_driver-1] [1707079990162413059] missing 16 packets (last m_id: 31, new m_id: 288)
      [os_driver-1] [1707079990162549506] missing 20 packets (last m_id: 15, new m_id: 336)
      [os_driver-1] [1707079990429121231] missing 1 whole frames (last f_id: 5083, new f_id: 5085)
      [os_driver-1] [1707079990579389008] missing 1 whole frames (last f_id: 5088, new f_id: 5090)
      [os_driver-1] [1707079991133279503] missing 3 packets (last m_id: 31, new m_id: 80)
      [os_driver-1] [1707079991230620402] missing 2 packets (last m_id: 15, new m_id: 48)
      [os_driver-1] [1707079991326283852] missing 2 packets (last m_id: 447, new m_id: 480)
      [os_driver-1] [1707079991547120260] missing 7 packets (last m_id: 63, new m_id: 176)
      [os_driver-1] [1707079991654417204] missing 8 packets (last m_id: 127, new m_id: 256)
      [os_driver-1] [1707079991907875534] missing 5 packets (last m_id: 207, new m_id: 288)
      
    • five subs: cpu ~70%, continuous missing packets - visualization broken

      output sample
      [os_driver-1] [1707080019175668849] missing 1 whole frames (last f_id: 5658, new f_id: 5660)
      [os_driver-1] [1707080019890608918] missing 3 whole frames (last f_id: 5670, new f_id: 5674)
      [os_driver-1] [1707080020368263686] missing 2 whole frames (last f_id: 5681, new f_id: 5684)
      [os_driver-1] [1707080020368560585] missing 8 packets (last m_id: 223, new m_id: 352)
      [os_driver-1] [1707080020581335754] missing 2 whole frames (last f_id: 5687, new f_id: 5690)
      [os_driver-1] [1707080020767527945] missing 17 packets (last m_id: 111, new m_id: 384)
      [os_driver-1] [1707080021010108856] missing 1 whole frames (last f_id: 5695, new f_id: 5697)
      [os_driver-1] [1707080021072943285] missing 8 packets (last m_id: 159, new m_id: 288)
      [os_driver-1] [1707080021073610815] missing 12 packets (last m_id: 255, new m_id: 448)
      [os_driver-1] [1707080021315849444] missing 1 whole frames (last f_id: 5701, new f_id: 5703)
      
    ros2_ouster (modified-community)
    • zero subs: no missing packets

    • one sub: cpu ~30%

    • two subs: cpu ~40%

    • three subs: cpu ~60%

    • four subs: cpu ~70%

    • five subs: cpu ~70% whole cloud flickers every ~6s, but doesn't break

    • occasional mising packets hapenning randomly throughout the duration (no correlation with subscriber count)

      full output from whole experiment
      [ouster_driver-1] [1707077561991250619] missing 4 packets (last m_id: 111, new m_id: 176)
      [ouster_driver-1] [1707077582970131509] missing 2 packets (last m_id: 463, new m_id: 496)
      [ouster_driver-1] [1707077596967432418] missing 2 packets (last m_id: 463, new m_id: 496)
      

I don't have any pretty graphs for this (that would be too much work), but there seems to be some correlation between the packet losses and cpu usage, as well as, the data rate. Sometimes the missing section always starts from the exact same id - these are the consistent missing chunks situations. But once packets start missing randomly, the whole visualization breaks apart. With the community version, there are practically no continuous missing events and the cloud visualization never breaks down. Also, I'm not sure if there's any correlation with the network connection path (at least from my side). The routers were not reporting any dropped packets or routing errors, and I also connected the lidar directly to the pc with a static IP and the behavior is exactly the same. These were my first naive assumptions about what could be happening:

  1. The scan batcher accumulation logic is different in the community version, so maybe some packets are being lost here.
    • I've ported the logic of ScanBatcher::operator()() from the community version, using data swap operations instead of the recurrent calls and there was no change in behavior. And the missing packets seem to never actually arrive at the socket, before any processing can even happen.
  2. Maybe the ring buffer gets filled and the missing packets are overwritten in the write_overwrite() calls.
    • When printing out the states of read_/write_idx and active_items_count, they are always way below the max capacity even during the missing packet events. And switching between write() or write_overwrite() methods in OusterSensor::handle_lidar_packet() makes no difference, packets are still missing.
  3. Maybe there's some difference in how the binaries are built or how the threads are created.
    • Refactoring the connection and processing thread initializations in OusterSensor::start_packet_processing_threads() and OusterSensor::start_sensor_connection_thread() from unique pointers with lambdas to the old style std::bind() calls made no difference.
    • Compiling the whole driver node as a classic standalone executable instead of the cool ros2 component macros also made no difference.

What I see for now is:

  1. There is something different in the community implementation that doesn't create these missing packet events.
  2. The events somehow relate to cpu load and data rate - maybe some system calls are being handled differently?

@Samahu
Copy link
Contributor

Samahu commented Feb 8, 2024

@Imaniac230 thanks for your detailed report, this very helpful. When porting the ROS1 driver to ROS2 and implementing the combined node I haven't tested its behavior with multiple subscribers at work hence I haven't noted this issue. I think one notable difference is that the community driver utilize a lock-free ring buffer which definitely has better advantages over the current ThreadSafeRingBuffer implementation, it was my intention to switch to lock-free implementation per my comment but I considered this an optimization and deferred it to later. This may not be the sole problem but a lock-free implementation - if done right - would perform better since it doesn't need to hold a lock on every push or pop of items.

Another thing is I never actually checked or performed a benchmark on the queue length and how often it gets filled. As you have noted in your report that with a single subscriber there isn't any missing packets so the allocated buffers seem to work just fine.

There is also one factor which I would be curious if you took a look during the comparison, when comparing my implementation vs the community driver - using a single subscriber - it was note worthy to me that the community driver had less CPU utilization but at the same time it had less frequency of publishing point clouds as the LidarMode increased link to plots.

@andre-nguyen
Copy link

Adding a data point here, I have two Lenovo Thinkpad laptops (different models) running ubuntu 22 with ROS Humble. I can see missing packets on one but not the other. Funnily enough, the laptop where everything works is an older model with a weaker processor.

I wonder if this is related to the network adapter in use? Maybe just a fluke?

@Samahu
Copy link
Contributor

Samahu commented Feb 12, 2024

Thanks all for the valuable feedback, I have identified the problem and will be working on a fix soon. The issue stems when the buffer read operation takes more time than available window before we receive another packet. If this happens then we'd run into the problem. Since I perform packet processing and publishing in the same thread that reads packets that problem will be exacerbated when having more than one subscriber to the point clouds node. I will work on a fix to address the issue very soon.

@Imaniac230
Copy link

Imaniac230 commented Feb 14, 2024

There is also one factor which I would be curious if you took a look during the comparison, when comparing my implementation vs the community driver - using a single subscriber - it was note worthy to me that the community driver had less CPU utilization but at the same time it had less frequency of publishing point clouds as the LidarMode increased link to plots.

Regarding the topic rates, I've taken a quick look at the pointcloud topic from both implementations (just with the ros2 topic hz tool, waiting for at least 100 samples). First I had just the hz tool being the only subscriber, and then also with an rviz subscription running. In all cases, both implementations always seemed to reach the desired rates (for all the lidar modes, and using profile RNG19_RFL8_SIG16_NIR16). So as far as my testing goes, I haven't seen any of the huge drops to 5 Hz with the community version.

The rates do start to drop as more subscribers (4-5) are being added, but it is the same for both implementations.

@Imaniac230
Copy link

Thanks all for the valuable feedback, I have identified the problem and will be working on a fix soon. The issue stems when the buffer read operation takes more time than available window before we receive another packet. If this happens then we'd run into the problem. Since I perform packet processing and publishing in the same thread that reads packets that problem will be exacerbated when having more than one subscriber to the point clouds node. I will work on a fix to address the issue very soon.

It's also interesting to me that the problem relates to the buffer read operation (that is the ring buffer I assume). The missing packet counting that I have been performing was done directly at the write events. If I understand correctly, that should be the first moment a packet arrives from the sensor before any read and processing even takes place. So there shouldn't even be anything to read, since the missing packets were never written into the buffer in the first place.

@RYO0115
Copy link

RYO0115 commented Feb 16, 2024

This issue also happend with OS1-128 and OS2-128 Rev7 with Ubuntu 20.04 & ROS noetic.

I have changed harness and power supply but won't fix.
But weird thing is that sometimes this data loss won't happen.

Seems like thread timing issue so I estimate that CPU usage is the key, but any updates or way to deal with this?

@Imaniac230
Copy link

Imaniac230 commented Feb 19, 2024

After another batch of experiments, I think there two separate problems.

  1. The missing incoming raw packets don't even get written into the buffer, so they are missing completely from the accumulated cloud. We're never overflowing the buffer because we're not even writing the packets into it (probably caused by the lock creation overhead, as you mention here Missing lidar chunk os1-128-u  #240 (comment)).
  2. If the read callback operations are substantially slower that the write operations, then we should start overflowing the buffer, what I think is what you mention here Missing lidar chunk os1-128-u  #240 (comment). But this will only happen if the first problem is resolved, otherwise this never happens.

If we keep track of the read and write operations and print their difference for ex. like this:

lidar_packets->read([this](const uint8_t* buffer) {
                readCounter += 1;
                uint64_t counterMax = UINT64_MAX;
                readCounter.compare_exchange_strong(counterMax, 0);
                const uint64_t counterDiff = writeCounter.load() - readCounter.load();
                if (counterDiff > 0) {
                  std::cout << "unprocessed packets: " << counterDiff << " (written: " << writeCounter.load() << ", read: " << readCounter.load() << ")" << std::endl;
                  //std::cout << "buffer active items: " << lidar_packets->size() << std::endl;
                }

                on_lidar_packet_msg(buffer);
            });

It wouldn't be possible to call the lidar_packets->size() directly, since it would cause a dead-lock. But the resulting difference gives us the same thing.

and, again, add the same thing to the community implementation, then we get the following output:

  • CPU: AMD Ryzen 7 3700X @ 4GHz
  • mode: 1024x20 @ RNG19_RFL8_SIG16_NIR16 (network data rate: ~260Mbps)
    • ouster_ros (this)

      zero subs,
      [os_driver-1] unprocessed packets: 1 (written: 1491, read: 1490)
      [os_driver-1] unprocessed packets: 5 (written: 1497, read: 1492)
      [os_driver-1] unprocessed packets: 4 (written: 1497, read: 1493)
      [os_driver-1] unprocessed packets: 3 (written: 1497, read: 1494)
      [os_driver-1] unprocessed packets: 2 (written: 1497, read: 1495)
      [os_driver-1] unprocessed packets: 1 (written: 1497, read: 1496)
      [os_driver-1] unprocessed packets: 2 (written: 1556, read: 1554)
      [os_driver-1] unprocessed packets: 1 (written: 1556, read: 1555)
      
      one sub,
      [os_driver-1] unprocessed packets: 1 (written: 3482, read: 3481)
      [os_driver-1] [1708368385378405204] missing 14 packets (last m_id: 191, new m_id: 416, time diff:     450404 ns)
      [os_driver-1] unprocessed packets: 1 (written: 3483, read: 3482)
      [os_driver-1] [1708368385428436651] missing 14 packets (last m_id: 191, new m_id: 416, time diff:       7674 ns)
      [os_driver-1] unprocessed packets: 8 (written: 3533, read: 3525)
      [os_driver-1] unprocessed packets: 7 (written: 3533, read: 3526)
      [os_driver-1] unprocessed packets: 6 (written: 3533, read: 3527)
      [os_driver-1] unprocessed packets: 5 (written: 3533, read: 3528)
      [os_driver-1] unprocessed packets: 4 (written: 3533, read: 3529)
      [os_driver-1] unprocessed packets: 3 (written: 3533, read: 3530)
      [os_driver-1] unprocessed packets: 2 (written: 3533, read: 3531)
      [os_driver-1] unprocessed packets: 1 (written: 3533, read: 3532)
      [os_driver-1] unprocessed packets: 8 (written: 3582, read: 3574)
      [os_driver-1] unprocessed packets: 7 (written: 3582, read: 3575)
      
      two subs,
      [os_driver-1] unprocessed packets: 1 (written: 1916, read: 1915)
      [os_driver-1] [1708368460842251588] missing 44 packets (last m_id: 191, new m_id: 896, time diff:     260444 ns)
      [os_driver-1] unprocessed packets: 1 (written: 1917, read: 1916)
      [os_driver-1] unprocessed packets: 7 (written: 1936, read: 1929)
      [os_driver-1] unprocessed packets: 6 (written: 1936, read: 1930)
      [os_driver-1] unprocessed packets: 5 (written: 1936, read: 1931)
      [os_driver-1] unprocessed packets: 4 (written: 1936, read: 1932)
      [os_driver-1] unprocessed packets: 3 (written: 1936, read: 1933)
      [os_driver-1] unprocessed packets: 2 (written: 1936, read: 1934)
      [os_driver-1] unprocessed packets: 1 (written: 1936, read: 1935)
      [os_driver-1] [1708368460893804972] missing 46 packets (last m_id: 191, new m_id: 928, time diff:     650945 ns)
      [os_driver-1] unprocessed packets: 1 (written: 1937, read: 1936)
      [os_driver-1] unprocessed packets: 3 (written: 1954, read: 1951)
      
      three subs,
      [os_driver-1] unprocessed packets: 1 (written: 223, read: 222)
      [os_driver-1] [1708368537018464767] missing 1 whole frames (last f_id: 104, new f_id: 106, time diff:   65132110 ns)
      [os_driver-1] unprocessed packets: 1 (written: 224, read: 223)
      [os_driver-1] unprocessed packets: 5 (written: 241, read: 236)
      [os_driver-1] unprocessed packets: 4 (written: 241, read: 237)
      [os_driver-1] unprocessed packets: 3 (written: 241, read: 238)
      [os_driver-1] unprocessed packets: 2 (written: 241, read: 239)
      [os_driver-1] unprocessed packets: 1 (written: 241, read: 240)
      [os_driver-1] [1708368537209563774] missing 1 whole frames (last f_id: 108, new f_id: 110, time diff:      41388 ns)
      [os_driver-1] unprocessed packets: 1 (written: 245, read: 244)
      [os_driver-1] unprocessed packets: 1 (written: 257, read: 256)
      [os_driver-1] unprocessed packets: 1 (written: 264, read: 263)
      [os_driver-1] [1708368537463990670] missing 1 whole frames (last f_id: 113, new f_id: 115, time diff:     106252 ns)
      [os_driver-1] unprocessed packets: 1 (written: 267, read: 266)
      [os_driver-1] unprocessed packets: 1 (written: 268, read: 267)
      [os_driver-1] [1708368537906422404] missing 2 whole frames (last f_id: 121, new f_id: 124, time diff:      62639 ns)
      [os_driver-1] unprocessed packets: 1 (written: 300, read: 299)
      [os_driver-1] unprocessed packets: 1 (written: 321, read: 320)
      
    • ros2_ouster (modified-community)

      zero subs,
      [ouster_driver-1] unprocessed packets: 6 (written: 5090, read: 5084)
      [ouster_driver-1] unprocessed packets: 5 (written: 5090, read: 5085)
      [ouster_driver-1] unprocessed packets: 4 (written: 5090, read: 5086)
      [ouster_driver-1] unprocessed packets: 3 (written: 5090, read: 5087)
      [ouster_driver-1] unprocessed packets: 2 (written: 5090, read: 5088)
      [ouster_driver-1] unprocessed packets: 1 (written: 5090, read: 5089)
      [ouster_driver-1] unprocessed packets: 5 (written: 5153, read: 5148)
      [ouster_driver-1] unprocessed packets: 4 (written: 5153, read: 5149)
      [ouster_driver-1] unprocessed packets: 3 (written: 5153, read: 5150)
      [ouster_driver-1] unprocessed packets: 2 (written: 5153, read: 5151)
      [ouster_driver-1] unprocessed packets: 1 (written: 5153, read: 5152)
      [ouster_driver-1] unprocessed packets: 5 (written: 5217, read: 5212)
      
      one sub,
      [ouster_driver-1] unprocessed packets: 1 (written: 2659, read: 2658)
      [ouster_driver-1] unprocessed packets: 32 (written: 2720, read: 2688)
      [ouster_driver-1] unprocessed packets: 31 (written: 2720, read: 2689)
      [ouster_driver-1] unprocessed packets: 30 (written: 2720, read: 2690)
      [ouster_driver-1] unprocessed packets: 29 (written: 2720, read: 2691)
      [ouster_driver-1] unprocessed packets: 28 (written: 2720, read: 2692)
      [ouster_driver-1] unprocessed packets: 27 (written: 2720, read: 2693)
      [ouster_driver-1] unprocessed packets: 26 (written: 2720, read: 2694)
      [ouster_driver-1] unprocessed packets: 25 (written: 2720, read: 2695)
      [ouster_driver-1] unprocessed packets: 24 (written: 2720, read: 2696)
      [ouster_driver-1] unprocessed packets: 23 (written: 2720, read: 2697)
      [ouster_driver-1] unprocessed packets: 22 (written: 2720, read: 2698)
      [ouster_driver-1] unprocessed packets: 21 (written: 2720, read: 2699)
      [ouster_driver-1] unprocessed packets: 20 (written: 2720, read: 2700)
      [ouster_driver-1] unprocessed packets: 19 (written: 2720, read: 2701)
      [ouster_driver-1] unprocessed packets: 18 (written: 2720, read: 2702)
      [ouster_driver-1] unprocessed packets: 17 (written: 2720, read: 2703)
      [ouster_driver-1] unprocessed packets: 16 (written: 2720, read: 2704)
      [ouster_driver-1] unprocessed packets: 16 (written: 2721, read: 2705)
      [ouster_driver-1] unprocessed packets: 15 (written: 2721, read: 2706)
      [ouster_driver-1] unprocessed packets: 14 (written: 2721, read: 2707)
      [ouster_driver-1] unprocessed packets: 13 (written: 2721, read: 2708)
      [ouster_driver-1] unprocessed packets: 12 (written: 2721, read: 2709)
      [ouster_driver-1] unprocessed packets: 11 (written: 2721, read: 2710)
      [ouster_driver-1] unprocessed packets: 10 (written: 2721, read: 2711)
      [ouster_driver-1] unprocessed packets: 9 (written: 2721, read: 2712)
      [ouster_driver-1] unprocessed packets: 8 (written: 2721, read: 2713)
      [ouster_driver-1] unprocessed packets: 7 (written: 2721, read: 2714)
      [ouster_driver-1] unprocessed packets: 6 (written: 2721, read: 2715)
      [ouster_driver-1] unprocessed packets: 5 (written: 2721, read: 2716)
      [ouster_driver-1] unprocessed packets: 4 (written: 2721, read: 2717)
      [ouster_driver-1] unprocessed packets: 3 (written: 2721, read: 2718)
      [ouster_driver-1] unprocessed packets: 2 (written: 2721, read: 2719)
      [ouster_driver-1] unprocessed packets: 1 (written: 2721, read: 2720)
      [ouster_driver-1] unprocessed packets: 27 (written: 2779, read: 2752)
      
      two subs,
      [ouster_driver-1] unprocessed packets: 1 (written: 14050, read: 14049)
      [ouster_driver-1] unprocessed packets: 53 (written: 14112, read: 14059)
      [ouster_driver-1] unprocessed packets: 52 (written: 14112, read: 14060)
      [ouster_driver-1] unprocessed packets: 51 (written: 14112, read: 14061)
      [ouster_driver-1] unprocessed packets: 50 (written: 14112, read: 14062)
      [ouster_driver-1] unprocessed packets: 49 (written: 14112, read: 14063)
      [ouster_driver-1] unprocessed packets: 48 (written: 14112, read: 14064)
      [ouster_driver-1] unprocessed packets: 47 (written: 14112, read: 14065)
      [ouster_driver-1] unprocessed packets: 46 (written: 14112, read: 14066)
      [ouster_driver-1] unprocessed packets: 45 (written: 14112, read: 14067)
      [ouster_driver-1] unprocessed packets: 44 (written: 14112, read: 14068)
      [ouster_driver-1] unprocessed packets: 43 (written: 14112, read: 14069)
      [ouster_driver-1] unprocessed packets: 42 (written: 14112, read: 14070)
      [ouster_driver-1] unprocessed packets: 41 (written: 14112, read: 14071)
      [ouster_driver-1] unprocessed packets: 40 (written: 14112, read: 14072)
      [ouster_driver-1] unprocessed packets: 39 (written: 14112, read: 14073)
      [ouster_driver-1] unprocessed packets: 38 (written: 14112, read: 14074)
      [ouster_driver-1] unprocessed packets: 37 (written: 14112, read: 14075)
      [ouster_driver-1] unprocessed packets: 36 (written: 14112, read: 14076)
      [ouster_driver-1] unprocessed packets: 35 (written: 14112, read: 14077)
      [ouster_driver-1] unprocessed packets: 34 (written: 14112, read: 14078)
      [ouster_driver-1] unprocessed packets: 33 (written: 14112, read: 14079)
      [ouster_driver-1] unprocessed packets: 32 (written: 14112, read: 14080)
      [ouster_driver-1] unprocessed packets: 31 (written: 14112, read: 14081)
      [ouster_driver-1] unprocessed packets: 30 (written: 14112, read: 14082)
      [ouster_driver-1] unprocessed packets: 29 (written: 14112, read: 14083)
      [ouster_driver-1] unprocessed packets: 28 (written: 14112, read: 14084)
      [ouster_driver-1] unprocessed packets: 27 (written: 14112, read: 14085)
      [ouster_driver-1] unprocessed packets: 26 (written: 14112, read: 14086)
      [ouster_driver-1] unprocessed packets: 25 (written: 14112, read: 14087)
      [ouster_driver-1] unprocessed packets: 24 (written: 14112, read: 14088)
      [ouster_driver-1] unprocessed packets: 23 (written: 14112, read: 14089)
      [ouster_driver-1] unprocessed packets: 22 (written: 14112, read: 14090)
      [ouster_driver-1] unprocessed packets: 22 (written: 14113, read: 14091)
      [ouster_driver-1] unprocessed packets: 21 (written: 14113, read: 14092)
      [ouster_driver-1] unprocessed packets: 20 (written: 14113, read: 14093)
      [ouster_driver-1] unprocessed packets: 19 (written: 14113, read: 14094)
      [ouster_driver-1] unprocessed packets: 18 (written: 14113, read: 14095)
      [ouster_driver-1] unprocessed packets: 17 (written: 14113, read: 14096)
      [ouster_driver-1] unprocessed packets: 16 (written: 14113, read: 14097)
      [ouster_driver-1] unprocessed packets: 15 (written: 14113, read: 14098)
      [ouster_driver-1] unprocessed packets: 14 (written: 14113, read: 14099)
      [ouster_driver-1] unprocessed packets: 13 (written: 14113, read: 14100)
      [ouster_driver-1] unprocessed packets: 12 (written: 14113, read: 14101)
      [ouster_driver-1] unprocessed packets: 11 (written: 14113, read: 14102)
      [ouster_driver-1] unprocessed packets: 10 (written: 14113, read: 14103)
      [ouster_driver-1] unprocessed packets: 9 (written: 14113, read: 14104)
      [ouster_driver-1] unprocessed packets: 8 (written: 14113, read: 14105)
      [ouster_driver-1] unprocessed packets: 7 (written: 14113, read: 14106)
      [ouster_driver-1] unprocessed packets: 6 (written: 14113, read: 14107)
      [ouster_driver-1] unprocessed packets: 5 (written: 14113, read: 14108)
      [ouster_driver-1] unprocessed packets: 4 (written: 14113, read: 14109)
      [ouster_driver-1] unprocessed packets: 3 (written: 14113, read: 14110)
      [ouster_driver-1] unprocessed packets: 3 (written: 14114, read: 14111)
      [ouster_driver-1] unprocessed packets: 2 (written: 14114, read: 14112)
      [ouster_driver-1] unprocessed packets: 1 (written: 14114, read: 14113)
      [ouster_driver-1] unprocessed packets: 53 (written: 14176, read: 14123)
      [ouster_driver-1] unprocessed packets: 52 (written: 14176, read: 14124)
      
      three subs,
      [ouster_driver-1] unprocessed packets: 1002 (written: 4259, read: 3257)
      [ouster_driver-1] unprocessed packets: 1001 (written: 4259, read: 3258)
      [ouster_driver-1] unprocessed packets: 1000 (written: 4259, read: 3259)
      [ouster_driver-1] unprocessed packets: 999 (written: 4259, read: 3260)
      [ouster_driver-1] unprocessed packets: 998 (written: 4259, read: 3261)
      [ouster_driver-1] unprocessed packets: 998 (written: 4260, read: 3262)
      [ouster_driver-1] unprocessed packets: 997 (written: 4260, read: 3263)
      [ouster_driver-1] unprocessed packets: 996 (written: 4260, read: 3264)
      [ouster_driver-1] unprocessed packets: 995 (written: 4260, read: 3265)
      [ouster_driver-1] unprocessed packets: 994 (written: 4260, read: 3266)
      [ouster_driver-1] unprocessed packets: 993 (written: 4260, read: 3267)
      [ouster_driver-1] unprocessed packets: 992 (written: 4260, read: 3268)
      [ouster_driver-1] unprocessed packets: 991 (written: 4260, read: 3269)
      [ouster_driver-1] unprocessed packets: 990 (written: 4260, read: 3270)
      [ouster_driver-1] unprocessed packets: 989 (written: 4260, read: 3271)
      [ouster_driver-1] unprocessed packets: 988 (written: 4260, read: 3272)
      [ouster_driver-1] unprocessed packets: 987 (written: 4260, read: 3273)
      [ouster_driver-1] unprocessed packets: 986 (written: 4260, read: 3274)
      [ouster_driver-1] unprocessed packets: 985 (written: 4260, read: 3275)
      [ouster_driver-1] unprocessed packets: 984 (written: 4260, read: 3276)
      [ouster_driver-1] unprocessed packets: 983 (written: 4260, read: 3277)
      [ouster_driver-1] unprocessed packets: 982 (written: 4260, read: 3278)
      [ouster_driver-1] unprocessed packets: 981 (written: 4260, read: 3279)
      [ouster_driver-1] unprocessed packets: 980 (written: 4260, read: 3280)
      [ouster_driver-1] unprocessed packets: 979 (written: 4260, read: 3281)
      [ouster_driver-1] unprocessed packets: 978 (written: 4260, read: 3282)
      [ouster_driver-1] unprocessed packets: 977 (written: 4260, read: 3283)
      [ouster_driver-1] unprocessed packets: 976 (written: 4260, read: 3284)
      [ouster_driver-1] unprocessed packets: 976 (written: 4261, read: 3285)
      [ouster_driver-1] unprocessed packets: 975 (written: 4261, read: 3286)
      [ouster_driver-1] unprocessed packets: 974 (written: 4261, read: 3287)
      [ouster_driver-1] unprocessed packets: 973 (written: 4261, read: 3288)
      [ouster_driver-1] unprocessed packets: 972 (written: 4261, read: 3289)
      [ouster_driver-1] unprocessed packets: 971 (written: 4261, read: 3290)
      [ouster_driver-1] unprocessed packets: 970 (written: 4261, read: 3291)
      [ouster_driver-1] unprocessed packets: 969 (written: 4261, read: 3292)
      [ouster_driver-1] unprocessed packets: 968 (written: 4261, read: 3293)
      [ouster_driver-1] unprocessed packets: 967 (written: 4261, read: 3294)
      [ouster_driver-1] unprocessed packets: 966 (written: 4261, read: 3295)
      [ouster_driver-1] unprocessed packets: 965 (written: 4261, read: 3296)
      [ouster_driver-1] unprocessed packets: 964 (written: 4261, read: 3297)
      [ouster_driver-1] unprocessed packets: 963 (written: 4261, read: 3298)
      [ouster_driver-1] unprocessed packets: 962 (written: 4261, read: 3299)
      [ouster_driver-1] unprocessed packets: 961 (written: 4261, read: 3300)
      [ouster_driver-1] unprocessed packets: 1037 (written: 4338, read: 3301)
      [ouster_driver-1] unprocessed packets: 1115 (written: 4417, read: 3302)
      [ouster_driver-1] unprocessed packets: 1114 (written: 4417, read: 3303)
      [ouster_driver-1] unprocessed packets: 1113 (written: 4417, read: 3304)
      [ouster_driver-1] unprocessed packets: 1112 (written: 4417, read: 3305)
      [ouster_driver-1] unprocessed packets: 1111 (written: 4417, read: 3306)
      [ouster_driver-1] unprocessed packets: 1110 (written: 4417, read: 3307)
      [ouster_driver-1] unprocessed packets: 1109 (written: 4417, read: 3308)
      [ouster_driver-1] unprocessed packets: 1108 (written: 4417, read: 3309)
      [ouster_driver-1] unprocessed packets: 1107 (written: 4417, read: 3310)
      [ouster_driver-1] unprocessed packets: 1106 (written: 4417, read: 3311)
      [ouster_driver-1] unprocessed packets: 1105 (written: 4417, read: 3312)
      [ouster_driver-1] unprocessed packets: 1104 (written: 4417, read: 3313)
      [ouster_driver-1] unprocessed packets: 1103 (written: 4417, read: 3314)
      [ouster_driver-1] unprocessed packets: 1102 (written: 4417, read: 3315)
      [ouster_driver-1] unprocessed packets: 1101 (written: 4417, read: 3316)
      [ouster_driver-1] unprocessed packets: 1100 (written: 4417, read: 3317)
      [ouster_driver-1] unprocessed packets: 1099 (written: 4417, read: 3318)
      [ouster_driver-1] unprocessed packets: 1098 (written: 4417, read: 3319)
      [ouster_driver-1] unprocessed packets: 1097 (written: 4417, read: 3320)
      [ouster_driver-1] unprocessed packets: 1096 (written: 4417, read: 3321)
      [ouster_driver-1] unprocessed packets: 1095 (written: 4417, read: 3322)
      [ouster_driver-1] unprocessed packets: 1095 (written: 4418, read: 3323)
      

The community driver does slowly overflow the buffer once the third subscriber is started. In fact, the flickering that I mentioned in my previous tests is caused by the writer periodically overtaking the reader with overwritten data. In this driver, the buffer never overflows, because the packets are never written into it. We're just gradually dropping more and more of them.

If the ringbuffer is refactored with:

  1. using only atomic operations to manipulate the indexes and active items count
  2. instead of creating a new unique_lock variable each time we enter the callback, we create the lock variable as a class member and the callbacks only perform lock() and unlock() operations on it

then the missing packets no longer occur and it starts behaving the same way as the community implementation. These are the modified callbacks that I am using:

template <typename BufferReadFn>
    void read(BufferReadFn&& buffer_read) {
        new_data_lock.lock();
        new_data_condition.wait(new_data_lock, [this] { return active_items_count.load() > 0; });
        new_data_lock.unlock();
        buffer_read(&buffer[read_idx.load() * item_size]);
        read_idx += 1;
        size_t c = capacity();
        read_idx.compare_exchange_strong(c, 0);
        --active_items_count;
        free_space_condition.notify_one();
    }
template <class BufferWriteFn>
    void write_overwrite(BufferWriteFn&& buffer_write) {
        buffer_write(&buffer[write_idx.load() * item_size]);
        write_idx += 1;
        size_t c = capacity();
        write_idx.compare_exchange_strong(c, 0);
        if (active_items_count.load() < capacity()) ++active_items_count;
        new_data_condition.notify_all();
    }

The members are:

std::vector<uint8_t> buffer;

const size_t item_size;
const size_t max_items_count;

std::atomic_size_t active_items_count;
std::atomic_size_t write_idx;
std::atomic_size_t read_idx;

std::mutex mutex;
std::condition_variable new_data_condition;
std::unique_lock<std::mutex> new_data_lock;
std::condition_variable free_space_condition;
std::unique_lock<std::mutex> free_space_lock;
  • CPU: AMD Ryzen 7 3700X @ 4GHz
  • mode: 1024x20 @ RNG19_RFL8_SIG16_NIR16 (network data rate: ~260Mbps)

The lidar_packets->size() method can now also be called without causing dead-locks and we can see that my counting does correlate with the actual buffer state.

  • ouster_ros (this with refactored ringbuffer)

    zero subs,
    [os_driver-1] unprocessed packets: 1 (written: 6086, read: 6085)
    [os_driver-1] buffer active items: 2
    [os_driver-1] unprocessed packets: 6 (written: 6154, read: 6148)
    [os_driver-1] buffer active items: 7
    [os_driver-1] unprocessed packets: 5 (written: 6154, read: 6149)
    [os_driver-1] buffer active items: 6
    [os_driver-1] unprocessed packets: 4 (written: 6154, read: 6150)
    [os_driver-1] buffer active items: 5
    [os_driver-1] unprocessed packets: 3 (written: 6154, read: 6151)
    [os_driver-1] buffer active items: 4
    [os_driver-1] unprocessed packets: 2 (written: 6154, read: 6152)
    [os_driver-1] buffer active items: 3
    [os_driver-1] unprocessed packets: 2 (written: 6155, read: 6153)
    [os_driver-1] buffer active items: 3
    [os_driver-1] unprocessed packets: 1 (written: 6155, read: 6154)
    [os_driver-1] buffer active items: 2
    [os_driver-1] unprocessed packets: 2 (written: 6214, read: 6212)
    [os_driver-1] buffer active items: 3
    [os_driver-1] unprocessed packets: 1 (written: 6214, read: 6213)
    
    one sub,
    [os_driver-1] unprocessed packets: 1 (written: 4427, read: 4426)
    [os_driver-1] buffer active items: 2
    [os_driver-1] unprocessed packets: 24 (written: 4491, read: 4467)
    [os_driver-1] buffer active items: 25
    [os_driver-1] unprocessed packets: 23 (written: 4491, read: 4468)
    [os_driver-1] buffer active items: 24
    [os_driver-1] unprocessed packets: 22 (written: 4491, read: 4469)
    [os_driver-1] buffer active items: 23
    [os_driver-1] unprocessed packets: 21 (written: 4491, read: 4470)
    [os_driver-1] buffer active items: 22
    [os_driver-1] unprocessed packets: 20 (written: 4491, read: 4471)
    [os_driver-1] buffer active items: 21
    [os_driver-1] unprocessed packets: 19 (written: 4491, read: 4472)
    [os_driver-1] buffer active items: 20
    [os_driver-1] unprocessed packets: 18 (written: 4491, read: 4473)
    [os_driver-1] buffer active items: 19
    [os_driver-1] unprocessed packets: 17 (written: 4491, read: 4474)
    [os_driver-1] buffer active items: 18
    [os_driver-1] unprocessed packets: 16 (written: 4491, read: 4475)
    [os_driver-1] buffer active items: 17
    [os_driver-1] unprocessed packets: 15 (written: 4491, read: 4476)
    [os_driver-1] buffer active items: 16
    [os_driver-1] unprocessed packets: 14 (written: 4491, read: 4477)
    [os_driver-1] buffer active items: 15
    [os_driver-1] unprocessed packets: 13 (written: 4491, read: 4478)
    [os_driver-1] buffer active items: 14
    [os_driver-1] unprocessed packets: 12 (written: 4491, read: 4479)
    [os_driver-1] buffer active items: 13
    [os_driver-1] unprocessed packets: 11 (written: 4491, read: 4480)
    [os_driver-1] buffer active items: 12
    [os_driver-1] unprocessed packets: 10 (written: 4491, read: 4481)
    [os_driver-1] buffer active items: 11
    [os_driver-1] unprocessed packets: 9 (written: 4491, read: 4482)
    [os_driver-1] buffer active items: 10
    [os_driver-1] unprocessed packets: 8 (written: 4491, read: 4483)
    [os_driver-1] buffer active items: 9
    [os_driver-1] unprocessed packets: 7 (written: 4491, read: 4484)
    [os_driver-1] buffer active items: 8
    [os_driver-1] unprocessed packets: 6 (written: 4491, read: 4485)
    [os_driver-1] buffer active items: 7
    [os_driver-1] unprocessed packets: 5 (written: 4491, read: 4486)
    [os_driver-1] buffer active items: 6
    [os_driver-1] unprocessed packets: 4 (written: 4491, read: 4487)
    [os_driver-1] buffer active items: 5
    [os_driver-1] unprocessed packets: 3 (written: 4491, read: 4488)
    [os_driver-1] buffer active items: 4
    [os_driver-1] unprocessed packets: 2 (written: 4491, read: 4489)
    [os_driver-1] buffer active items: 3
    [os_driver-1] unprocessed packets: 1 (written: 4491, read: 4490)
    [os_driver-1] buffer active items: 2
    [os_driver-1] unprocessed packets: 23 (written: 4554, read: 4531)
    [os_driver-1] buffer active items: 24
    
    two subs,
    [os_driver-1] unprocessed packets: 1 (written: 8323, read: 8322)
    [os_driver-1] buffer active items: 2
    [os_driver-1] unprocessed packets: 56 (written: 8384, read: 8328)
    [os_driver-1] buffer active items: 57
    [os_driver-1] unprocessed packets: 55 (written: 8384, read: 8329)
    [os_driver-1] buffer active items: 56
    [os_driver-1] unprocessed packets: 54 (written: 8384, read: 8330)
    [os_driver-1] buffer active items: 55
    [os_driver-1] unprocessed packets: 53 (written: 8384, read: 8331)
    [os_driver-1] buffer active items: 54
    [os_driver-1] unprocessed packets: 52 (written: 8384, read: 8332)
    [os_driver-1] buffer active items: 53
    [os_driver-1] unprocessed packets: 51 (written: 8384, read: 8333)
    [os_driver-1] buffer active items: 52
    [os_driver-1] unprocessed packets: 50 (written: 8384, read: 8334)
    [os_driver-1] buffer active items: 51
    [os_driver-1] unprocessed packets: 49 (written: 8384, read: 8335)
    [os_driver-1] buffer active items: 50
    [os_driver-1] unprocessed packets: 48 (written: 8384, read: 8336)
    [os_driver-1] buffer active items: 49
    [os_driver-1] unprocessed packets: 47 (written: 8384, read: 8337)
    [os_driver-1] buffer active items: 48
    [os_driver-1] unprocessed packets: 46 (written: 8384, read: 8338)
    [os_driver-1] buffer active items: 47
    [os_driver-1] unprocessed packets: 45 (written: 8384, read: 8339)
    [os_driver-1] buffer active items: 46
    [os_driver-1] unprocessed packets: 44 (written: 8384, read: 8340)
    [os_driver-1] buffer active items: 45
    [os_driver-1] unprocessed packets: 43 (written: 8384, read: 8341)
    [os_driver-1] buffer active items: 44
    [os_driver-1] unprocessed packets: 42 (written: 8384, read: 8342)
    [os_driver-1] buffer active items: 43
    [os_driver-1] unprocessed packets: 41 (written: 8384, read: 8343)
    [os_driver-1] buffer active items: 42
    [os_driver-1] unprocessed packets: 40 (written: 8384, read: 8344)
    [os_driver-1] buffer active items: 41
    [os_driver-1] unprocessed packets: 39 (written: 8384, read: 8345)
    [os_driver-1] buffer active items: 40
    [os_driver-1] unprocessed packets: 39 (written: 8385, read: 8346)
    [os_driver-1] buffer active items: 40
    [os_driver-1] unprocessed packets: 38 (written: 8385, read: 8347)
    [os_driver-1] buffer active items: 39
    [os_driver-1] unprocessed packets: 37 (written: 8385, read: 8348)
    [os_driver-1] buffer active items: 38
    [os_driver-1] unprocessed packets: 36 (written: 8385, read: 8349)
    [os_driver-1] buffer active items: 37
    [os_driver-1] unprocessed packets: 35 (written: 8385, read: 8350)
    [os_driver-1] buffer active items: 36
    [os_driver-1] unprocessed packets: 34 (written: 8385, read: 8351)
    [os_driver-1] buffer active items: 35
    [os_driver-1] unprocessed packets: 33 (written: 8385, read: 8352)
    [os_driver-1] buffer active items: 34
    [os_driver-1] unprocessed packets: 32 (written: 8385, read: 8353)
    [os_driver-1] buffer active items: 33
    [os_driver-1] unprocessed packets: 31 (written: 8385, read: 8354)
    [os_driver-1] buffer active items: 32
    [os_driver-1] unprocessed packets: 30 (written: 8385, read: 8355)
    [os_driver-1] buffer active items: 31
    [os_driver-1] unprocessed packets: 29 (written: 8385, read: 8356)
    [os_driver-1] buffer active items: 30
    [os_driver-1] unprocessed packets: 28 (written: 8385, read: 8357)
    [os_driver-1] buffer active items: 29
    [os_driver-1] unprocessed packets: 27 (written: 8385, read: 8358)
    [os_driver-1] buffer active items: 28
    [os_driver-1] unprocessed packets: 26 (written: 8385, read: 8359)
    [os_driver-1] buffer active items: 27
    [os_driver-1] unprocessed packets: 25 (written: 8385, read: 8360)
    [os_driver-1] buffer active items: 26
    [os_driver-1] unprocessed packets: 24 (written: 8385, read: 8361)
    [os_driver-1] buffer active items: 25
    [os_driver-1] unprocessed packets: 23 (written: 8385, read: 8362)
    [os_driver-1] buffer active items: 24
    [os_driver-1] unprocessed packets: 22 (written: 8385, read: 8363)
    [os_driver-1] buffer active items: 23
    [os_driver-1] unprocessed packets: 21 (written: 8385, read: 8364)
    [os_driver-1] buffer active items: 22
    [os_driver-1] unprocessed packets: 20 (written: 8385, read: 8365)
    [os_driver-1] buffer active items: 21
    [os_driver-1] unprocessed packets: 19 (written: 8385, read: 8366)
    [os_driver-1] buffer active items: 20
    [os_driver-1] unprocessed packets: 18 (written: 8385, read: 8367)
    [os_driver-1] buffer active items: 19
    [os_driver-1] unprocessed packets: 17 (written: 8385, read: 8368)
    [os_driver-1] buffer active items: 18
    [os_driver-1] unprocessed packets: 16 (written: 8385, read: 8369)
    [os_driver-1] buffer active items: 17
    [os_driver-1] unprocessed packets: 15 (written: 8385, read: 8370)
    [os_driver-1] buffer active items: 16
    [os_driver-1] unprocessed packets: 14 (written: 8385, read: 8371)
    [os_driver-1] buffer active items: 15
    [os_driver-1] unprocessed packets: 13 (written: 8385, read: 8372)
    [os_driver-1] buffer active items: 14
    [os_driver-1] unprocessed packets: 12 (written: 8385, read: 8373)
    [os_driver-1] buffer active items: 13
    [os_driver-1] unprocessed packets: 11 (written: 8385, read: 8374)
    [os_driver-1] buffer active items: 12
    [os_driver-1] unprocessed packets: 10 (written: 8385, read: 8375)
    [os_driver-1] buffer active items: 11
    [os_driver-1] unprocessed packets: 9 (written: 8385, read: 8376)
    [os_driver-1] buffer active items: 10
    [os_driver-1] unprocessed packets: 8 (written: 8385, read: 8377)
    [os_driver-1] buffer active items: 9
    [os_driver-1] unprocessed packets: 7 (written: 8385, read: 8378)
    [os_driver-1] buffer active items: 8
    [os_driver-1] unprocessed packets: 6 (written: 8385, read: 8379)
    [os_driver-1] buffer active items: 7
    [os_driver-1] unprocessed packets: 5 (written: 8385, read: 8380)
    [os_driver-1] buffer active items: 6
    [os_driver-1] unprocessed packets: 4 (written: 8385, read: 8381)
    [os_driver-1] buffer active items: 5
    [os_driver-1] unprocessed packets: 3 (written: 8385, read: 8382)
    [os_driver-1] buffer active items: 4
    [os_driver-1] unprocessed packets: 2 (written: 8385, read: 8383)
    [os_driver-1] buffer active items: 3
    [os_driver-1] unprocessed packets: 1 (written: 8385, read: 8384)
    [os_driver-1] buffer active items: 2
    [os_driver-1] unprocessed packets: 55 (written: 8447, read: 8392)
    [os_driver-1] buffer active items: 56
    
    three subs,
    [os_driver-1] unprocessed packets: 933 (written: 4028, read: 3095)
    [os_driver-1] buffer active items: 934
    [os_driver-1] unprocessed packets: 1013 (written: 4109, read: 3096)
    [os_driver-1] buffer active items: 1014
    [os_driver-1] unprocessed packets: 1012 (written: 4109, read: 3097)
    [os_driver-1] buffer active items: 1013
    [os_driver-1] unprocessed packets: 1011 (written: 4109, read: 3098)
    [os_driver-1] buffer active items: 1012
    [os_driver-1] unprocessed packets: 1010 (written: 4109, read: 3099)
    [os_driver-1] buffer active items: 1011
    [os_driver-1] unprocessed packets: 1009 (written: 4109, read: 3100)
    [os_driver-1] buffer active items: 1010
    [os_driver-1] unprocessed packets: 1008 (written: 4109, read: 3101)
    [os_driver-1] buffer active items: 1009
    [os_driver-1] unprocessed packets: 1007 (written: 4109, read: 3102)
    [os_driver-1] buffer active items: 1008
    [os_driver-1] unprocessed packets: 1006 (written: 4109, read: 3103)
    [os_driver-1] buffer active items: 1007
    [os_driver-1] unprocessed packets: 1005 (written: 4109, read: 3104)
    [os_driver-1] buffer active items: 1006
    [os_driver-1] unprocessed packets: 1004 (written: 4109, read: 3105)
    [os_driver-1] buffer active items: 1005
    [os_driver-1] unprocessed packets: 1003 (written: 4109, read: 3106)
    [os_driver-1] buffer active items: 1004
    [os_driver-1] unprocessed packets: 1002 (written: 4109, read: 3107)
    [os_driver-1] buffer active items: 1003
    [os_driver-1] unprocessed packets: 1001 (written: 4109, read: 3108)
    [os_driver-1] buffer active items: 1002
    [os_driver-1] unprocessed packets: 1000 (written: 4109, read: 3109)
    [os_driver-1] buffer active items: 1001
    [os_driver-1] unprocessed packets: 999 (written: 4109, read: 3110)
    [os_driver-1] buffer active items: 1000
    [os_driver-1] unprocessed packets: 998 (written: 4109, read: 3111)
    [os_driver-1] buffer active items: 999
    [os_driver-1] unprocessed packets: 997 (written: 4109, read: 3112)
    [os_driver-1] buffer active items: 998
    [os_driver-1] unprocessed packets: 996 (written: 4109, read: 3113)
    [os_driver-1] buffer active items: 997
    [os_driver-1] unprocessed packets: 995 (written: 4109, read: 3114)
    [os_driver-1] buffer active items: 996
    [os_driver-1] unprocessed packets: 994 (written: 4109, read: 3115)
    [os_driver-1] buffer active items: 995
    [os_driver-1] unprocessed packets: 993 (written: 4109, read: 3116)
    [os_driver-1] buffer active items: 994
    [os_driver-1] unprocessed packets: 992 (written: 4109, read: 3117)
    [os_driver-1] buffer active items: 993
    [os_driver-1] unprocessed packets: 991 (written: 4109, read: 3118)
    [os_driver-1] buffer active items: 992
    [os_driver-1] unprocessed packets: 990 (written: 4109, read: 3119)
    [os_driver-1] buffer active items: 991
    [os_driver-1] unprocessed packets: 989 (written: 4109, read: 3120)
    [os_driver-1] buffer active items: 990
    [os_driver-1] unprocessed packets: 988 (written: 4109, read: 3121)
    [os_driver-1] buffer active items: 989
    [os_driver-1] unprocessed packets: 987 (written: 4109, read: 3122)
    [os_driver-1] buffer active items: 988
    [os_driver-1] unprocessed packets: 986 (written: 4109, read: 3123)
    [os_driver-1] buffer active items: 987
    [os_driver-1] unprocessed packets: 985 (written: 4109, read: 3124)
    [os_driver-1] buffer active items: 986
    [os_driver-1] unprocessed packets: 984 (written: 4109, read: 3125)
    [os_driver-1] buffer active items: 985
    [os_driver-1] unprocessed packets: 983 (written: 4109, read: 3126)
    [os_driver-1] buffer active items: 984
    [os_driver-1] unprocessed packets: 982 (written: 4109, read: 3127)
    [os_driver-1] buffer active items: 983
    [os_driver-1] unprocessed packets: 981 (written: 4109, read: 3128)
    [os_driver-1] buffer active items: 982
    [os_driver-1] unprocessed packets: 980 (written: 4109, read: 3129)
    [os_driver-1] buffer active items: 981
    [os_driver-1] unprocessed packets: 979 (written: 4109, read: 3130)
    [os_driver-1] buffer active items: 980
    [os_driver-1] unprocessed packets: 978 (written: 4109, read: 3131)
    [os_driver-1] buffer active items: 979
    [os_driver-1] unprocessed packets: 977 (written: 4109, read: 3132)
    [os_driver-1] buffer active items: 978
    [os_driver-1] unprocessed packets: 976 (written: 4109, read: 3133)
    [os_driver-1] buffer active items: 977
    [os_driver-1] unprocessed packets: 975 (written: 4109, read: 3134)
    [os_driver-1] buffer active items: 976
    [os_driver-1] unprocessed packets: 974 (written: 4109, read: 3135)
    [os_driver-1] buffer active items: 975
    [os_driver-1] unprocessed packets: 973 (written: 4109, read: 3136)
    [os_driver-1] buffer active items: 974
    [os_driver-1] unprocessed packets: 972 (written: 4109, read: 3137)
    [os_driver-1] buffer active items: 973
    [os_driver-1] unprocessed packets: 971 (written: 4109, read: 3138)
    [os_driver-1] buffer active items: 972
    [os_driver-1] unprocessed packets: 970 (written: 4109, read: 3139)
    [os_driver-1] buffer active items: 971
    [os_driver-1] unprocessed packets: 969 (written: 4109, read: 3140)
    [os_driver-1] buffer active items: 970
    [os_driver-1] unprocessed packets: 968 (written: 4109, read: 3141)
    [os_driver-1] buffer active items: 969
    [os_driver-1] unprocessed packets: 967 (written: 4109, read: 3142)
    [os_driver-1] buffer active items: 968
    [os_driver-1] unprocessed packets: 966 (written: 4109, read: 3143)
    [os_driver-1] buffer active items: 967
    [os_driver-1] unprocessed packets: 965 (written: 4109, read: 3144)
    [os_driver-1] buffer active items: 966
    [os_driver-1] unprocessed packets: 964 (written: 4109, read: 3145)
    [os_driver-1] buffer active items: 965
    [os_driver-1] unprocessed packets: 964 (written: 4110, read: 3146)
    [os_driver-1] buffer active items: 965
    [os_driver-1] unprocessed packets: 963 (written: 4110, read: 3147)
    [os_driver-1] buffer active items: 964
    [os_driver-1] unprocessed packets: 962 (written: 4110, read: 3148)
    [os_driver-1] buffer active items: 963
    [os_driver-1] unprocessed packets: 961 (written: 4110, read: 3149)
    [os_driver-1] buffer active items: 962
    [os_driver-1] unprocessed packets: 960 (written: 4110, read: 3150)
    [os_driver-1] buffer active items: 961
    [os_driver-1] unprocessed packets: 959 (written: 4110, read: 3151)
    [os_driver-1] buffer active items: 960
    [os_driver-1] unprocessed packets: 958 (written: 4110, read: 3152)
    [os_driver-1] buffer active items: 959
    [os_driver-1] unprocessed packets: 957 (written: 4110, read: 3153)
    [os_driver-1] buffer active items: 958
    [os_driver-1] unprocessed packets: 956 (written: 4110, read: 3154)
    [os_driver-1] buffer active items: 957
    [os_driver-1] unprocessed packets: 955 (written: 4110, read: 3155)
    [os_driver-1] buffer active items: 956
    [os_driver-1] unprocessed packets: 954 (written: 4110, read: 3156)
    [os_driver-1] buffer active items: 955
    [os_driver-1] unprocessed packets: 953 (written: 4110, read: 3157)
    [os_driver-1] buffer active items: 954
    [os_driver-1] unprocessed packets: 952 (written: 4110, read: 3158)
    [os_driver-1] buffer active items: 953
    [os_driver-1] unprocessed packets: 951 (written: 4110, read: 3159)
    [os_driver-1] buffer active items: 952
    [os_driver-1] unprocessed packets: 1031 (written: 4191, read: 3160)
    [os_driver-1] buffer active items: 1023
    [os_driver-1] unprocessed packets: 1112 (written: 4273, read: 3161)
    [os_driver-1] buffer active items: 1023
    [os_driver-1] unprocessed packets: 1111 (written: 4273, read: 3162)
    [os_driver-1] buffer active items: 1022
    [os_driver-1] unprocessed packets: 1110 (written: 4273, read: 3163)
    [os_driver-1] buffer active items: 1021
    [os_driver-1] unprocessed packets: 1109 (written: 4273, read: 3164)
    [os_driver-1] buffer active items: 1020
    [os_driver-1] unprocessed packets: 1108 (written: 4273, read: 3165)
    [os_driver-1] buffer active items: 1019
    [os_driver-1] unprocessed packets: 1107 (written: 4273, read: 3166)
    [os_driver-1] buffer active items: 1018
    [os_driver-1] unprocessed packets: 1106 (written: 4273, read: 3167)
    [os_driver-1] buffer active items: 1017
    [os_driver-1] unprocessed packets: 1105 (written: 4273, read: 3168)
    [os_driver-1] buffer active items: 1016
    [os_driver-1] unprocessed packets: 1104 (written: 4273, read: 3169)
    [os_driver-1] buffer active items: 1015
    [os_driver-1] unprocessed packets: 1103 (written: 4273, read: 3170)
    [os_driver-1] buffer active items: 1014
    [os_driver-1] unprocessed packets: 1102 (written: 4273, read: 3171)
    [os_driver-1] buffer active items: 1013
    [os_driver-1] unprocessed packets: 1101 (written: 4273, read: 3172)
    [os_driver-1] buffer active items: 1012
    [os_driver-1] unprocessed packets: 1100 (written: 4273, read: 3173)
    [os_driver-1] buffer active items: 1011
    [os_driver-1] unprocessed packets: 1099 (written: 4273, read: 3174)
    [os_driver-1] buffer active items: 1010
    [os_driver-1] unprocessed packets: 1098 (written: 4273, read: 3175)
    [os_driver-1] buffer active items: 1009
    [os_driver-1] unprocessed packets: 1097 (written: 4273, read: 3176)
    [os_driver-1] buffer active items: 1008
    [os_driver-1] unprocessed packets: 1096 (written: 4273, read: 3177)
    [os_driver-1] buffer active items: 1007
    [os_driver-1] unprocessed packets: 1095 (written: 4273, read: 3178)
    [os_driver-1] buffer active items: 1006
    [os_driver-1] unprocessed packets: 1094 (written: 4273, read: 3179)
    [os_driver-1] buffer active items: 1005
    [os_driver-1] unprocessed packets: 1093 (written: 4273, read: 3180)
    [os_driver-1] buffer active items: 1004
    [os_driver-1] unprocessed packets: 1092 (written: 4273, read: 3181)
    [os_driver-1] buffer active items: 1003
    [os_driver-1] unprocessed packets: 1091 (written: 4273, read: 3182)
    [os_driver-1] buffer active items: 1002
    [os_driver-1] unprocessed packets: 1090 (written: 4273, read: 3183)
    [os_driver-1] buffer active items: 1001
    [os_driver-1] unprocessed packets: 1089 (written: 4273, read: 3184)
    [os_driver-1] buffer active items: 1000
    [os_driver-1] unprocessed packets: 1088 (written: 4273, read: 3185)
    [os_driver-1] buffer active items: 999
    [os_driver-1] unprocessed packets: 1087 (written: 4273, read: 3186)
    [os_driver-1] buffer active items: 998
    [os_driver-1] unprocessed packets: 1086 (written: 4273, read: 3187)
    [os_driver-1] buffer active items: 997
    [os_driver-1] unprocessed packets: 1085 (written: 4273, read: 3188)
    [os_driver-1] buffer active items: 996
    [os_driver-1] unprocessed packets: 1084 (written: 4273, read: 3189)
    [os_driver-1] buffer active items: 995
    [os_driver-1] unprocessed packets: 1083 (written: 4273, read: 3190)
    [os_driver-1] buffer active items: 994
    [os_driver-1] unprocessed packets: 1082 (written: 4273, read: 3191)
    [os_driver-1] buffer active items: 993
    [os_driver-1] unprocessed packets: 1081 (written: 4273, read: 3192)
    [os_driver-1] buffer active items: 992
    [os_driver-1] unprocessed packets: 1080 (written: 4273, read: 3193)
    [os_driver-1] buffer active items: 991
    [os_driver-1] unprocessed packets: 1080 (written: 4274, read: 3194)
    [os_driver-1] buffer active items: 991
    [os_driver-1] unprocessed packets: 1079 (written: 4274, read: 3195)
    [os_driver-1] buffer active items: 990
    [os_driver-1] unprocessed packets: 1078 (written: 4274, read: 3196)
    [os_driver-1] buffer active items: 989
    [os_driver-1] unprocessed packets: 1077 (written: 4274, read: 3197)
    [os_driver-1] buffer active items: 988
    [os_driver-1] unprocessed packets: 1076 (written: 4274, read: 3198)
    [os_driver-1] buffer active items: 987
    [os_driver-1] unprocessed packets: 1075 (written: 4274, read: 3199)
    [os_driver-1] buffer active items: 986
    [os_driver-1] unprocessed packets: 1074 (written: 4274, read: 3200)
    [os_driver-1] buffer active items: 985
    [os_driver-1] unprocessed packets: 1073 (written: 4274, read: 3201)
    [os_driver-1] buffer active items: 984
    [os_driver-1] unprocessed packets: 1072 (written: 4274, read: 3202)
    [os_driver-1] buffer active items: 983
    [os_driver-1] unprocessed packets: 1071 (written: 4274, read: 3203)
    [os_driver-1] buffer active items: 982
    [os_driver-1] unprocessed packets: 1070 (written: 4274, read: 3204)
    [os_driver-1] buffer active items: 981
    [os_driver-1] unprocessed packets: 1069 (written: 4274, read: 3205)
    [os_driver-1] buffer active items: 980
    [os_driver-1] unprocessed packets: 1068 (written: 4274, read: 3206)
    [os_driver-1] buffer active items: 979
    [os_driver-1] unprocessed packets: 1067 (written: 4274, read: 3207)
    [os_driver-1] buffer active items: 978
    [os_driver-1] unprocessed packets: 1066 (written: 4274, read: 3208)
    [os_driver-1] buffer active items: 977
    [os_driver-1] unprocessed packets: 1065 (written: 4274, read: 3209)
    [os_driver-1] buffer active items: 976
    [os_driver-1] unprocessed packets: 1064 (written: 4274, read: 3210)
    [os_driver-1] buffer active items: 975
    [os_driver-1] unprocessed packets: 1063 (written: 4274, read: 3211)
    [os_driver-1] buffer active items: 974
    [os_driver-1] unprocessed packets: 1062 (written: 4274, read: 3212)
    [os_driver-1] buffer active items: 973
    [os_driver-1] unprocessed packets: 1061 (written: 4274, read: 3213)
    [os_driver-1] buffer active items: 972
    [os_driver-1] unprocessed packets: 1060 (written: 4274, read: 3214)
    [os_driver-1] buffer active items: 971
    [os_driver-1] unprocessed packets: 1059 (written: 4274, read: 3215)
    [os_driver-1] buffer active items: 970
    [os_driver-1] unprocessed packets: 1058 (written: 4274, read: 3216)
    [os_driver-1] buffer active items: 969
    [os_driver-1] unprocessed packets: 1057 (written: 4274, read: 3217)
    [os_driver-1] buffer active items: 968
    [os_driver-1] unprocessed packets: 1056 (written: 4274, read: 3218)
    [os_driver-1] buffer active items: 967
    [os_driver-1] unprocessed packets: 1055 (written: 4274, read: 3219)
    [os_driver-1] buffer active items: 966
    [os_driver-1] unprocessed packets: 1054 (written: 4274, read: 3220)
    [os_driver-1] buffer active items: 965
    [os_driver-1] unprocessed packets: 1053 (written: 4274, read: 3221)
    [os_driver-1] buffer active items: 964
    [os_driver-1] unprocessed packets: 1052 (written: 4274, read: 3222)
    [os_driver-1] buffer active items: 963
    [os_driver-1] unprocessed packets: 1051 (written: 4274, read: 3223)
    [os_driver-1] buffer active items: 962
    [os_driver-1] unprocessed packets: 1130 (written: 4354, read: 3224)
    [os_driver-1] buffer active items: 1023
    [os_driver-1] unprocessed packets: 1129 (written: 4354, read: 3225)
    [os_driver-1] buffer active items: 1022
    [os_driver-1] unprocessed packets: 1128 (written: 4354, read: 3226)
    [os_driver-1] buffer active items: 1021
    [os_driver-1] unprocessed packets: 1127 (written: 4354, read: 3227)
    [os_driver-1] buffer active items: 1020
    [os_driver-1] unprocessed packets: 1126 (written: 4354, read: 3228)
    [os_driver-1] buffer active items: 1019
    [os_driver-1] unprocessed packets: 1125 (written: 4354, read: 3229)
    [os_driver-1] buffer active items: 1018
    [os_driver-1] unprocessed packets: 1124 (written: 4354, read: 3230)
    [os_driver-1] buffer active items: 1017
    [os_driver-1] unprocessed packets: 1123 (written: 4354, read: 3231)
    [os_driver-1] buffer active items: 1016
    [os_driver-1] unprocessed packets: 1122 (written: 4354, read: 3232)
    [os_driver-1] buffer active items: 1015
    [os_driver-1] unprocessed packets: 1121 (written: 4354, read: 3233)
    [os_driver-1] buffer active items: 1014
    [os_driver-1] unprocessed packets: 1120 (written: 4354, read: 3234)
    [os_driver-1] buffer active items: 1013
    [os_driver-1] unprocessed packets: 1119 (written: 4354, read: 3235)
    [os_driver-1] buffer active items: 1012
    [os_driver-1] unprocessed packets: 1118 (written: 4354, read: 3236)
    [os_driver-1] buffer active items: 1011
    [os_driver-1] unprocessed packets: 1117 (written: 4354, read: 3237)
    [os_driver-1] buffer active items: 1010
    [os_driver-1] unprocessed packets: 1116 (written: 4354, read: 3238)
    [os_driver-1] buffer active items: 1009
    [os_driver-1] unprocessed packets: 1115 (written: 4354, read: 3239)
    [os_driver-1] buffer active items: 1008
    [os_driver-1] unprocessed packets: 1114 (written: 4354, read: 3240)
    

So the first problem could be solvable by refactoring the ringbuffer (now the behavior is the same as the community version - we're not missing any packets, but the buffer will overflow with too many subscribers).

Since the writing thread is no longer holding back on the packets, they are actually written into the buffer, which will overflow if the reading thread can not keep up. I think you mention separating out the reading and processing into different threads (#240 (comment)), which could be a solution for the second problem.

//
Now I understad why it relates to the read opration. I thought it was simply an overhead issue. But since the reader is holding the lock for the whole time until all callback processing is finished, the writer cannot have access to it and doesn't perform any write operations. That's why the atomic rewrite works, since the writer is not relying on the locks.

@mwhannan74
Copy link

mwhannan74 commented Mar 29, 2024

I would like to comment that I am also having this issue with my Ouster OS-2-128, Firmware v2.5.2, UDP Profile LEGACY, pulled ROS2 branch today. I am running it on 22.04 and Iron.

If I use 2048x10 mode, than I see lost data from about 270 deg to 360 deg (https://static.ouster.dev/sensor-docs/_images/lidar-frame-top-down.svg). Sometimes less, sometimes flickers to almost 240 deg. This makes it practically unusable.

I can confirm that if I switch to 1024x10 that I do NOT see this issue. This is an okay work around for now, but not ideal for sure.

I can also confirm that this is NOT an issue when using Ouster studio.

@mwhannan74
Copy link

mwhannan74 commented Apr 1, 2024

I did some more testing today, and though the flickering and lost data is a lot less, I can still see it at 1024x10.

Is this an issue with me using an older model of the OS-128 or the UDP LEGACY mode?

I am a bit baffled that everyone is not seeing this issue and that there is not a clear understanding why. It is easily reproducible for my setup.

@shubham-shahh
Copy link

I did some more testing today, and though the flickering and lost data is a lot less, I can still see it at 1024x10.

Is this an issue with me using an older model of the OS-128 or the UDP LEGACY mode?

I am a bit baffled that everyone is not seeing this issue and that there is not a clear understanding why. It is easily reproducible for my setup.

Are you building the ouster driver in Release mode?

@mwhannan74
Copy link

mwhannan74 commented Apr 2, 2024

Yes I am building in release.

colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release

Here is a video showing the issue at 2048x10.

Screencast.from.04-01-2024.08.51.12.PM.webm

I ran Ouster Studio (https://ouster.com/products/software/ouster-studio) and I do not have any issues, thus I am assuming that this is a ROS2 issue. Maybe a RVIZ2 issue?

I checked the CPU usage, and it is not high.

@mwhannan74
Copy link

I switched the UDP profile from LEGACY to RNG19_RFL8_SIG16_NIR16, but still the same flickering.

@mwhannan74
Copy link

mwhannan74 commented Apr 2, 2024

Here it is at 1024x10. It is better, but there is still a small flicker occasionally.

Screencast.from.04-01-2024.09.06.42.PM.webm

@shubham-shahh
Copy link

Here it is at 1024x10. It is better, but there is still a small flicker occasionally. Screencast from 04-01-2024 09:06:42 PM.webm

what's the platform on which you're testing this? did you try out with some powerful CPUs to eliminate performance throttling?

@mwhannan74
Copy link

mwhannan74 commented Apr 2, 2024

Laptop with i9-9980HK (2.4GHzx16) with 32GB ram. Not the fastest, but should be more than plenty. I don't have a faster computer with ROS2 available. I was processing a Velodyne HDL64 using ROS1 over 8 years ago on a computer a fraction of this capability without issue. So, I hope that the hardware is not an issue. Again, Ouster studio works perfectly and I did not see any obvious CPU limiting when looking at the system monitor.

It could be something that I have done wrong with ROS2 or a driver configuration issue. ROS2 has a lot more nuance in setting it up then ROS1, especially with QoS.

I am launching it with.

ros2 launch ouster_ros driver.launch.py

Here is the driver_params.yaml file that I am using. Maybe there is something wrong in here?
driver_params.txt

Thanks for you help. Sorry if I seem a bit frustrated. I finally have a project to use this amazing lidar, and I have spent a lot of time this last week or two trying to get it to work. I don't really have the time/money to start from scratch with the Ouster SDK.

@shubham-shahh
Copy link

Laptop with i9-9980HK (2.4GHzx16) with 32GB ram. Not the fastest, but should be more than plenty. I don't have a faster computer with ROS2 available. I was processing a Velodyne HDL64 using ROS1 over 8 years ago on a computer a fraction of this capability without issue. So, I hope that the hardware is not an issue. Again, Ouster studio works perfectly and I did not see any obvious CPU limiting when looking at the system monitor.

It could be something that I have done wrong with ROS2 or a driver configuration issue. ROS2 has a lot more nuance in setting it up then ROS1, especially with QoS.

I am launching it with.

ros2 launch ouster_ros driver.launch.py

Here is the driver_params.yaml file that I am using. Maybe there is something wrong in here? driver_params.txt

Thanks for you help. Sorry if I seem a bit frustrated. I finally have a project to use this amazing lidar, and I have spent a lot of time this last week or two trying to get it to work. I don't really have the time/money to start from scratch with the Ouster SDK.

no worries. @Samahu are there any updates concerning solving this issue on ROS2?

@mwhannan74
Copy link

mwhannan74 commented Apr 3, 2024

Here is what I see in Ouster Studio with 2048x10. It looks pretty good with no large regions of data missing. There is some very minor flickering here and there which only occurs during the recording of the video. Maybe that is some indication that the Ouster lidar code is very sensitive to system load or CPU performance. However, without recording it looks 100% correct without any flickering. Maybe because of ROS2 or something in how the ROS2 driver uses the Ouster SDK (assuming that it does) amplifies this sensitivity?

Screencast.from.04-03-2024.11.36.49.AM.webm

@Samahu
Copy link
Contributor

Samahu commented Apr 16, 2024

Hi All, please consider taking a look at any of the three following PRs (#319, #320, #321) - whichever applies to your current ROS distribution - and check if it helps resolve this issue without a regression in performance. I did take close look at #302 approach solution and I think it does help too but I couldn't verify it completely because under ROS2-foxy which is what @Imaniac230 targeted for the solution I don't seem to be able to reproduce the issue on my laptop no matter how many subscribers I add. In the fix that I am submitting I use less synchronization overall. I have provided my analysis of the issue and the motivation behind this approach.

I do have one follow up item before I consider the solution complete but what I have pushed so far still resolves this problem.

Please if you can give it a try and provide feedback whether this helps with your situation or not (or any relevant feedback). 🙏

@mwhannan74
Copy link

@Samahu, I tested PR #321. I have good and bad news. I really appreciate your help with this.

The good news is that it does indeed perform better, a lot better. I can now run 1024x10 while actually processing the point cloud with voxel filtering, normal estimation and filter, and ICP. The flickering and lost data seems to be gone.

However, the bad news is that at 2048x10 I still have issues. It is significantly better where I am only seeing minor drops of data and not huge chunks, but I still see the flickering. It is minimal when just running the lidar driver alone, but it does exist. If I run my same processing, then the flickering is consistently an issue. Also, I see the output rate of the driver drop from a solid 10Hz at 1024x10 to more like 8.5Hz at 2048x10.

I would expect that a gaming laptop or desktop grade processor may be able to successfully run at 2048x10. I am not sure what exactly is happening in the processing of scan packets to a point cloud that requires so much CPU. My more moderate computer and laptop that I use for my USV clearly struggles. It is an understandable and workable issue for me, but clearly disappointing.

@Samahu
Copy link
Contributor

Samahu commented Apr 16, 2024

@mwhannan74 Thanks for sharing the feedback, while waiting for further feedback for others here.. have you considered increasing your system's recv buffer size by performing?

sudo sysctl -w net.core.rmem_default=26214400
sudo sysctl -w net.core.rmem_max=26214400

Also if you only need the point clouds consider setting the proc_mask launch parameter to proc_mask:="PCL" this would reduce the amount spent for processing LidarScan's and reduce the amount data published by the driver.

EDIT: also as I noted in the PR(s) I still want try to eliminate/avoid the extra copy of packets between the packets queue and the added LidarScan buffers.

@mwhannan74
Copy link

mwhannan74 commented Apr 16, 2024

@Samahu, I have great news to report. It now works at 2048x10!

Increasing the system's recv buffer size fixed the blinking data issue. For good measure I also increased the MTU size to 9000, like I do with my GigE cameras just in case (not sure if it is actually needed).

However, I was only seeing an output rate of 8.5Hz. I then configured the proc_mask:="PCL" and the rate went up to a full 10Hz!

Thank you for all of your help.

@Samahu
Copy link
Contributor

Samahu commented Apr 16, 2024

awesome, thanks for sharing!

@Imaniac230
Copy link

Hi All, please consider taking a look at any of the three following PRs (#319, #320, #321) - whichever applies to your current ROS distribution - and check if it helps resolve this issue without a regression in performance. I did take close look at #302 approach solution and I think it does help too but I couldn't verify it completely because under ROS2-foxy which is what @Imaniac230 targeted for the solution I don't seem to be able to reproduce the issue on my laptop no matter how many subscribers I add. In the fix that I am submitting I use less synchronization overall. I have provided my analysis of the issue and the motivation behind this approach.

I do have one follow up item before I consider the solution complete but what I have pushed so far still resolves this problem.

Please if you can give it a try and provide feedback whether this helps with your situation or not (or any relevant feedback). 🙏

@Samahu I'm using foxy in my default dev system, but if it helps with comparisons and evaluations in any way I can also quickly create target PRs with the same changes for humble (and possibly noetic).

@Samahu
Copy link
Contributor

Samahu commented Apr 23, 2024

@Samahu I'm using foxy in my default dev system, but if it helps with comparisons and evaluations in any way I can also quickly create target PRs with the same changes for humble (and possibly noetic).

I can do a comparison using the foxy branch I created once I get back to it (very soon 🤞 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet