Skip to content

Commit

Permalink
velodyne_packet_pointcloud: Dual return WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
judav25 committed Aug 9, 2024
1 parent 4cd96e4 commit 8e6c320
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 9 additions & 4 deletions velodyne_packet_pointcloud/src/unpacker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ namespace velodyne_packet_pointcloud


manage_tf_buffer();
packets_in_scan = 1; // must be ste to at least one
cloud.header.stamp = packetMsg.stamp;
cloud.data.clear();
cloud.data.resize(points_per_packet * cloud.point_step);
cloud.width = 1;
cloud.height = 0;// starts at 0 and increases with each succes full call to add point
cloud.is_dense = true;

cloud.is_dense = false;

iter_x = sensor_msgs::PointCloud2Iterator<float>(cloud, "x");
iter_y = sensor_msgs::PointCloud2Iterator<float>(cloud, "y");
Expand All @@ -147,9 +147,13 @@ namespace velodyne_packet_pointcloud
// fixed frame not available
return;
}
ROS_DEBUG_STREAM("Unpacking" << cloud.height * cloud.width
<< " Velodyne points, time: " << cloud.header.stamp);

raw_data_ptr_->unpack(packetMsg, *this,
packetMsg.stamp, 0);
raw_data_ptr_->unpack(packetMsg, *this,packetMsg.stamp,
0); // todo: this may have to be a running number
ROS_DEBUG_STREAM("Publishing" << cloud.height * cloud.width
<< " Velodyne points, time: " << cloud.header.stamp);


output_.publish(this->finishCloud(packetMsg.stamp));
Expand All @@ -159,6 +163,7 @@ namespace velodyne_packet_pointcloud
if (this->get_return_mode(retmode_msg))
output_ret_mode_.publish(retmode_msg);


}

void
Expand Down
2 changes: 2 additions & 0 deletions velodyne_pointcloud/src/lib/rawdata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,7 @@ void RawData::unpack_vls128(const velodyne_msgs::VelodynePacket &pkt, DataContai
float point_time = 0;

//To which firing seq does this block belong in the package
// In dual return there is only 1 fire sequence per package, so this is always the first one (0)
const uint8_t firing_seq_in_package = 0;

// To which firing sequence does this block belongs in the scan
Expand Down Expand Up @@ -817,6 +818,7 @@ void RawData::unpack_vls128(const velodyne_msgs::VelodynePacket &pkt, DataContai
std::uint16_t rotation_segment = ((7 - (laser_number - (8 * std::floor(laser_number / 8)))) * 9) +
firing_seq_in_scan;

// ToDo fix for continuous streaming
while (rotation_segment >= num_firing_sequences_in_one_scan) {
rotation_segment = rotation_segment - num_firing_sequences_in_one_scan;
}
Expand Down

0 comments on commit 8e6c320

Please sign in to comment.