欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ROS回顾学习(10): 项目研究中遇到问题记录2

程序员文章站 2022-03-03 18:57:13
...

1.ubuntu更新包

	sudo apt-get install --only-upgrade libusb-1.0-0-dev  ## 单独更新一个包

2. ROS_INFO等输出警告

		/opt/ros/kinetic/include/ros/console.h:346:176: 
		warning: format ‘%i’ expects argument of type ‘int’, but argument 8 has type ‘std::vector<cv::Point_<float> >::size_type {aka long unsigned int}[-Wformat=]
	     ::ros::console::print(filter, __rosconsole_define_location__loc.logger_, __rosconsole_define_location__loc.level_, __FILE__, __LINE__, __ROSCONSOLE_FUNCTION__, __VA_ARGS__)
		                                                                                                                                                                        ^
	/opt/ros/kinetic/include/ros/console.h:349:5: note: in expansion of macro ‘ROSCONSOLE_PRINT_AT_LOCATION_WITH_FILTER’
	     ROSCONSOLE_PRINT_AT_LOCATION_WITH_FILTER(0, __VA_ARGS__)
	     ^
	/opt/ros/kinetic/include/ros/console.h:379:7: note: in expansion of macro ‘ROSCONSOLE_PRINT_AT_LOCATION’
	       ROSCONSOLE_PRINT_AT_LOCATION(__VA_ARGS__); \
	       ^
	/opt/ros/kinetic/include/ros/console.h:561:35: note: in expansion of macro ‘ROS_LOG_COND’
	 #define ROS_LOG(level, name, ...) ROS_LOG_COND(true, level, name, __VA_ARGS__)
		                           ^
	/opt/ros/kinetic/include/rosconsole/macros_generated.h:110:23: note: in expansion of macro ‘ROS_LOG’
	 #define ROS_INFO(...) ROS_LOG(::ros::console::levels::Info, ROSCONSOLE_DEFAULT_NAME, __VA_ARGS__)
		               ^
	/home/ian/catkin_ws/src/VINS-Mono/feature_tracker/src/feature_tracker_node.cpp:294:2: note: in expansion of macro ‘ROS_INFO’
	  ROS_INFO("n_pt.size : %i", trackerData[0].n_pts.size());

错误原因: ROS_INFO输出数据格式不对,对double型数据: “%ud”, 对int型数据:“%zd”

参考链接

3.Eigen::MatrixXd 与 cv::Mat数据类型的相互转换

	cv::Mat cConverter::Matrix3dtoCvMat(const Eigen::Matrix3d &m)
    {
        cv::Mat cvMat(3,3,CV_32F);
        for(int i=0;i<3;i++)
        for(int j=0; j<3; j++)
        cvMat.at<float>(i,j)=m(i,j);
 
        return cvMat.clone();
    }

 
      Eigen::Matrix<double,3,3> cConverter::toMatrix3d(const cv::Mat &cvMat3)
      {
          Eigen::Matrix<double,3,3> M;
 
          M << cvMat3.at<float>(0,0), cvMat3.at<float>(0,1), cvMat3.at<float>(0,2),
          cvMat3.at<float>(1,0), cvMat3.at<float>(1,1), cvMat3.at<float>(1,2),
          cvMat3.at<float>(2,0), cvMat3.at<float>(2,1), cvMat3.at<float>(2,2);
 
          return M;
      }

更多其他的Matrix+SO+Mat+g2o::SE3Quat相互转换

4. ubuntu解决依赖包冲突

安装aptitude

	sudo apt-get install aptitude

使用aptitude

	sudo aptitude install <PACKAGE_NAME>

根据提示选Y/N

5. catkin_make 出现gcc错误: Error in ‘/usr/bin/c++’:

可通过这两个指令查看相关依赖:

	`ll`  ##查看可执行文件的指向的何处,如 ll  /usr/bin/gcc   
	`ldd` 	##查看库的相互依赖, 如 ldd /usr/bin/gcc
相关标签: ROS问题记录