1. 程式人生 > 實用技巧 >瓜大無人船踩坑記3

瓜大無人船踩坑記3

  1. 裝置準備

    • 手柄
    • 電池(2塊)
    • 電臺及天線
    • 電臺電池(12V)
    • 網線1根
    • 計算機
  2. 設定計算機網路

    • 靜態ip地址

    • 網段:192.168.0.x

      已佔用的地址:

      192.168.0.57  usv3-laptop
      192.168.0.205 hans-linuxpc
      
    • 工控機密碼123

  3. 設定工控機網路

    • 靜態ip地址,無需改動

    • 連線鍵盤滑鼠,使用

      sudo gedit /etc/hosts
      

      在其中新增你的pc:

      192.168.0.x  xxxxxx
      
  4. 遠端連線伺服器

    • ping測試

      # usv3
      # you can also ping usv3-laptop
      ping 192.168.0.57
      # inet(usv)
      ping 192.168.0.11
      # inet(land)
      ping 192.168.0.26
      
    • 遠端登入

      ssh usv3@usv3-laptop
      
  5. 編譯

    cd ~/dev/catkin_ws_serial_03
    catkin_make
    
  6. 推進器連線電源,並開啟開關

  7. 依次連線SBG、GPS、推進器

    賦許可權:

    dmesg | grep tty
    

    看一下是不是3個,然後:

    sudo chmod a+rw /dev/ttyUSB0
    sudo chmod a+rw /dev/ttyUSB1
    sudo chmod a+rw /dev/ttyUSB2
    
  8. 執行ros命令

    記得每次都需要遠端連線,並

    cd ~/dev/catkin_ws_serial_03
    source devel/setup.bash
    

    隨後:

    roscore
    

    執行:

    roslaunch launch_files npu_asv_sensor.launch
    
    SUMMARY
    ========
    
    CLEAR PARAMETERS
     * /ekf_se_ship3/
    
    PARAMETERS
     * /ekf_se_ship3/acceleration_gains: [0.8, 0.0, 0.0, 0...
     * /ekf_se_ship3/acceleration_limits: [1.3, 0.0, 0.0, 0...
     * /ekf_se_ship3/base_link_frame: base_link
     * /ekf_se_ship3/control_config: [True, False, Fal...
     * /ekf_se_ship3/control_timeout: 0.2
     * /ekf_se_ship3/debug: False
     * /ekf_se_ship3/debug_out_file: /path/to/debug/fi...
     * /ekf_se_ship3/deceleration_gains: [1.0, 0.0, 0.0, 0...
     * /ekf_se_ship3/deceleration_limits: [1.3, 0.0, 0.0, 0...
     * /ekf_se_ship3/frequency: 30
     * /ekf_se_ship3/imu0: /imu_data1
     * /ekf_se_ship3/imu0_config: [False, False, Fa...
     * /ekf_se_ship3/imu0_differential: False
     * /ekf_se_ship3/imu0_linear_acceleration_rejection_threshold: 0.8
     * /ekf_se_ship3/imu0_nodelay: False
     * /ekf_se_ship3/imu0_pose_rejection_threshold: 0.8
     * /ekf_se_ship3/imu0_queue_size: 5
     * /ekf_se_ship3/imu0_relative: False
     * /ekf_se_ship3/imu0_remove_gravitational_acceleration: False
     * /ekf_se_ship3/imu0_twist_rejection_threshold: 0.8
     * /ekf_se_ship3/initial_estimate_covariance: ['1e-9', 0, 0, 0,...
     * /ekf_se_ship3/map_frame: map
     * /ekf_se_ship3/odom0: /odom
     * /ekf_se_ship3/odom0_config: [True, True, Fals...
     * /ekf_se_ship3/odom0_differential: True
     * /ekf_se_ship3/odom0_nodelay: False
     * /ekf_se_ship3/odom0_pose_rejection_threshold: 5
     * /ekf_se_ship3/odom0_queue_size: 10
     * /ekf_se_ship3/odom0_relative: False
     * /ekf_se_ship3/odom0_twist_rejection_threshold: 1
     * /ekf_se_ship3/odom1: example/odom
     * /ekf_se_ship3/odom1_config: [True, True, Fals...
     * /ekf_se_ship3/odom1_differential: False
     * /ekf_se_ship3/odom1_nodelay: False
     * /ekf_se_ship3/odom1_pose_rejection_threshold: 2
     * /ekf_se_ship3/odom1_queue_size: 10
     * /ekf_se_ship3/odom1_relative: True
     * /ekf_se_ship3/odom1_twist_rejection_threshold: 1
     * /ekf_se_ship3/odom_frame: odom
     * /ekf_se_ship3/pose0: example/pose
     * /ekf_se_ship3/pose0_config: [True, True, Fals...
     * /ekf_se_ship3/pose0_differential: True
     * /ekf_se_ship3/pose0_nodelay: False
     * /ekf_se_ship3/pose0_queue_size: 5
     * /ekf_se_ship3/pose0_rejection_threshold: 2
     * /ekf_se_ship3/pose0_relative: False
     * /ekf_se_ship3/print_diagnostics: True
     * /ekf_se_ship3/process_noise_covariance: [0.05, 0, 0, 0, 0...
     * /ekf_se_ship3/publish_acceleration: False
     * /ekf_se_ship3/publish_tf: False
     * /ekf_se_ship3/sensor_timeout: 1
     * /ekf_se_ship3/stamped_control: False
     * /ekf_se_ship3/transform_time_offset: 0.0
     * /ekf_se_ship3/transform_timeout: 0.0
     * /ekf_se_ship3/twist0: example/twist
     * /ekf_se_ship3/twist0_config: [False, False, Fa...
     * /ekf_se_ship3/twist0_nodelay: False
     * /ekf_se_ship3/twist0_queue_size: 3
     * /ekf_se_ship3/twist0_rejection_threshold: 2
     * /ekf_se_ship3/two_d_mode: True
     * /ekf_se_ship3/use_control: False
     * /ekf_se_ship3/world_frame: odom
     * /nmea_serial_driver_node_ship3/baud: 115200
     * /nmea_serial_driver_node_ship3/frame_id: odom
     * /nmea_serial_driver_node_ship3/port: /dev/ttyUSB2
     * /nmea_serial_driver_node_ship3/time_ref_source: gps
     * /nmea_serial_driver_node_ship3/useRMC: False
     * /rosdistro: kinetic
     * /rosversion: 1.12.14
    
    NODES
      /
        ekf_se_ship3 (robot_localization/ekf_localization_node)
        imudata_sbg_ship3 (tutorial/imudata_sbg.py)
        listener_ship3 (my_serial_node/listener)
        nmea_serial_driver_node_ship3 (nmea_navsat_driver/nmea_serial_driver)
        odom_trans_ship3 (tutorial/odom_trans_npu.py)
        sbg_serial_ship3 (my_serial_node/sbg_serial)
        sonar_listener_ship3 (my_serial_node/sonar_listener)
        sonar_serial_ship3 (my_serial_node/sonar_serial)
        utm_odometry_node_ship3 (gps_common/utm_odometry_node)
    
    ROS_MASTER_URI=http://localhost:11311
    
    process[sbg_serial_ship3-1]: started with pid [10077]
    process[listener_ship3-2]: started with pid [10078]
    process[nmea_serial_driver_node_ship3-3]: started with pid [10088]
    process[sonar_listener_ship3-4]: started with pid [10101]
    process[sonar_serial_ship3-5]: started with pid [10104]
    process[utm_odometry_node_ship3-6]: started with pid [10112]
    process[imudata_sbg_ship3-7]: started with pid [10121]
    process[odom_trans_ship3-8]: started with pid [10127]
    [ERROR] [1606464842.121274597]: Unable to open Sonarport 
    process[ekf_se_ship3-9]: started with pid [10149]
    

    執行:

    roslaunch launch_files npu_asv_actuator.launch
    
    NODES
      /
        talker_ship3 (my_serial_node/talker_ship2u1)
        thrust_serial_ship3 (my_serial_node/thrust_serial)
    
    
    

注意:
根目錄下: [. ./sens] tab 補全執行
根目錄下: [. ./ac] 補全

本地電腦catkin_boat下執行roslaunch

內容提要:瓜大無人船包編譯指南。

  1. 新建工作空間與原始檔夾

    mkdir -p [WORKSPACE]/src 
    
    192.168.0.57  usv3-laptop
    192.168.0.205 hans-linuxpc
    
  2. 嘗試編譯

    cd [WORKSPACE]/
    catkin_make
    
  3. 報錯

    -- Checking for module 'bullet'
    --   No package 'bullet' found
    CMake Error at mypackage/geometry2/tf2_bullet/CMakeLists.txt:11 (find_package):
      By not providing "Findbullet.cmake" in CMAKE_MODULE_PATH this project has
      asked CMake to find a package configuration file provided by "bullet", but
      CMake did not find one.
    
      Could not find a package configuration file provided by "bullet" with any
      of the following names:
    
        bulletConfig.cmake
        bullet-config.cmake
    
      Add the installation prefix of "bullet" to CMAKE_PREFIX_PATH or set
      "bullet_DIR" to a directory containing one of the above files.  If "bullet"
      provides a separate development package or SDK, be sure it has been
      installed.
    
    
    -- Configuring incomplete, errors occurred!
    See also "/home/hans/catkin_boat/build/CMakeFiles/CMakeOutput.log".
    See also "/home/hans/catkin_boat/build/CMakeFiles/CMakeError.log".
    Invoking "cmake" failed
    
  4. 解決

    sudo apt-get install libbullet-dev
    
  5. 繼續編譯,報錯

    -- Checking for one of the modules 'libusb'
    CMake Error at /usr/share/cmake-3.5/Modules/FindPkgConfig.cmake:578 (message):
      None of the required 'libusb' found
    Call Stack (most recent call first):
      mypackage/joystick_drivers/ps3joy/CMakeLists.txt:6 (pkg_search_module)
    
    
    CMake Error at mypackage/joystick_drivers/ps3joy/CMakeLists.txt:11 (message):
      Failed to find libusb
    
    
    -- Configuring incomplete, errors occurred!
    See also "/home/hans/catkin_boat/build/CMakeFiles/CMakeOutput.log".
    See also "/home/hans/catkin_boat/build/CMakeFiles/CMakeError.log".
    Invoking "cmake" failed
    
  6. 解決

    sudo apt-get install libusb-dev
    
  7. 繼續編譯,報錯

    -- Checking for module 'libgps'
    --   No package 'libgps' found
    CMake Error at /usr/share/cmake-3.5/Modules/FindPkgConfig.cmake:367 (message):
      A required package was not found
    Call Stack (most recent call first):
      /usr/share/cmake-3.5/Modules/FindPkgConfig.cmake:532 (_pkg_check_modules_internal)
      mypackage/gps_umd/gpsd_client/CMakeLists.txt:15 (pkg_check_modules)
    
    
    -- Configuring incomplete, errors occurred!
    See also "/home/hans/catkin_boat/build/CMakeFiles/CMakeOutput.log".
    See also "/home/hans/catkin_boat/build/CMakeFiles/CMakeError.log".
    Invoking "cmake" failed
    
  8. 解決

    sudo apt-get install libgps-dev
    
  9. 繼續編譯,報錯

    -- +++ processing catkin package: 'robot_localization'
    -- ==> add_subdirectory(mypackage/robot_localization)
    robot_localization: You did not request a specific build type: selecting 'RelWithDebInfo'.
    CMake Warning at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:76 (find_package):
      Could not find a package configuration file provided by "geographic_msgs"
      with any of the following names:
    
        geographic_msgsConfig.cmake
        geographic_msgs-config.cmake
    
      Add the installation prefix of "geographic_msgs" to CMAKE_PREFIX_PATH or
      set "geographic_msgs_DIR" to a directory containing one of the above files.
      If "geographic_msgs" provides a separate development package or SDK, be
      sure it has been installed.
    Call Stack (most recent call first):
      mypackage/robot_localization/CMakeLists.txt:9 (find_package)
    
    
    -- Could not find the required component 'geographic_msgs'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
    CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
      Could not find a package configuration file provided by "geographic_msgs"
      with any of the following names:
    
        geographic_msgsConfig.cmake
        geographic_msgs-config.cmake
    
      Add the installation prefix of "geographic_msgs" to CMAKE_PREFIX_PATH or
      set "geographic_msgs_DIR" to a directory containing one of the above files.
      If "geographic_msgs" provides a separate development package or SDK, be
      sure it has been installed.
    Call Stack (most recent call first):
      mypackage/robot_localization/CMakeLists.txt:9 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    See also "/home/hans/catkin_boat/build/CMakeFiles/CMakeOutput.log".
    See also "/home/hans/catkin_boat/build/CMakeFiles/CMakeError.log".
    Invoking "cmake" failed
    
  10. 解決

    sudo apt-get install ros-kinetic-geographic-msgs
    
  11. 繼續編譯,報錯

    [  7%] Building CXX object mypackage/joystick_drivers/joy/CMakeFiles/joy_node.dir/src/joy_node.cpp.o
    cc1: warning: command line option ‘-std=c++11’ is valid for C++/ObjC++ but not for C
    /home/hans/catkin_boat/src/mypackage/joystick_drivers/spacenav_node/src/spacenav_node.cpp:38:19: fatal error: spnav.h: 沒有那個檔案或目錄
    compilation terminated.
    mypackage/joystick_drivers/spacenav_node/CMakeFiles/spacenav_node.dir/build.make:62: recipe for target 'mypackage/joystick_drivers/spacenav_node/CMakeFiles/spacenav_node.dir/src/spacenav_node.cpp.o' failed
    make[2]: *** [mypackage/joystick_drivers/spacenav_node/CMakeFiles/spacenav_node.dir/src/spacenav_node.cpp.o] Error 1
    CMakeFiles/Makefile2:15321: recipe for target 'mypackage/joystick_drivers/spacenav_node/CMakeFiles/spacenav_node.dir/all' failed
    make[1]: *** [mypackage/joystick_drivers/spacenav_node/CMakeFiles/spacenav_node.dir/all] Error 2
    make[1]: *** 正在等待未完成的任務....
    
  12. 解決

    sudo apt-get install libspnav-dev
    
  13. 繼續編譯,報錯

    In file included from /home/hans/catkin_boat/src/mypackage/joystick_drivers/wiimote/src/wiimote_controller.cpp:45:0:
    /home/hans/catkin_boat/src/mypackage/joystick_drivers/wiimote/include/wiimote/wiimote_controller.h:49:53: fatal error: bluetooth/bluetooth.h: 沒有那個檔案或目錄
    compilation terminated.
    mypackage/joystick_drivers/wiimote/CMakeFiles/wiimote_node.dir/build.make:62: recipe for target 'mypackage/joystick_drivers/wiimote/CMakeFiles/wiimote_node.dir/src/wiimote_controller.cpp.o' failed
    make[2]: *** [mypackage/joystick_drivers/wiimote/CMakeFiles/wiimote_node.dir/src/wiimote_controller.cpp.o] Error 1
    CMakeFiles/Makefile2:23860: recipe for target 'mypackage/joystick_drivers/wiimote/CMakeFiles/wiimote_node.dir/all' failed
    make[1]: *** [mypackage/joystick_drivers/wiimote/CMakeFiles/wiimote_node.dir/all] Error 2
    make[1]: *** 正在等待未完成的任務....
    
  14. 解決

    sudo apt-get install libbluetooth-dev
    
  15. 繼續編譯,報錯

    [ 94%] Building CXX object mypackage/geometry2/tf2_ros/CMakeFiles/tf2_ros_buffer_server.dir/src/buffer_server_main.cpp.o
    In file included from /home/hans/catkin_boat/src/mypackage/joystick_drivers/wiimote/src/wiimote_controller.cpp:45:0:
    /home/hans/catkin_boat/src/mypackage/joystick_drivers/wiimote/include/wiimote/wiimote_controller.h:52:35: fatal error: cwiid.h: 沒有那個檔案或目錄
    compilation terminated.
    [ 94%] Linking CXX executable /home/hans/catkin_boat/devel/lib/joy/joy_node
    mypackage/joystick_drivers/wiimote/CMakeFiles/wiimote_node.dir/build.make:62: recipe for target 'mypackage/joystick_drivers/wiimote/CMakeFiles/wiimote_node.dir/src/wiimote_controller.cpp.o' failed
    make[2]: *** [mypackage/joystick_drivers/wiimote/CMakeFiles/wiimote_node.dir/src/wiimote_controller.cpp.o] Error 1
    make[2]: *** 正在等待未完成的任務....
    
  16. 解決

    sudo apt-get install libcwiid-dev
    
  17. 編譯完成。