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.
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.