Error: r13 not allowed here -- sub.w sp,r1,#48

x33g5p2x  于2022-01-04 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(207)

Error: r13 not allowed here -- `sub.w sp,r1,#48'

GitHub - fateshelled/bytetrack_ros: ByteTrack + ROS2 (foxy)

arm ByteTrack linux编译时出现:

/tmp/kalmanFilter-8c7928.s: Assembler messages:
/tmp/kalmanFilter-8c7928.s:6895: Error: r13 not allowed here -- `sub.w sp,r1,#48'
clang++: error: assembler command failed with exit code 1 (use -v to see invocation)

定位到代码:

void KalmanFilter::predict(KAL_MEAN &mean, KAL_COVA &covariance){
			//revise the data;
			DETECTBOX std_pos;
			std_pos << _std_weight_position * mean(3),_std_weight_position * mean(3),1e-2,_std_weight_position * mean(3);
			DETECTBOX std_vel;
			std_vel << _std_weight_velocity * mean(3),_std_weight_velocity * mean(3),1e-5,_std_weight_velocity * mean(3);
			KAL_MEAN tmp;
			tmp.block<1, 4>(0, 0) = std_pos;
			tmp.block<1, 4>(0, 4) = std_vel;
			tmp = tmp.array().square();
			KAL_COVA motion_cov = tmp.asDiagonal();
			KAL_MEAN mean1 = this->_motion_mat * mean.transpose();
			// KAL_COVA covariance1 = this->_motion_mat * covariance *(_motion_mat.transpose());
			//covariance1 += motion_cov;

			// mean = mean1;
			//covariance = covariance1;
			covariance = motion_cov;
		}

报错代码:

KAL_MEAN mean1 = this->_motion_mat * mean.transpose();

8x8 *8x1不支持。

Eigen::Matrix<float, 8, 8, Eigen::RowMajor> _motion_mat1;
Eigen::Matrix<float, 1, 8, Eigen::RowMajor> meana;
Eigen::Matrix<float, 1, 8, Eigen::RowMajor> mean2=_motion_mat1*meana.transpose();

其中,

_motion_mat定义:

         Eigen::Matrix<float, 8, 8, Eigen::RowMajor> _motion_mat;
            Eigen::Matrix<float, 4, 8, Eigen::RowMajor> _update_mat;

KAL_MEAN定义: 

 typedef Eigen::Matrix<float, 1, 8, Eigen::RowMajor> KAL_MEAN;

数据定义:

 typedef Eigen::Matrix<float, 1, 8, Eigen::RowMajor> KAL_MEAN;
    typedef Eigen::Matrix<float, 8, 8, Eigen::RowMajor> KAL_COVA;
    typedef Eigen::Matrix<float, 1, 4, Eigen::RowMajor> KAL_HMEAN;
    typedef Eigen::Matrix<float, 4, 4, Eigen::RowMajor> KAL_HCOVA;

这个就OK:

Eigen::Matrix<float, 4, 8, Eigen::RowMajor> up1;
			
			Eigen::Matrix<float, 1, 8, Eigen::RowMajor> h1;
			Eigen::Matrix<float, 1, 4, Eigen::RowMajor> h2= up1 * h1.transpose();

4x8 * 8x1 ,结果应该是4x1,不知道为什么这里是ok的。

如果把Eigen::Matrix<float, 1, 4, Eigen::RowMajor> h2 改为:

Eigen::Matrix<float, 4, 1, Eigen::RowMajor>,则会报错:

/mnt/d/project/changcheng/car20210326_track/mask_android/../eigen-3.3.9/Eigen/src/Core/AssignEvaluator.h:833:3: error: static_assert failed
      "YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES"
  EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(ActualDstTypeCleaned,Src)

或者这个错误:

/mnt/d/project/changcheng/car20210326_track/mask_android/../eigen-3.3.9/Eigen/src/Core/CwiseBinaryOp.h:109:7: error: static_assert failed
      "YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES"
      EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Lhs, Rhs)

一般代表运算过程维度错误。

我的解决方法:换了ndk版本,原来用的ndk 15rc,换成r21e版本,就解决了。

#export ANDROID_NDK=/mnt/d/android-ndk-r15c-linux-x86_64/android-ndk-r15c
export ANDROID_NDK=/mnt/d/android-ndk-r21e-linux-x86_64/android-ndk-r21e

相关文章

微信公众号

最新文章

更多