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

There is nowhere to set variable is_initialized to false except in the constructor of the "LdsLidar." #21

Open
BlueBirdHouse opened this issue Sep 5, 2022 · 0 comments

Comments

@BlueBirdHouse
Copy link

Dear engineers of Livox ROS2 Driver,
I encounter an error when I use the function "int LdsLidar :: DeInitLdsLidar". It happens when I "InitLdsLidar"; then, "DeInitLdsLidar"; then, "InitLdsLidar" again. It tells me that the LiDAR data source is already inited.

I have observed that in the "InitLdsLidar," you have set the variable is_initialized to true; however, there is nowhere to set it to false except in the constructor of the "LdsLidar."
However, the class "LdsLidar" is used as static in "static LdsLidar lds_lidar(interval_ms)" of LisLidar *GetInstance(uint32_t interval_ms). That means there is only one copy of LdsLidar. So, if on code change the variable is_initialized to false, it will always be true.

I add one line is_initialized = false in LdsLidar::DeInitLdsLidar(void). It seems to work for the moment.

However, I am just a noviciate. I don't know whether my modification will cause some side effects.

Please help me.

Thanks.

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

1 participant