한이음/GPS 좌표 트래킹을 통한 자율주행 로봇

GPS-Waypoint example package 시도(미완성본)

MZ 아이종 2022. 5. 1. 21:12

GPS좌표를 노트북에서 찍어 순서를 정해주면, 그 좌표대로 로봇이 동작하며, 장애물을 회피하며 주행하는 것이 목표다.

대부분의 경우 robot_localization packae, move_base package를 이용하며 해당 package의 경우에서도 사용하고 있다.

이 package의 경우 joystick을 이용하여 로봇을 움직여 좌표를 수집한 뒤 로봇을 동작시키는 package로 보이나, 이를 미리 mapviz 상에서 마우스로 좌표를 설정한 뒤 로봇이 이를 따라 동작하도록 해보겠다.

이번 글에서는 해당 package를 작동 시키는 것을 목적으로 한다.

 

사용버전. 노트북

˙ Samsung Ultrabook i7

˙ Ubuntu 18.04.6 LTS

˙ Ros Melodic

 

단계

1. gps-waypoint-based-autonomous-navigation-in-ros package launch 

2. roslaunch gps_waypoint_nav gps_waypoint_nav.launch error 해결

3. roslaunch gps_waypoint_nav joy_launch_control.launch error 해결

4. rosbag 파일 실행하여 이동 경로 확인

 

1. gps-waypoint-based-autonomous-navigation-in-ros package launch

해당 package를 설치한다.

아래의 명령어를 순서대로 입력하여 실행한다. 

$ cs
$ git clone https://github.com/ArghyaChatterjee/gps-waypoint-based-autonomous-navigation-in-ros.git
$ cd ..
$ catkin_make
$ source devel/setup.bash

source devel/setup.bash의 경우 ~/catkin_ws 의 위치에서 명령어를 실행시켜야 한다.

 

이대로는 package를 사용할 수 없으므로 필요한 package를 설치해 준다.

1. robot_localization

아래의 명령어를 순서대로 입력하여 실행한다.

$ cs
$ git clone https://github.com/cra-ros-pkg/robot_localization.git

이 package의 경우 Geographic Lib package가 필요하므로 이도 설치해 준다.

 

2. Geographic Lib

아래의 명령어를 순서대로 입력하여 실행한다. 

$ cs
$ git clone git://git.code.sourceforge.net/p/geographiclib/code ./geographiclib
$ cd geographiclib
$ mkdir build && cd build
$ cmake .. && make
$ sudo make install

 

만약 위의 두  package를 설치한 후 cmake 시에 아래와 같은 error가 발생할 수 있다.

#Error 1
Could not find a package configuration file provided by "GeographicLib"
 with any of the following names:

    GeographicLibConfig.cmake
    geographiclib-config.cmake
    
#Solution 
$ sudo apt-get install ros-melodic-geographic-*
$ sudo apt-get install geographiclib-*
$ sudo apt-get install libgeographic-*

#Error 2
The geographiclib-dev installer puts the FindGeographicLib.cmake file in: /usr/share/cmake/geographiclib/FindGeographicLib.cmake

   The correct location is: /usr/share/cmake-3.5/Modules   

   Indeed it depends by the version of cmake currently installed. 
   
#Solution 
$ sudo ln -s /usr/share/cmake/geographiclib/FindGeographicLib.cmake /usr/share/cmake-3.10/Modules/

 

필요 package들을 설치했으면, 수정을 하여 사용할 수 있도록 한다.

아래의 위치로 이동하여 수정이 필요한 파일을 실행시킨다.

$ cd catkin_ws/src/robot_localization/include/robot_localization
$ gedit navsat_conversion.h
$ gedit navsat_transform.h

 

두 파일의 참조되어있는 파일의 경로를 변경한다.

// Before edit
#include <GeographicLib/MGRS.hpp>
#include <GeographicLib/UTMUPS.hpp>

// After edit
#include </home/js/catkin_ws/src/geographiclib/include/GeographicLib/MGRS.hpp>
#include </home/js/catkin_ws/src/geographiclib/include/GeographicLib/UTMUPS.hpp>

// /home/js의 경우 본 작성자의 경로이니 본인의 파일 경로로 작성해 주면 된다.

 

이제 본 package 수정을 해준다. 

아래의 경로로 이동한다.

$ cd catkin_ws/src/gps-waypoint-based-autonomous-navigation-in-ros/src

 

해당 위치에 있는 .cpp 파일들을 전부 열어 #include <robot_localization/navsat_conversions.h> 가 있는 경우 수정해 주고, 없는 경우는 헤더 파일을 추가해 준다.

// Before edit
#include <robot_localization/navsat_conversions.h> 

// After edit
ㅏrobot_localization/include/robot_localization/navsat_conversions.h>

// 추가해야되는 헤더파일
#include </home/js/catkin_ws/src/geographiclib/include/GeographicLib/MGRS.hpp>
#include </home/js/catkin_ws/src/eographiclib/include/GeographicLib/UTMPS.hpp>

// /home/js의 경우 본 작성자의 경로이니 본인의 파일 경로로 작성해 주면 된다.

이후 cmake 해 준다,

$ cm

 

2. roslaunch gps_waypoint_nav gps_waypoint_nav.launch error 해결

아래의 명령어를 입력하여 lauch 하면 error message가 출력된다.

# launch command
$ roslaunch gps_waypoint_nav gps_waypoint_nav.launch

해당 방식으로 launch 했을 경우 원래의 작성자가 GPS-waypoint-based-Autonomous-Navigation-in-ROS로 package 이름을 만들어 두었기에 인식하지 못한다.

이 경우 package 이름을 gps_waypoint_nav로 변경해 주어야 한다. CMakeLists.txt, launch 파일들 등 모든 곳을 확인하여 GPS-waypoint-based-Autonomous-Navigation-in-ROS를 gps_waipoint_nav로 변경해 주어야 한다.

하지만 CMakeLists.txt 파일을 열어보면 package 이름이 outdoor_waypoint_nav로 되어있는 것을 확인할 수 있다. package 이름을 outdoor_waypoint_nav로 설정하여 동작할 경우 GPS-waypoint-based-Autonomous-Navigation-in-ROS 부분을 outdoor_waypoint_nav로 바꾼 뒤 아래의 명령어를 입력해 주면 된다. package 전체적으로 outdoor_waypoint_nav로 작성되어 있어 이 경우가 더 편리할 수 있다.

$ roslaunch outdoor_waypoint_nav gps_waypoint_nav.launch

# 경로
$ cs
$ cd gps-waypoint_nav #CMakeLists.txt
$ cd gps-waypoint_nav/launch/navigation #모든 .launch 파일
$ cd gps-waypoint_nav/launch/include #모든 .launch 파일
$ cd gps-waypoint_nav/launch/src #모든 .cpp 파일
$ cd gps-waypoint_nav/launch/scripts #모든 .py 파일
$ cd gps-waypoint_nav/launch/rviz_config #모든 .rviz 파일
$ cd gps-waypoint_nav/params #모든 .yaml 파일

 

하지만 본 작성자의 경우 gps_waypoint_nav로 outdoor_waypoint_nav와 GPS-waypoint-based-Autonomous-Navigation-in-ROS를 전부 변경해 주었다.

 

이후 launch 해 주면 다시 error가 발생한다.

# Error 1
Resource not found: husky_description
ROS path [0]=/opt/ros/melodic/share/ros
ROS path [1]=/home/js/catkin_ws/src
ROS path [2]=/opt/ros/melodic/share
The traceback for the exception was written to the log file

# Solution
$ sudo apt-get install ros-melodic-husky-description

# Error 2
Resource not found: husky_control
ROS path [0]=/opt/ros/melodic/share/ros
ROS path [1]=/home/js/catkin_ws/src
ROS path [2]=/opt/ros/melodic/share
The traceback for the exception was written to the log file

# Solution
$ sudo apt-get install ros-melodic-husky-control

# Error 3
Resource not found: husky_base
ROS path [0]=/opt/ros/melodic/share/ros
ROS path [1]=/home/js/catkin_ws/src
ROS path [2]=/opt/ros/melodic/share
The traceback for the exception was written to the log file

# Solution
$ sudo apt-get install ros-melodic-husky-base

# Error 4
RLException: environment variable 'HUSKY_MAG_CONFIG' is not set
The traceback for the exception was written to the log file

# Solution (x)

4번째 Error의 경우 환경변수 문제이다.

 

아래의 명령어를 통해 husky package를 설치한다.

$ cs
$ git clone https://git.scc.kit.edu/ugdrv/husky.git

 

문제가 되는 파일로 이동한다.

$ cd catkin_ws/src/husky/husky_bringup/launch/um6_config #um6.launch
$ cd catkin_ws/src/husky/husky_bringup/launch/um7_config #um7.launch

이 폴더 안에 있는 HUSKY_MAG_CONFIG가 문제가 되는 부분이다.

두 방법으로 문제를 해결하도록 시도하겠다.

 

ver 1.

사용하고 있는 package로 변경해 준다.

# 경로 및 파일
$ cd catkin_ws/src/gps_waypoint_nav/launch/navigation #gps_waypoint_nav.launch

#before edit
<?xml version="1.0"?>

<launch>

    <!-- Run husky_bringup -->
    <include file="$(find gps_waypoint_nav)/launch/include/husky_bringup.launch" />

    <!-- launch lms1xx lidar -->
    <include file="$(find gps_waypoint_nav)/launch/include/laser.launch" />

    <!-- launch um6 imu -->
    <include file="$(find gps_waypoint_nav)/launch/include/imu.launch" />

    <!-- launch gps -->
    <include file="$(find gps_waypoint_nav)/launch/include/gps.launch" />

    <!-- Launch robot_localization and navsat -->
    <include file="$(find gps_waypoint_nav)/launch/include/localization_run.launch"/>

    <!-- Run gmapping to create map -->
    <include file="$(find husky_navigation)/launch/gmapping.launch" />

    <!-- Launch hector_slam for laser odometry and mapping -->
    <!-- include file="$(find hector_mapping_nav)/launch/scanmatch_nav.launch" /-->

    <!-- Run husky_navigation to enable move_base -->
    <include file="$(find husky_navigation)/launch/move_base_nav.launch" />

    <!-- launch safety node to allow the user to disable velocity commands to the robot -->
    <include file="$(find gps_waypoint_nav)/launch/include/safety_node.launch" />

  <!-- Run rviz -->
     <!-- Using standard configuration file -->
  	<!--node name="rviz" pkg="rviz" type="rviz" args="-d $(find husky_viz)/rviz/model.rviz" /-->
     <!-- Using custom configuration file -->
	<!--node name="rviz" pkg="rviz" type="rviz" args="-d $(find GPS-waypoint-based-Autonomous-Navigation-in-ROS)/rviz_config/model.rviz" /-->

</launch>

#after edit
<?xml version="1.0"?>

<launch>

    <!-- launch lms1xx lidar 안쓰니 주석, 쓸때 사용하는 녀석으로 바꿔줌 
    <include file="$(find gps_waypoint_nav)/launch/include/laser.launch" /-->

    <!-- launch myahrs+ imu -->
    <include file="$(find myahrs_driver)/launch/myahrs_driver.launch" />

    <!-- launch ublox_f9p gps -->
    <include file="$(find ublox_gps)/launch/ublox_device.launch" />

    <!-- Launch robot_localization and navsat -->
    <include file="$(find tractor_localization)/launch/localization.launch"/>

    <!-- Run husky_navigation to enable move_base -->
    <include file="$(find husky_navigation)/launch/move_base.launch" />

  <!-- Run rviz -->
     <!-- Using standard configuration file -->
  	<!--node name="rviz" pkg="rviz" type="rviz" args="-d $(find husky_viz)/rviz/model.rviz" /-->
     <!-- Using custom configuration file -->
	<!--node name="rviz" pkg="rviz" type="rviz" args="-d $(find gps_waypoint_nav)/rviz_config/model.rviz" /-->

</launch>

 

myahrs_driver의 경우 이전에 설치해 둔 IMU driver를 이용한다.

trcator_locaization의 경우 아래와 같이 설치한다.

$ cs 
$ git clone https://github.com/ros-agriculture/tractor_localization

 

아래와 같이 수정한다.

$ cd cd catkin_ws/src/tractor_localization/params #my_razor.yaml
my_razor.yaml => myahrs+.yaml

#before edit
port: /dev/imu

#after edit
port: /dev/ttyACM0

$ cd cd catkin_ws/src/tractor_localization/launch #localization.launch

#before edit
<!--  Razor IMU Start  -->
<arg name="razor_config_file" default="$(find tractor_localization)/params/my_razor.yaml"/>
<node pkg="razor_imu_9dof" type="imu_node.py" name="imu_node" output="log" respawn="true" >
  <rosparam file="$(arg razor_config_file)" command="load"/>
</node>

<!--  GPS Start -->
<node pkg="nmea_navsat_driver" type="nmea_serial_driver" name="nmea_navsat_node" respawn="true" >
  <param name="port" value="/dev/gps" />
  <param name="baud" value="4800" />
</node>


#after edit
<!--  myahrs+ IMU Start  -->
<arg name="myahrs_driver_config_file" default="$(find tractor_localization)/params/myahrs+.yaml"/>
<node pkg="myahrs_driver" type="myahrs_driver" name="imu_node" output="log" respawn="true" >
  <rosparam file="$(arg myahrs_driver_config_file)" command="load"/>
</node>

<!--  GPS Start -->
<node pkg="nmea_navsat_driver" type="nmea_serial_driver" name="nmea_navsat_node" respawn="true" >
  <param name="port" value="/dev/ttyACM0" />
  <param name="baud" value="460800" />
</node>

 

ver 2.

해당 package를 변경한다.

$ cd catkin_ws/src/gps_waypoint_nav/launch/navigation #gps_waypoint_nav.launch

# Before edit
    <!-- Run husky_navigation to enable move_base -->
    <include file="$(find husky_navigation)/launch/move_base_nav.launch" />
    
#After edit    
    <!-- Run husky_navigation to enable move_base -->
    <include file="$(find husky_navigation)/launch/move_base.launch" />
    
$ cd catkin_ws/src/gps_waypoint_nav/launch/include #imu.launch

# Before edit
<rosparam file="$(env HUSKY_MAG_CONFIG)" />
<rosparam>
  orientation_stddev: 0.001
  gain: 0.01
  zeta: 0.001
  publish_tf: false
</rosparam>

#After edit
<rosparam>
  use_mag: false
  mag_bias_x: 0
  mag_bias_y: 0
  mag_bias_z: 0
  orientation_stddev: 0.001
  gain: 0.01
  zeta: 0.001
  publish_tf: false
</rosparam>

 

launch 하면 아래와 같은 긴 error가 발생한다. 

[ERROR] [1651478057.306904703]: Failed to load nodelet [/imu_data_transformer] of type [imu_transformer/imu_transformer_nodelet] even after refreshing the cache: According to the loaded plugin descriptions the class imu_transformer/imu_transformer_nodelet with base class type nodelet::Nodelet does not exist. Declared types are  RobotLocalization/EkfNodelet RobotLocalization/NavSatTransformNodelet RobotLocalization/UkfNodelet depth_image_proc/convert_metric depth_image_proc/crop_foremost depth_image_proc/disparity depth_image_proc/point_cloud_xyz depth_image_proc/point_cloud_xyz_radial depth_image_proc/point_cloud_xyzi depth_image_proc/point_cloud_xyzi_radial depth_image_proc/point_cloud_xyzrgb depth_image_proc/register image_proc/crop_decimate image_proc/crop_nonZero image_proc/crop_non_zero image_proc/debayer image_proc/rectify image_proc/resize image_publisher/image_publisher image_rotate/image_rotate image_view/disparity image_view/image laser_filters/scan_to_cloud_filter_chain nodelet_tutorial_math/Plus pcl/BAGReader pcl/BoundaryEstimation pcl/ConvexHull2D pcl/CropBox pcl/EuclideanClusterExtraction pcl/ExtractIndices pcl/ExtractPolygonalPrismData pcl/FPFHEstimation pcl/FPFHEstimationOMP pcl/MomentInvariantsEstimation pcl/MovingLeastSquares pcl/NodeletDEMUX pcl/NodeletMUX pcl/NormalEstimation pcl/NormalEstimationOMP pcl/NormalEstimationTBB pcl/PCDReader pcl/PCDWriter pcl/PFHEstimation pcl/PassThrough pcl/PointCloudConcatenateDataSynchronizer pcl/PointCloudConcatenateFieldsSynchronizer pcl/PrincipalCurvaturesEstimation pcl/ProjectInliers pcl/RadiusOutlierRemoval pcl/SACSegmentation pcl/SACSegmentationFromNormals pcl/SHOTEstimation pcl/SHOTEstimationOMP pcl/SegmentDifferences pcl/StatisticalOutlierRemoval pcl/VFHEstimation pcl/VoxelGrid stereo_image_proc/disparity stereo_image_proc/point_cloud2 swri_image_util/blend_images swri_image_util/contrast_stretch swri_image_util/crosshairs swri_image_util/draw_polygon swri_image_util/draw_text swri_image_util/image_pub swri_image_util/normalize_response swri_image_util/replace_colors swri_image_util/rotate_image swri_image_util/scale_image swri_image_util/warp_image swri_nodelet/TestNodelet swri_transform_util/dynamic_publisher swri_transform_util/gps_transform_publisher swri_transform_util/obstacle_array_transformer

[ERROR] [1651478057.307067819]: The error before refreshing the cache was: According to the loaded plugin descriptions the class imu_transformer/imu_transformer_nodelet with base class type nodelet::Nodelet does not exist. Declared types are  RobotLocalization/EkfNodelet RobotLocalization/NavSatTransformNodelet RobotLocalization/UkfNodelet depth_image_proc/convert_metric depth_image_proc/crop_foremost depth_image_proc/disparity depth_image_proc/point_cloud_xyz depth_image_proc/point_cloud_xyz_radial depth_image_proc/point_cloud_xyzi depth_image_proc/point_cloud_xyzi_radial depth_image_proc/point_cloud_xyzrgb depth_image_proc/register image_proc/crop_decimate image_proc/crop_nonZero image_proc/crop_non_zero image_proc/debayer image_proc/rectify image_proc/resize image_publisher/image_publisher image_rotate/image_rotate image_view/disparity image_view/image laser_filters/scan_to_cloud_filter_chain nodelet_tutorial_math/Plus pcl/BAGReader pcl/BoundaryEstimation pcl/ConvexHull2D pcl/CropBox pcl/EuclideanClusterExtraction pcl/ExtractIndices pcl/ExtractPolygonalPrismData pcl/FPFHEstimation pcl/FPFHEstimationOMP pcl/MomentInvariantsEstimation pcl/MovingLeastSquares pcl/NodeletDEMUX pcl/NodeletMUX pcl/NormalEstimation pcl/NormalEstimationOMP pcl/NormalEstimationTBB pcl/PCDReader pcl/PCDWriter pcl/PFHEstimation pcl/PassThrough pcl/PointCloudConcatenateDataSynchronizer pcl/PointCloudConcatenateFieldsSynchronizer pcl/PrincipalCurvaturesEstimation pcl/ProjectInliers pcl/RadiusOutlierRemoval pcl/SACSegmentation pcl/SACSegmentationFromNormals pcl/SHOTEstimation pcl/SHOTEstimationOMP pcl/SegmentDifferences pcl/StatisticalOutlierRemoval pcl/VFHEstimation pcl/VoxelGrid stereo_image_proc/disparity stereo_image_proc/point_cloud2 swri_image_util/blend_images swri_image_util/contrast_stretch swri_image_util/crosshairs swri_image_util/draw_polygon swri_image_util/draw_text swri_image_util/image_pub swri_image_util/normalize_response swri_image_util/replace_colors swri_image_util/rotate_image swri_image_util/scale_image swri_image_util/warp_image swri_nodelet/TestNodelet swri_transform_util/dynamic_publisher swri_transform_util/gps_transform_publisher swri_transform_util/obstacle_array_transformer

[FATAL] [1651478057.316939667]: Failed to load nodelet '/imu_data_transformer` of type `imu_transformer/imu_transformer_nodelet` to manager `imu_manager'

[ERROR] [1651478057.391279240]: Failed to load nodelet [/imu_filter] of type [imu_filter_madgwick/ImuFilterNodelet] even after refreshing the cache: According to the loaded plugin descriptions the class imu_filter_madgwick/ImuFilterNodelet with base class type nodelet::Nodelet does not exist. Declared types are  RobotLocalization/EkfNodelet RobotLocalization/NavSatTransformNodelet RobotLocalization/UkfNodelet depth_image_proc/convert_metric depth_image_proc/crop_foremost depth_image_proc/disparity depth_image_proc/point_cloud_xyz depth_image_proc/point_cloud_xyz_radial depth_image_proc/point_cloud_xyzi depth_image_proc/point_cloud_xyzi_radial depth_image_proc/point_cloud_xyzrgb depth_image_proc/register image_proc/crop_decimate image_proc/crop_nonZero image_proc/crop_non_zero image_proc/debayer image_proc/rectify image_proc/resize image_publisher/image_publisher image_rotate/image_rotate image_view/disparity image_view/image laser_filters/scan_to_cloud_filter_chain nodelet_tutorial_math/Plus pcl/BAGReader pcl/BoundaryEstimation pcl/ConvexHull2D pcl/CropBox pcl/EuclideanClusterExtraction pcl/ExtractIndices pcl/ExtractPolygonalPrismData pcl/FPFHEstimation pcl/FPFHEstimationOMP pcl/MomentInvariantsEstimation pcl/MovingLeastSquares pcl/NodeletDEMUX pcl/NodeletMUX pcl/NormalEstimation pcl/NormalEstimationOMP pcl/NormalEstimationTBB pcl/PCDReader pcl/PCDWriter pcl/PFHEstimation pcl/PassThrough pcl/PointCloudConcatenateDataSynchronizer pcl/PointCloudConcatenateFieldsSynchronizer pcl/PrincipalCurvaturesEstimation pcl/ProjectInliers pcl/RadiusOutlierRemoval pcl/SACSegmentation pcl/SACSegmentationFromNormals pcl/SHOTEstimation pcl/SHOTEstimationOMP pcl/SegmentDifferences pcl/StatisticalOutlierRemoval pcl/VFHEstimation pcl/VoxelGrid stereo_image_proc/disparity stereo_image_proc/point_cloud2 swri_image_util/blend_images swri_image_util/contrast_stretch swri_image_util/crosshairs swri_image_util/draw_polygon swri_image_util/draw_text swri_image_util/image_pub swri_image_util/normalize_response swri_image_util/replace_colors swri_image_util/rotate_image swri_image_util/scale_image swri_image_util/warp_image swri_nodelet/TestNodelet swri_transform_util/dynamic_publisher swri_transform_util/gps_transform_publisher swri_transform_util/obstacle_array_transformer

[ERROR] [1651478057.391583169]: The error before refreshing the cache was: According to the loaded plugin descriptions the class imu_filter_madgwick/ImuFilterNodelet with base class type nodelet::Nodelet does not exist. Declared types are  RobotLocalization/EkfNodelet RobotLocalization/NavSatTransformNodelet RobotLocalization/UkfNodelet depth_image_proc/convert_metric depth_image_proc/crop_foremost depth_image_proc/disparity depth_image_proc/point_cloud_xyz depth_image_proc/point_cloud_xyz_radial depth_image_proc/point_cloud_xyzi depth_image_proc/point_cloud_xyzi_radial depth_image_proc/point_cloud_xyzrgb depth_image_proc/register image_proc/crop_decimate image_proc/crop_nonZero image_proc/crop_non_zero image_proc/debayer image_proc/rectify image_proc/resize image_publisher/image_publisher image_rotate/image_rotate image_view/disparity image_view/image laser_filters/scan_to_cloud_filter_chain nodelet_tutorial_math/Plus pcl/BAGReader pcl/BoundaryEstimation pcl/ConvexHull2D pcl/CropBox pcl/EuclideanClusterExtraction pcl/ExtractIndices pcl/ExtractPolygonalPrismData pcl/FPFHEstimation pcl/FPFHEstimationOMP pcl/MomentInvariantsEstimation pcl/MovingLeastSquares pcl/NodeletDEMUX pcl/NodeletMUX pcl/NormalEstimation pcl/NormalEstimationOMP pcl/NormalEstimationTBB pcl/PCDReader pcl/PCDWriter pcl/PFHEstimation pcl/PassThrough pcl/PointCloudConcatenateDataSynchronizer pcl/PointCloudConcatenateFieldsSynchronizer pcl/PrincipalCurvaturesEstimation pcl/ProjectInliers pcl/RadiusOutlierRemoval pcl/SACSegmentation pcl/SACSegmentationFromNormals pcl/SHOTEstimation pcl/SHOTEstimationOMP pcl/SegmentDifferences pcl/StatisticalOutlierRemoval pcl/VFHEstimation pcl/VoxelGrid stereo_image_proc/disparity stereo_image_proc/point_cloud2 swri_image_util/blend_images swri_image_util/contrast_stretch swri_image_util/crosshairs swri_image_util/draw_polygon swri_image_util/draw_text swri_image_util/image_pub swri_image_util/normalize_response swri_image_util/replace_colors swri_image_util/rotate_image swri_image_util/scale_image swri_image_util/warp_image swri_nodelet/TestNodelet swri_transform_util/dynamic_publisher swri_transform_util/gps_transform_publisher swri_transform_util/obstacle_array_transformer

[FATAL] [1651478057.392011578]: Failed to load nodelet '/imu_filter` of type `imu_filter_madgwick/ImuFilterNodelet` to manager `imu_manager'

[imu_data_transformer-15] process has died [pid 14772, exit code 255, cmd /opt/ros/melodic/lib/nodelet/nodelet load imu_transformer/imu_transformer_nodelet imu_manager imu_in:=imu_um6 imu_out/data:=imu/data_raw imu_out/mag:=imu/mag __name:=imu_data_transformer __log:=/home/js/.ros/log/0f7c8602-c9ed-11ec-b4da-7c7a9149d865/imu_data_transformer-15.log].
log file: /home/js/.ros/log/0f7c8602-c9ed-11ec-b4da-7c7a9149d865/imu_data_transformer-15*.log

[imu_filter-16] process has died [pid 14776, exit code 255, cmd /opt/ros/melodic/lib/nodelet/nodelet load imu_filter_madgwick/ImuFilterNodelet imu_manager __name:=imu_filter __log:=/home/js/.ros/log/0f7c8602-c9ed-11ec-b4da-7c7a9149d865/imu_filter-16.log].
log file: /home/js/.ros/log/0f7c8602-c9ed-11ec-b4da-7c7a9149d865/imu_filter-16*.log

 

이 경우 아래 두 명령어를 차례로 입력해 준다.

$ sudo apt-get install ros-melodic-imu-transformer
$ sudo apt-get install ros-melodic-imu-filter-madgwick

 

// 하지만 제대로 된 동작은 확인하지 못했다.

 

3. roslaunch gps_waypoint_nav joy_launch_control.launch error 해결

이제 joystick으로 움직이는 launch를 실행한다.

# launch command
$ roslaunch gps_waypoint_nav joy_launch_control.launch

이 경우에도 error가 발생하여 고쳐준다.

 

#gps_waypoint_nav package 속에 outdoor_waypoint_nav 가 아직 존재하는 경우 gps_waypoint_nav로 변경해 준다.

$ cd catkin_ws/src/gps_waypoint_nav/scrips #joy_launch_control.py

#Before edit
    # Define location of launch files
    if sim_enabled == True:
        location_collect = rospack.get_path('gps_waypoint_nav') + "/launch/include/collect_goals.launch"
        location_send = rospack.get_path('gps_waypoint_nav') + "/launch/include/send_goals.launch"
        location_calibrate = rospack.get_path('gps_waypoint_nav') + "/launch/include/heading_calibration.launch"
        location_safety_node = rospack.get_path('gps_waypoint_nav') + "/launch/include/safety_node.launch"
        
#After edit        
    # Define location of launch files
    if sim_enabled == True:
        location_collect = rospack.get_path('gps_waypoint_nav') + "/launch/include/collect_goals_sim.launch"
        location_send = rospack.get_path('gps_waypoint_nav') + "/launch/include/send_goals_sim.launch"
        location_calibrate = rospack.get_path('gps_waypoint_nav') + "/launch/include/heading_calibration_sim.launch"
        location_safety_node = rospack.get_path('gps_waypoint_nav') + "/launch/include/safety_node.launch"
        
        
#Error
ERROR: cannot launch node of type [gps_waypoint_nav/joy_launch_control.py]: Cannot locate node of type [joy_launch_control.py] in package [gps_waypoint_nav]. Make sure file exists in package path and permission is set to executable (chmod +x)
$ cd catkin_ws/src/gps_waypoint_nav/scripts
$ sudo chmod +x joy_launch_control.py
        
# (chmod +x) 관련 error 발생 => error message 속의 문제 파일이 있는 위치로 이동해서 sudo chmod +x [파일이름.확장자] 해주면 된다.

 

launch 하면 실행된다.

 

4. rosbag 파일 실행하여 이동 경로 확인

-===-