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

VL53L1X: Reduce CPU usage #21787

Merged
merged 3 commits into from
Jul 3, 2023
Merged

VL53L1X: Reduce CPU usage #21787

merged 3 commits into from
Jul 3, 2023

Conversation

dirksavage88
Copy link
Contributor

The VL53L1X sensor was updating at a very high rate and taking up considerable CPU resources. The realistic update rate in long range mode (4 meters) is 200ms. The sensor should only be run at 5hz in this mode, instead it was running at a much higher update rate.

Kazam_screenshot_00000

Signed-off-by: dirksavage88 <dirksavage88@gmail.com>
@dagar
Copy link
Member

dagar commented Jul 2, 2023

That seems a bit low. If nothing else you could schedule at 2xODR (output data rate) to shave off some latency.

Signed-off-by: dirksavage88 <dirksavage88@gmail.com>
@dirksavage88
Copy link
Contributor Author

dirksavage88 commented Jul 2, 2023

Kazam_screenshot_00002
Increased to 10hz and the cpu impact is still much better than the original driver state.

@dirksavage88 dirksavage88 changed the title Reduce CPU usage VL53L1X: Reduce CPU usage Jul 2, 2023
@dagar
Copy link
Member

dagar commented Jul 2, 2023

Arguably the real problem is that VL53L1X_DELAY set to 20 was intended to be milliseconds (ie 50 Hz), but was actually in microseconds (50,000 Hz). Changing it to actually run at 50 Hz sounds appropriate.

Signed-off-by: dirksavage88 <dirksavage88@gmail.com>
@dagar dagar merged commit 24665f1 into PX4:main Jul 3, 2023
81 of 84 checks passed
antbre pushed a commit to BioMorphic-Intelligence-Lab/PX4-Autopilot that referenced this pull request Sep 14, 2023
* should be 50 Hz instead of 50,000 Hz

Signed-off-by: dirksavage88 <dirksavage88@gmail.com>
@dirksavage88 dirksavage88 deleted the vl53l1x_cpu branch September 23, 2023 23:04
@DronecodeBot
Copy link

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/vl53l1x-lidar-running-at-1hz-when-docs-say-it-should-be-50hz/37612/4

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

Successfully merging this pull request may close these issues.

None yet

3 participants