前期相关ROS学习备忘

来源:互联网 发布:科比10总决赛数据 编辑:程序博客网 时间:2024/05/20 01:12
1.删除opt目录中的文件:rm -fr /opt/*(rm -fr /opt/ros/kinetic/ardrone_autonomy)
2.basgrc文件的显示方法:linux的bashrc文件在/home目录下,但是是一个隐藏文件,在文件管理器里面按Ctrl+H即可显示(显示为.bashrc,前面小点儿表示隐藏文件)。也可以直接利用terminal直接打开
3.如何查看Ubuntu版本:cat /etc/issue
4.删除ROS的方法:sudo apt-get purge ros-*
         sudo rm -rf /etc/ros
         gedit ~/.bashrc  带有kinetic的那一行删除,保存,然后:
         source ~/.bashrc
5.解决“Could not get lock /var/lib/dpkg/lock ”问题方法:
        
        ps -A | grep apt-get(显示所有正在运行的线程)
        sudo kill “processnumber”(关闭apt-get相关线程)
6.ardone_autonomy的源码安装:
   $ cd ~/catkin_ws/src
   $ git clone https://github.com/AutonomyLab/ardrone_autonomy.git -b indigo-devel
   $ cd ~/catkin_ws
   $ rosdep install --from-paths src -i
   $ catkin_make ardrone_autonomy  (注意单独编译ardrone_autonomy)
   $ source ~/catkin_ws/devel/setup.bash
7.tum_ardrone安装总结
(1)在ubuntu 16.04.3 LTS下安装
(2)ROS版本为kinetic
 (3)安装ardrone_autonomy:
    $ cd ~/catkin_ws/src
    $ git clone https://github.com/AutonomyLab/ardrone_autonomy.git -b indigo-devel
    $ cd ~/catkin_ws
    $ rosdep install --from-paths src -i
    $ catkin_make --pkg ardrone_autonomy
(3)安装tum_ardrone
    $ cd catkin_ws/src
    $ git clone https://github.com/tum-vision/tum_ardrone.git -b hydro-devel
   (
      在/home/wm/catkin_ws/src/tum_ardrone/src/UINode中找到RosThread.cpp和RosThread.h文件,之后在包含文件前后添加:
          #ifndef Q_MOC_RUN
          #include...
          #include...
          #include...
          #endif
      )
    $ cd ..
    $ rosdep install tum_ardrone
    $ catkin_make --pkg tum_ardrone
8.tum_adrone基本操作
(1)roscore
 (2) roslaunch tum_ardrone ardrone_driver.launch
 (3) roslaunch tum_ardrone tum_ardrone.launch
9.安装调试ORB_SLAM2相关
    一,9.14日运行在线程序步骤:
    1.roscore
    2.roslaunch uvc_camera.launch (在~/catkin_ws/src/rbx1/rbx1_vision/launch中)
    3.rostopic echo /camera/rgb/image_raw(正常的话可以看见视频流数据)
    4.打开“/home/wm/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/ros_mono.cc”
      修改为“ros::Subscriber sub = nodeHandler.subscribe("/camera/rgb/image_raw", 1,      
             &ImageGrabber::GrabImage,&igb);”
    5.$ cd ORB_SLAM2
      $ chmod +x build.sh
      $ ./build.sh
    6.$ chmod +x build_ros.sh
      $ ./build_ros.sh             (重新编译执行文件)
    7.rosrun ORB_SLAM2 Mono /home/wm/catkin_ws/src/ORB_SLAM2/Vocabulary/ORBvoc.txt /home/wm/catkin_ws/src/ORB_SLAM2/my.yaml (在//home/wm/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2中)
    二,解决找不到Eigen 的问题
      编译过程中遇到

      /usr/local/include/vikit/math_utils.h:12:22: fatal error: Eigen/Core: No such file or directory

      但是,我是确定安装了eigen的,这是怎么回事呢~

      使用pkg-config 检测我的安装

      pkg-config --cflags eigen
      Package eigen was not found in the pkg-config search path.
      Perhaps you should add the directory containing `eigen.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'eigen' found

      再次检测

      pkg-config --cflags eigen3
      -I/usr/local/include/eigen3

      于是cd /usr/local/include
          $ sudo ln -s ./eigen3/Eigen/   ./Eigen

      再次使用IDE编译,通过~
10.按照“https://turtlebot3.robotis.com/en/latest/sbc_software.html”介绍的Sbc软件安装方法时出现了找不到amcl定位包的解决方法
   (1)执行ROS自动安装程序:
       sudo apt-get update
       sudo apt-get upgrade
       wget https://raw.githubusercontent.com/ROBOTIS-GIT/robotis_tools/master/install_ros_kinetic.sh && chmod 755 ./install_ros_kinetic.sh && bash ./install_ros_kinetic.sh
之后观察ROS已经安装成功,但在编译Catkin_ws中的turtlebot相关包时提示“amcl”没有安装
   (2)执行相关程序安装:
    sudo apt-get install ros-kinetic-joy ros-kinetic-teleop-twist-joy ros-kinetic-teleop-twist-keyboard ros-kinetic-laser-proc ros-kinetic-rgbd-launch ros-kinetic-depthimage-to-laserscan ros-kinetic-rosserial-arduino ros-kinetic-rosserial-python ros-kinetic-rosserial-server ros-kinetic-rosserial-client ros-kinetic-rosserial-msgs ros-kinetic-amcl ros-kinetic-map-server ros-kinetic-move-base ros-kinetic-urdf ros-kinetic-xacro ros-kinetic-compressed-image-transport ros-kinetic-rqt-image-view ros-kinetic-gmapping ros-kinetic-navigation
       以上语句将安装相关定位程序包
   (3)之后重新执行:
     wget https://raw.githubusercontent.com/ROBOTIS-GIT/robotis_tools/master/install_ros_kinetic.sh && chmod 755 ./install_ros_kinetic.sh && bash ./install_ros_kinetic.sh
    或在catkin_ws目录中执行:
    catkin_make
     编译应用程序包即可解决
11.Turtlebot3的PC端启动程序
   (1)roscore
   (2)roslaunch turtlebot3_bringup turtlebot3_model.launch  (Run RViz)
    (3)roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch  (启动键盘控制程序)
12.Turtlebot3的Robot端启动程序
  (1)roslaunch turtlebot3_bringup turtlebot3_robot.launch  (Bring up basic packages to start TurtleBot3 applications.)
13.解决运用sudo  apt-get install 安装软件时会出现一下的情况“E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?”的问题。
(1)找到并且杀掉所有的apt-get 和apt进程:ps -A | grep apt
(2)杀死进程号ID: sudo kill -9 进程ID