7 #include "opencv2/opencv.hpp" 13 #include <sensor_msgs/PointCloud2.h> 14 #include <sensor_msgs/Image.h> 15 #include <sensor_msgs/CameraInfo.h> 23 #include <boost/foreach.hpp> 25 #include <velodyne_pcl/point_types.h> 27 #include <pcl/common/eigen.h> 28 #include <pcl/common/transforms.h> 29 #include <pcl/filters/passthrough.h> 35 #include "lidar_camera_calibration/marker_6dof.h" 58 const lidar_camera_calibration::marker_6dof::ConstPtr &msg_rt) {
59 ROS_INFO_STREAM(
"Velodyne scan received at " << msg_pc->header.stamp.toSec());
60 ROS_INFO_STREAM(
"marker_6dof received at " << msg_rt->header.stamp.toSec());
63 if (
config.lidar_type == 0)
66 }
else if (
config.lidar_type == 1)
78 * Eigen::AngleAxisd(
config.initialRot[1], Eigen::Vector3d::UnitY())
79 * Eigen::AngleAxisd(
config.initialRot[0], Eigen::Vector3d::UnitX());
87 cv::Mat temp_mat(
config.s, CV_8UC3);
90 std::vector<float> marker_info;
92 for (std::vector<float>::const_iterator it = msg_rt->dof.data.begin(); it != msg_rt->dof.data.end(); ++it) {
93 marker_info.push_back(*it);
94 std::cout << *it <<
" ";
104 void callback(
const sensor_msgs::CameraInfoConstPtr &msg_info,
105 const sensor_msgs::PointCloud2ConstPtr &msg_pc,
106 const lidar_camera_calibration::marker_6dof::ConstPtr &msg_rt) {
108 ROS_INFO_STREAM(
"Camera info received at " << msg_info->header.stamp.toSec());
109 ROS_INFO_STREAM(
"Velodyne scan received at " << msg_pc->header.stamp.toSec());
110 ROS_INFO_STREAM(
"marker_6dof received at " << msg_rt->header.stamp.toSec());
114 for (boost::array<double, 12ul>::const_iterator i = msg_info->P.begin(); i != msg_info->P.end(); i++) {
121 if (
config.lidar_type == 0)
124 }
else if (
config.lidar_type == 1)
136 * Eigen::AngleAxisd(
config.initialRot[1], Eigen::Vector3d::UnitY())
137 * Eigen::AngleAxisd(
config.initialRot[0], Eigen::Vector3d::UnitX());
144 cv::Mat temp_mat(
config.s, CV_8UC3);
147 std::vector<float> marker_info;
149 for (std::vector<float>::const_iterator it = msg_rt->dof.data.begin(); it != msg_rt->dof.data.end(); ++it) {
150 marker_info.push_back(*it);
151 std::cout << *it <<
" ";
160 int main(
int argc,
char **argv) {
166 if (
config.useCameraInfo) {
175 std::cout <<
"done1\n";
pcl::PointCloud< myPointXYZRID > intensityByRangeDiff(pcl::PointCloud< myPointXYZRID > point_cloud, config_settings config)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
void fromROSMsg(const sensor_msgs::PointCloud2 &cloud, pcl::PointCloud< T > &pcl_cloud)
void callback_noCam(const sensor_msgs::PointCloud2ConstPtr &msg_pc, const lidar_camera_calibration::marker_6dof::ConstPtr &msg_rt)
Hesai::PointCloud point_cloud_hesai
pcl::PointCloud< pcl::PointXYZ > * toPointsXYZ(pcl::PointCloud< myPointXYZRID > point_cloud)
pcl::PointCloud< myPointXYZRID >::Ptr toMyPointXYZRID(const Hesai::PointCloud &point_cloud_ptr)
ROSCPP_DECL void spin(Spinner &spinner)
pcl::PointCloud< myPointXYZRID > transform(pcl::PointCloud< myPointXYZRID > pc, float x, float y, float z, float rot_x, float rot_y, float rot_z)
pcl::PointCloud< myPointXYZRID > point_cloud
Connection registerCallback(C &callback)
int main(int argc, char **argv)
Eigen::Quaterniond qlidarToCamera
void callback(const sensor_msgs::CameraInfoConstPtr &msg_info, const sensor_msgs::PointCloud2ConstPtr &msg_pc, const lidar_camera_calibration::marker_6dof::ConstPtr &msg_rt)
#define ROS_INFO_STREAM(args)
bool getParam(const std::string &key, std::string &s) const
Eigen::Matrix3d lidarToCamera
bool getCorners(cv::Mat img, pcl::PointCloud< pcl::PointXYZ > scan, cv::Mat P, int num_of_markers, int MAX_ITERS)
void find_transformation(std::vector< float > marker_info, int num_of_marker_in_config, int MAX_ITERS, Eigen::Matrix3d lidarToCamera)