Comments (3)
you can change the pointcloud type to velodyne type in lidarCallback
void lidarCallback(boost::shared_ptr cld, double timestamp, hesai_lidar::PandarScanPtr scan) // the timestamp from first point cloud of cld
{
if(m_sPublishType == "both" || m_sPublishType == "points"){
pcl_conversions::toPCL(ros::Time(timestamp), cld->header.stamp);
sensor_msgs::PointCloud2 cloud;
cloud.fields.clear();
cloud.fields.reserve(6);
cloud.height = 1;
cloud.width = (uint32_t)cld->points.size();
int offset = 0;
std::string name("x");
int count(1);
int datatype(sensor_msgs::PointField::FLOAT32);
offset = addPointField(cloud, name, count, datatype, offset);
name = "y";
count = 1;
datatype = sensor_msgs::PointField::FLOAT32;
offset = addPointField(cloud, name, count, datatype, offset);
name = "z";
count = 1;
datatype = sensor_msgs::PointField::FLOAT32;
offset = addPointField(cloud, name, count, datatype, offset);
name = "intensity";
count = 1;
datatype = sensor_msgs::PointField::FLOAT32;
offset = addPointField(cloud, name, count, datatype, offset);
name = "ring";
count = 1;
datatype = sensor_msgs::PointField::UINT16;
offset = addPointField(cloud, name, count, datatype, offset);
name = "timestamp";
count = 1;
datatype = sensor_msgs::PointField::FLOAT32;
offset = addPointField(cloud, name, count, datatype, offset);
cloud.point_step = offset;
cloud.row_step = 1 * cloud.point_step;
cloud.header.frame_id = cld->header.frame_id;
cloud.header.stamp = ros::Time(timestamp);
cloud.data.resize(cld->points.size() * cloud.point_step);
sensor_msgs::PointCloud2Iterator iter_x = sensor_msgs::PointCloud2Iterator(cloud, "x");
sensor_msgs::PointCloud2Iterator iter_y = sensor_msgs::PointCloud2Iterator(cloud, "y");
sensor_msgs::PointCloud2Iterator iter_z = sensor_msgs::PointCloud2Iterator(cloud, "z");
sensor_msgs::PointCloud2Iterator iter_intensity = sensor_msgs::PointCloud2Iterator(cloud, "intensity");
sensor_msgs::PointCloud2Iterator<uint16_t> iter_ring = sensor_msgs::PointCloud2Iterator<uint16_t >(cloud, "ring");
sensor_msgs::PointCloud2Iterator iter_timestamp = sensor_msgs::PointCloud2Iterator(cloud, "timestamp");
for(int i = 0; i < cld->points.size(); i++){
*(iter_x+i) = cld->points[i].x;
*(iter_y+i) = cld->points[i].y;
*(iter_z+i) = cld->points[i].z;
*(iter_intensity+i) = cld->points[i].intensity;
*(iter_ring+i) = cld->points[i].ring;
*(iter_timestamp+i) = cld->points[i].timestamp;
}
lidarPublisher.publish(cloud);
#ifdef PRINT_FLAG
printf("timestamp: %f, point size: %ld.\n",timestamp, cld->points.size());
#endif
}
if(m_sPublishType == "both" || m_sPublishType == "raw"){
packetPublisher.publish(scan);
#ifdef PRINT_FLAG
printf("raw size: %d.\n", scan->packets.size());
#endif
}
}
from hesailidar_general_ros.
the timestamp from first point cloud of cld??? velodyne type timestamp is the time that is relative to first point of incoming point cloud. And the timestamp is very precise!
from hesailidar_general_ros.
Dear the staff from HesaiTechnology,
I notice that the timestamp for each lidar point is same value. May I ask is this issue fixed?
For this "cld->points[i].timestamp" , May I ask how to calculate the timestamp for each lidar points? Thank you very much!
sensor_msgs::PointCloud2Iterator iter_timestamp = sensor_msgs::PointCloud2Iterator(cloud, "timestamp"); for(int i = 0; i < cld->points.size(); i++){ *(iter_x+i) = cld->points[i].x; *(iter_y+i) = cld->points[i].y; *(iter_z+i) = cld->points[i].z; *(iter_intensity+i) = cld->points[i].intensity; *(iter_ring+i) = cld->points[i].ring; *(iter_timestamp+i) = cld->points[i].timestamp; } lidarPublisher.publish(cloud);
from hesailidar_general_ros.
Related Issues (20)
- ROS2 (Galactic) on Ubuntu 20.04 - no messages published under topic /hesai/pandar and PandarView run error HOT 5
- 有QT128的驱动吗 HOT 1
- 代码目前支持humble版本的ros2吗? HOT 1
- No install folder after catkin_make HOT 2
- Can you help me translate this sentence: 'Exchange ideas on how to run PandarQT64 and lio-sam under ros2'? HOT 1
- Do I need to build HesaiLidar_General_SDK before? HOT 2
- Compiling ROS2 branch with ROS2 Humble fails HOT 3
- Launch issue in ROS Humble HOT 2
- buffer dont have space! How can i fix this??? HOT 4
- XT系列32线,每台雷达的内参是否一致。
- Obtain Lidar Serial Number HOT 1
- Error code -11 HOT 2
- Failed to load nodelet [/hesai/pandar_nodelet_manager_cloud]
- PandarScan.msg do not have timestamp info
- hesai lidar topic hz
- run for PandarXT-32 error
- 驱动得到的时间和ros时间不同
- 有AT128的驱动吗
- 请问由于需要录制ros2的激光雷达的bag包,但录制几秒钟的时间就好几个G了,请问如何调整
- What does the coordinate correction flag do?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hesailidar_general_ros.