mirror of
https://github.com/Livox-SDK/livox_ros_driver.git
synced 2023-04-06 15:49:55 +08:00
feat:remove restrictions on timestamps
This commit is contained in:
@@ -476,7 +476,7 @@ void Lddc::PollingLidarPointCloudData(uint8_t handle, LidarDevice *lidar) {
|
|||||||
while (!QueueIsEmpty(p_queue)) {
|
while (!QueueIsEmpty(p_queue)) {
|
||||||
uint32_t used_size = QueueUsedSize(p_queue);
|
uint32_t used_size = QueueUsedSize(p_queue);
|
||||||
uint32_t onetime_publish_packets =
|
uint32_t onetime_publish_packets =
|
||||||
GetPacketNumPerSec(lidar->info.type) / publish_frq_;
|
GetPacketNumPerSec(lidar->pointcloud_data_type) / publish_frq_;
|
||||||
if (used_size < onetime_publish_packets) {
|
if (used_size < onetime_publish_packets) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,6 +169,7 @@ typedef struct {
|
|||||||
bool data_is_pubulished; /**< Indicate the data of lidar whether is
|
bool data_is_pubulished; /**< Indicate the data of lidar whether is
|
||||||
pubulished. */
|
pubulished. */
|
||||||
volatile LidarConnectState connect_state;
|
volatile LidarConnectState connect_state;
|
||||||
|
uint8_t pointcloud_data_type;
|
||||||
DeviceInfo info;
|
DeviceInfo info;
|
||||||
LidarPacketStatistic statistic_info;
|
LidarPacketStatistic statistic_info;
|
||||||
LidarDataQueue data;
|
LidarDataQueue data;
|
||||||
@@ -220,7 +221,7 @@ const PacketInfoPair packet_info_pair_table[kMaxPointDataType] = {
|
|||||||
{100, 100000, 10000, 1000000, 1318}, {100, 100000, 10000, 1000000, 918},
|
{100, 100000, 10000, 1000000, 1318}, {100, 100000, 10000, 1000000, 918},
|
||||||
{96, 240000, 4167, 400000, 1362}, {96, 240000, 4167, 400000, 978},
|
{96, 240000, 4167, 400000, 1362}, {96, 240000, 4167, 400000, 978},
|
||||||
{96, 480000, 4167, 400000, 1362}, {48, 480000, 4167, 400000, 978},
|
{96, 480000, 4167, 400000, 1362}, {48, 480000, 4167, 400000, 978},
|
||||||
{1, 100, 10000000, 10000000, 42}};
|
{1, 200, 10000000, 10000000, 42}};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Global function for general use.
|
* Global function for general use.
|
||||||
|
|||||||
@@ -162,6 +162,10 @@ void LdsHub::OnHubDataCb(uint8_t hub_handle, LivoxEthPacket *data,
|
|||||||
sizeof(cur_timestamp));
|
sizeof(cur_timestamp));
|
||||||
|
|
||||||
if (kImu != eth_packet->data_type) {
|
if (kImu != eth_packet->data_type) {
|
||||||
|
if (p_lidar->pointcloud_data_type != eth_packet->data_type) {
|
||||||
|
p_lidar->pointcloud_data_type = eth_packet->data_type;
|
||||||
|
}
|
||||||
|
|
||||||
if (eth_packet->timestamp_type == kTimestampTypePps) {
|
if (eth_packet->timestamp_type == kTimestampTypePps) {
|
||||||
/** Whether a new sync frame */
|
/** Whether a new sync frame */
|
||||||
if ((cur_timestamp.stamp < packet_statistic->last_timestamp) &&
|
if ((cur_timestamp.stamp < packet_statistic->last_timestamp) &&
|
||||||
@@ -210,7 +214,7 @@ void LdsHub::OnHubDataCb(uint8_t hub_handle, LivoxEthPacket *data,
|
|||||||
p_lidar->info.broadcast_code, queue_size, p_queue->size);
|
p_lidar->info.broadcast_code, queue_size, p_queue->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!QueueIsFull(p_queue) && (cur_timestamp.stamp >= 0)) {
|
if (!QueueIsFull(p_queue)) {
|
||||||
QueuePushAny(p_queue, (uint8_t *)eth_packet,
|
QueuePushAny(p_queue, (uint8_t *)eth_packet,
|
||||||
GetEthPacketLen(eth_packet->data_type),
|
GetEthPacketLen(eth_packet->data_type),
|
||||||
packet_statistic->imu_timebase,
|
packet_statistic->imu_timebase,
|
||||||
|
|||||||
@@ -175,6 +175,10 @@ void LdsLidar::OnLidarDataCb(uint8_t handle, LivoxEthPacket *data,
|
|||||||
sizeof(cur_timestamp));
|
sizeof(cur_timestamp));
|
||||||
|
|
||||||
if (kImu != eth_packet->data_type) {
|
if (kImu != eth_packet->data_type) {
|
||||||
|
if (p_lidar->pointcloud_data_type != eth_packet->data_type) {
|
||||||
|
p_lidar->pointcloud_data_type = eth_packet->data_type;
|
||||||
|
}
|
||||||
|
|
||||||
if (eth_packet->timestamp_type == kTimestampTypePps) {
|
if (eth_packet->timestamp_type == kTimestampTypePps) {
|
||||||
if ((cur_timestamp.stamp < packet_statistic->last_timestamp) &&
|
if ((cur_timestamp.stamp < packet_statistic->last_timestamp) &&
|
||||||
(cur_timestamp.stamp < kPacketTimeGap)) { // whether a new sync frame
|
(cur_timestamp.stamp < kPacketTimeGap)) { // whether a new sync frame
|
||||||
@@ -225,7 +229,7 @@ void LdsLidar::OnLidarDataCb(uint8_t handle, LivoxEthPacket *data,
|
|||||||
p_lidar->info.broadcast_code, queue_size, p_queue->size);
|
p_lidar->info.broadcast_code, queue_size, p_queue->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!QueueIsFull(p_queue) && (cur_timestamp.stamp >= 0)) {
|
if (!QueueIsFull(p_queue)) {
|
||||||
QueuePushAny(p_queue, (uint8_t *)eth_packet,
|
QueuePushAny(p_queue, (uint8_t *)eth_packet,
|
||||||
GetEthPacketLen(eth_packet->data_type),
|
GetEthPacketLen(eth_packet->data_type),
|
||||||
packet_statistic->timebase,
|
packet_statistic->timebase,
|
||||||
|
|||||||
Reference in New Issue
Block a user