Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some doubts and bugs #12

Open
LeegoChen opened this issue Jun 12, 2020 · 3 comments
Open

some doubts and bugs #12

LeegoChen opened this issue Jun 12, 2020 · 3 comments

Comments

@LeegoChen
Copy link

一些疑惑和bug,如有错误,请您谅解。
1.void VelocityData::TransformCoordinate(Eigen::Matrix4f transform_matrix)
{
....

    Eigen::Vector3d r(matrix(0,3), matrix(1,3), matrix(2,3));
    Eigen::Vector3d delta_v;
    delta_v(0) = w(1) * r(2) - w(2) * r(1);
    delta_v(1) = w(2) * r(0) - w(0) * r(2);
    **delta_v(2) = w(1) * r(1) - w(1) * r(0);** //这里叉乘感觉 应该是w(0) * r(1) - w(1) * r(0)
    v = v + delta_v;

....
}

  1. data_pretreat_flow.cpp 中
bool DataPretreatFlow::TransformData() {
    gnss_pose_ = Eigen::Matrix4f::Identity();

    current_gnss_data_.UpdateXYZ();
    gnss_pose_(0,3) = current_gnss_data_.local_E;
    gnss_pose_(1,3) = current_gnss_data_.local_N;
    gnss_pose_(2,3) = current_gnss_data_.local_U;
    gnss_pose_.block<3,3>(0,0) = current_imu_data_.GetOrientationMatrix();
    gnss_pose_ *= lidar_to_imu_;

    **current_velocity_data_.TransformCoordinate(lidar_to_imu_);**//该变换感觉是反了,是否应该改为lidar_to_imu_.reverse().
    distortion_adjust_ptr_->SetMotionInfo(0.1, current_velocity_data_);
    distortion_adjust_ptr_->AdjustCloud(current_cloud_data_.cloud_ptr, current_cloud_data_.cloud_ptr);

    return true;
}


3.distortion_adjust.cpp

bool DistortionAdjust::AdjustCloud(...)
{
    float orientation_space = 2.0 * M_PI;
    float delete_space = 5.0 * M_PI / 180.0;
    float start_orientation = atan2(origin_cloud_ptr->points[0].y, origin_cloud_ptr->points[0].x);

    Eigen::AngleAxisf t_V(start_orientation, Eigen::Vector3f::UnitZ());
    Eigen::Matrix3f rotate_matrix = t_V.matrix();
    Eigen::Matrix4f transform_matrix = Eigen::Matrix4f::Identity();
    transform_matrix.block<3,3>(0,0) = rotate_matrix.inverse();
   pcl::transformPointCloud(*origin_cloud_ptr, *origin_cloud_ptr, transform_matrix);// 这边为什么要将 首个激光点 旋转到 雷达的X轴上去呢?
    velocity_ = rotate_matrix * velocity_;// 没能明白您这里的线速度和角速度为什么还需要坐标变换,您能解释下吗,麻烦了。
    angular_rate_ = rotate_matrix * angular_rate_;

    for (size_t point_index = 1; point_index < origin_cloud_ptr->points.size(); ++point_index) {
        float orientation = atan2(origin_cloud_ptr->points[point_index].y, origin_cloud_ptr->points[point_index].x);
        if (orientation < 0.0)
            orientation += 2.0 * M_PI;
        
        if (orientation < delete_space || 2.0 * M_PI - orientation < delete_space)
            continue;

        float real_time = fabs(orientation) / orientation_space * scan_period_ - scan_period_ / 2.0;

        Eigen::Vector3f origin_point(origin_cloud_ptr->points[point_index].x,
                                     origin_cloud_ptr->points[point_index].y,
                                     origin_cloud_ptr->points[point_index].z);

        Eigen::Matrix3f current_matrix = UpdateMatrix(real_time);
        Eigen::Vector3f rotated_point = current_matrix * origin_point;
        Eigen::Vector3f adjusted_point = rotated_point + velocity_ * real_time;
        CloudData::POINT point;
        point.x = adjusted_point(0);
        point.y = adjusted_point(1);
        point.z = adjusted_point(2);
        output_cloud_ptr->points.push_back(point);
    }

    pcl::transformPointCloud(*output_cloud_ptr, *output_cloud_ptr, transform_matrix.inverse());
    return true;
}
@Little-Potato-1990
Copy link
Owner

Little-Potato-1990 commented Jun 13, 2020 via email

@LeegoChen
Copy link
Author

大概明白您的意思了,您看我理解有没有错。 但这样可能会带来一个问题。假如当中间某个点求出来的角度是1°,没有halfpassed,也就没法知道这个点到底是1°还是361°,也就没法判断这个点相对swap第一个点,雷达是转了1°还是361°。 所以您通过下面的判断,不对第一个点附近的点做处理。
if (orientation < delete_space || 2.0 * M_PI - orientation < delete_space) continue;
微信已加,望能多向您学习!

@luameows
Copy link

@FrogyChen 请教下关于第2点中,gnss_pose_ *= lidar_to_imu_;这里的乘法顺序是不是写反了,位姿变换应该是左乘lidar_to_imu_的方式,将坐标系转换到velo_link下吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants