mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-25 16:40:36 +08:00
Collision Prevention: Scale obstacle distance with vehicle attitude for varying sensor orientations (#24107)
This commit is contained in:
@@ -800,7 +800,10 @@ void GZBridge::laserScantoLidarSensorCallback(const gz::msgs::LaserScan &scan)
|
||||
pose_orientation.y(),
|
||||
pose_orientation.z());
|
||||
|
||||
const gz::math::Quaterniond q_left(0.7071068, 0, 0, -0.7071068);
|
||||
|
||||
const gz::math::Quaterniond q_front(0.7071068, 0.7071068, 0, 0);
|
||||
|
||||
const gz::math::Quaterniond q_down(0, 1, 0, 0);
|
||||
|
||||
if (q_sensor.Equal(q_front, 0.03)) {
|
||||
@@ -809,8 +812,15 @@ void GZBridge::laserScantoLidarSensorCallback(const gz::msgs::LaserScan &scan)
|
||||
} else if (q_sensor.Equal(q_down, 0.03)) {
|
||||
distance_sensor.orientation = distance_sensor_s::ROTATION_DOWNWARD_FACING;
|
||||
|
||||
} else if (q_sensor.Equal(q_left, 0.03)) {
|
||||
distance_sensor.orientation = distance_sensor_s::ROTATION_LEFT_FACING;
|
||||
|
||||
} else {
|
||||
distance_sensor.orientation = distance_sensor_s::ROTATION_CUSTOM;
|
||||
distance_sensor.q[0] = q_sensor.W();
|
||||
distance_sensor.q[1] = q_sensor.X();
|
||||
distance_sensor.q[2] = q_sensor.Y();
|
||||
distance_sensor.q[3] = q_sensor.Z();
|
||||
}
|
||||
|
||||
_distance_sensor_pub.publish(distance_sensor);
|
||||
|
||||
Reference in New Issue
Block a user