使用大陆ARS408毫米波雷达进行目标检测,速度和目标运动状态不理想,请求指点
按照大陆ARS408毫米波雷达手册,选择Object模式,输入自车的横摆角速度yaw_rate和自车线速度speed,相关代码参考Apollo,解析并输出目标的相对运动状态和检测速度,此时出现问题:
1)自车向右旋转时,静止目标状态检测错误,均为运动状态;自车向左旋转时,静止目标运动状态输出为静止;自车直线行驶时,目标运动状态输出正确;
2)按照毫米波雷达速度+自车线速度+角速度附加速度的公式计算目标在世界坐标系下的速度,自车直线行驶时目标运动速度正确,但是当车辆旋转时最终计算的速度不准确,具体表现在静止目标最终计算速度不接近0m/s,误差在2-3m/s左右。
//添加速度给radar
void MotionInputSpeed300::UpdateData(uint8_t* data) {
if (std::isnan(speed_)) {
AWARN << "speed is nan";
return;
}
uint32_t speed_direction = 0;
if (fabs(speed_) < 0.02) {
speed_direction = 0;
} else if (speed_ < 0) {
speed_direction = 2;
} else {
speed_direction = 1;
}
uint32_t speed_value = static_cast<uint32_t>(fabs(speed_) / 0.02);
Byte frame_speed_direction(data);
frame_speed_direction.set_value(
static_cast<unsigned char>((speed_direction << 6) & 0x00C0) |
static_cast<unsigned char>((speed_value & 0x1F00) >> 8),
0, 8);
Byte frame_speed(data + 1);
frame_speed.set_value(static_cast<unsigned char>(speed_value & 0x00FF), 0, 8);
}
//添加yaw_rate给radar
void MotionInputYawRate301::UpdateData(uint8_t* data) {
if (std::isnan(yaw_rate_)) {
AWARN << "yaw_rate is nan";
return;
}
// Due to radar 408 manual: max 327.68, res 0.01, unit:deg/s
uint32_t yaw_rate_value = static_cast<uint32_t>((yaw_rate_ + 327.68) * 100);
Byte yaw_rate_low(data);
yaw_rate_low.set_value(
static_cast<unsigned char>((yaw_rate_value & 0xFF00) >> 8), 0, 8);
Byte yaw_rate_high(data + 1);
yaw_rate_high.set_value(static_cast<unsigned char>(yaw_rate_value & 0x00FF),
0, 8);
}
//计算世界坐标系下的毫米波雷达目标速度
Eigen::Matrix4d radar2world = frame->sensor2world_pose.matrix();
Eigen::Matrix3d radar2world_rotate = radar2world.block<3, 3>(0, 0).cast<double>();
Eigen::Matrix3d radar2novatel_rot = radar2gnss.matrix().block<3, 3>(0, 0).cast<double>();
// 2. 提取车辆运动参数
// 角速度(转换为弧度,并构建叉乘矩阵)
Eigen::Vector3d angular_speed_body(
gnss_data.twist.twist.angular.x,
gnss_data.twist.twist.angular.y,
gnss_data.twist.twist.angular.z
);
Eigen::Matrix3d omega_skew;
omega_skew << 0, -angular_speed_body.z(), angular_speed_body.y(),
angular_speed_body.z(), 0, -angular_speed_body.x(),
-angular_speed_body.y(), angular_speed_body.x(), 0;
// 3. 坐标系转换
// 将车体坐标系下的角速度叉乘矩阵转换到雷达坐标系
Eigen::Matrix3d omega_radar = radar2novatel_rot.inverse() * omega_skew * radar2novatel_rot;
// 4. 遍历目标进行速度修正
for (auto& obj : frame->objects) {
// 获取目标在雷达坐标系中的位置
Eigen::Vector3d pos_radar = obj->center_orig.cast<double>();
// 计算角速度引起的附加速度: ω × r (雷达坐标系)
Eigen::Vector3d angular_induced_speed = omega_radar * pos_radar;
// 雷达检测的目标速度(雷达坐标系)
Eigen::Vector3d velocity_radar = obj->velocity.cast<double>();
// 总速度 = 检测速度 + 角速度附加速度
Eigen::Vector3d total_velocity_radar = velocity_radar + angular_induced_speed;
// 转换到世界坐标系
Eigen::Vector3d velocity_world = radar2world_rotate * total_velocity_radar;
// 叠加车辆线速度
velocity_world += linear_speed_world;
// 更新目标速度
obj->velocity = velocity_world.cast<float>();
Eigen::Vector4d coor_in_radar(obj->center(0), obj->center(1), obj->center(2), 1.0);
Eigen::Vector4d coor_in_world = radar2world * coor_in_radar;
obj->center = coor_in_world.head<3>();
obj->anchor_point = obj->center;