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

Delays #77

Open
PanterSoft opened this issue May 9, 2024 · 3 comments
Open

Delays #77

PanterSoft opened this issue May 9, 2024 · 3 comments

Comments

@PanterSoft
Copy link

Hello,

Quick question did anyone get this running in pretty much Real Time ? for me if I play a scene of abaout 300 seconds I get a delay of about 100 seconds. Is there a Setting to skip some frames to get rid of the delay or reduce it ?

Thanks for this amazing Project

@PanterSoft PanterSoft changed the title Real Time Capabilitys Delays May 9, 2024
@charlescochran
Copy link

It's probably hitting a CPU limit from what I've seen. When the sensor isn't moving (and thus the solver isn't having to do much), I can get it to just about keep up. But it quickly gets overwhelmed if it has to do much tracking. The reason it gets "behind" because it is buffering messages in a FIFO (like you are speculating), which doesn't seem like a good idea! Unfortunately, there's no setting to disable this, but I made some code changes to bypass the FIFO and it is able to "keep up" now (it still drops frames when the sensor is moving, but the odometry works fairly well). I am considering opening a PR with this change (and others), but I'm not sure if @Livox-SDK would be open to taking it.

@PanterSoft
Copy link
Author

Okay That sounds like what I expected. Do You have a fork which I can maybe try out ? @charlescochran

@charlescochran
Copy link

I ended up leaving this change out of my PR because it's rather messy (I'm just clearing out the lidar message queue instead of popping from it; a proper fix would be get rid of the queue entirely). That being said, you can replicate my quick-fix by applying this diff in PoseEstimation.cpp's process() function:

     if(!_lidarMsgQueue.empty()){
-      // get new lidar msg
-      time_curr_lidar = _lidarMsgQueue.front()->header.stamp.toSec();
-      pcl::fromROSMsg(*_lidarMsgQueue.front(), *laserCloudFullRes);
-      _lidarMsgQueue.pop();
+      // instead of queuing, just use the latest scan and throw away the old ones!
+      time_curr_lidar = _lidarMsgQueue.back()->header.stamp.toSec();
+      pcl::fromROSMsg(*_lidarMsgQueue.back(), *laserCloudFullRes);
+      _lidarMsgQueue = {};
       newfullCloud = true;
     }

That should be all you need to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants