Fix DaBai A and DaBai AL not being able to use imu

This commit is contained in:
jj
2025-05-13 17:33:20 +08:00
parent 5aa00a44c0
commit 6592493d90
4 changed files with 22 additions and 6 deletions
+2 -2
View File
@@ -1282,12 +1282,12 @@ void OBCameraNode::startIMUSyncStream() {
auto accelProfiles = imuPipeline_->getStreamProfileList(OB_SENSOR_ACCEL);
auto accel_range = fullAccelScaleRangeFromString(imu_range_[ACCEL]);
auto accel_rate = sampleRateFromString(imu_rate_[ACCEL]);
auto accelProfile = accelProfiles->getAccelStreamProfile(OB_ACCEL_FS_3g, OB_SAMPLE_RATE_200_HZ);
auto accelProfile = accelProfiles->getAccelStreamProfile(accel_range, accel_rate);
// GYRO
auto gyroProfiles = imuPipeline_->getStreamProfileList(OB_SENSOR_GYRO);
auto gyro_range = fullGyroScaleRangeFromString(imu_range_[GYRO]);
auto gyro_rate = sampleRateFromString(imu_rate_[GYRO]);
auto gyroProfile = gyroProfiles->getGyroStreamProfile(OB_GYRO_FS_250dps, OB_SAMPLE_RATE_200_HZ);
auto gyroProfile = gyroProfiles->getGyroStreamProfile(gyro_range, gyro_rate);
std::shared_ptr<ob::Config> imuConfig = std::make_shared<ob::Config>();
imuConfig->enableStream(accelProfile);
imuConfig->enableStream(gyroProfile);
+16
View File
@@ -674,6 +674,14 @@ OBAccelFullScaleRange fullAccelScaleRangeFromString(std::string &full_scale_rang
return OB_ACCEL_FS_8g;
} else if (full_scale_range == "16g") {
return OB_ACCEL_FS_16g;
} else if (full_scale_range == "3g") {
return OB_ACCEL_FS_3g;
} else if (full_scale_range == "6g") {
return OB_ACCEL_FS_6g;
} else if (full_scale_range == "12g") {
return OB_ACCEL_FS_12g;
} else if (full_scale_range == "24g") {
return OB_ACCEL_FS_24g;
} else {
RCLCPP_ERROR_STREAM(rclcpp::get_logger("utils"),
"Unknown OB_ACCEL_FULL_SCALE_RANGE: " << full_scale_range);
@@ -691,6 +699,14 @@ std::string fullAccelScaleRangeToString(const OBAccelFullScaleRange &full_scale_
return "8g";
case OB_ACCEL_FS_16g:
return "16g";
case OB_ACCEL_FS_3g:
return "3g";
case OB_ACCEL_FS_6g:
return "6g";
case OB_ACCEL_FS_12g:
return "12g";
case OB_ACCEL_FS_24g:
return "24g";
default:
return "2g";
}