45 lvx_file_ = std::make_shared<LvxFileHandle>();
63 printf(
"Convert complete, Press [Ctrl+C] to exit!\n");
68 printf(
"Livox file data source is already inited!\n");
72 int ret =
lvx_file_->Open(lvx_path, std::ios::in);
74 printf(
"Open %s file fail[%d]!\n", lvx_path, ret);
87 printf(
"Lidar count error in %s : %d\n", lvx_path, valid_lidar_count_);
90 printf(
"LvxFile[%s] have %d lidars\n", lvx_path, valid_lidar_count_);
92 for (
uint32_t i = 0; i < valid_lidar_count_; i++) {
94 lvx_file_->GetDeviceInfo(i, &lvx_dev_info);
97 printf(
"Invalid hanle from lvx file!\n");
104 memcpy(
lidars_[handle].info.broadcast_code, \
115 p_extrinsic->
euler[0] = lvx_dev_info.
roll *
PI / 180.0;
116 p_extrinsic->
euler[1] = lvx_dev_info.
pitch *
PI / 180.0;
117 p_extrinsic->
euler[2] = lvx_dev_info.
yaw *
PI / 180.0;
118 p_extrinsic->
trans[0] = lvx_dev_info.
x;
119 p_extrinsic->
trans[1] = lvx_dev_info.
y;
120 p_extrinsic->
trans[2] = lvx_dev_info.
z;
137 printf(
"Start to read lvx file.\n");
147 while (data_offset < data_size) {
148 LivoxEthPacket *eth_packet;
154 eth_packet = (LivoxEthPacket *)(&detail_packet->
version);
159 eth_packet = (LivoxEthPacket *)(&detail_packet->
version);
163 data_type = eth_packet->data_type;
164 if (handle >=
lvx_file_->GetDeviceCount()) {
165 printf(
"Raw data handle error, error handle is %d\n", handle);
168 if (data_type >= kMaxPointDataType) {
169 printf(
"Raw data type error, error data_type is %d\n", data_type);
172 if (eth_packet->version != 5) {
173 printf(
"EthPacket version[%d] not supported\n", eth_packet->version);
182 if (p_queue !=
nullptr) {
184 std::this_thread::sleep_for(std::chrono::milliseconds(1));
188 if (p_queue !=
nullptr) {
190 std::this_thread::sleep_for(std::chrono::milliseconds(1));
196 printf(
"Exit read the lvx file, read file state[%d]!\n", file_state);
198 printf(
"Read the lvx file complete!\n");
203 if (progress !=
lvx_file_->GetLvxFileReadProgress()) {
204 progress =
lvx_file_->GetLvxFileReadProgress();
205 printf(
"Read progress : %d \n", progress);
208 printf(
"Wait for file conversion to complete!\n");
211 std::this_thread::sleep_for(std::chrono::milliseconds(40));
225 std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::shared_ptr< std::thread > t_read_lvx_
volatile bool is_initialized_
const uint32_t kMaxSourceLidar
const uint32_t kMaxPacketsNumOfFrame
volatile bool start_read_lvx_
ExtrinsicParameter extrinsic_parameter
uint32_t QueueIsFull(LidarDataQueue *queue)
std::shared_ptr< LvxFileHandle > lvx_file_
LdsLvx(uint32_t interval_ms)
bool IsAllQueueReadStop()
void StorageRawPacket(uint8_t handle, LivoxEthPacket *eth_packet)
int InitLdsLvx(const char *lvx_path)
uint8_t lidar_broadcast_code[16]
void EulerAnglesToRotationMatrix(EulerAngle euler, RotationMatrix matrix)
OutPacketBuffer packets_of_frame_
void ResetLds(uint8_t data_src)
LidarDevice lidars_[kMaxSourceLidar]
uint32_t GetEthPacketLen(uint32_t data_type)
volatile LidarConnectState connect_state