ROS/GPS

ublox ZED-f9p GPS(RTK) 사용

hm02123 2022. 2. 1. 04:35
728x90
  • Ubuntu 18.04
  • ROS Melodic 
  • Ublox ZED-f9p

 

 

 

 

1. 보드 연결 

(1) usb 케이블을 이용하여 GPS 보드와 PC를 연결해준다.

(2) 기기에 할당된 이름을 확인해준다.

(3) 기기에 권한을 부여해준다.

 

$ ls /dev/tty*
$ sudo chmod 777 /dev/tty*

 

 

2. 드라이버 설치 

 

(1) 깃허브에서 ublox_f9p 패키지를 설치해준다.

(2) 다운로드한 ublox_f9p 패키지 파일 안에 ntrip_ros를 설치해준다.

(3) 노드가 퍼블리쉬할 토픽의 메시지 타입을 다운로드한다.

(4) 다운로드한 패키지를 모두 빌드해준다.

(5) source ~/.bashrc를 해준다.

 

$ cd ~/catkin_ws/src
$ git clone https://github.com/ros-agriculture/ublox_f9p
$ cd ublox_f9p
$ git clone https://github.com/ros-agriculture/ntrip_ros
$ git clone https://github.com/tilk/rtcm_msgs
$ cd ..
$ catkin_make
$ source ~/.bashrc

 

3. 파라미터 파일 수정

 

파라미터 파일인 /ublox_gps/config/zed-f9p.yaml을 수정한다.

1. 에서 확인한 보드와 연결한 포트 이름을 device: /~ 부분에 넣어 수정해준다.

 

# Configuration Settings for ZED-F9P device

debug: 1                    # Range 0-4 (0 means no debug statements will print)

device: /dev/ttyACM0
frame_id: gps

uart1:
  baudrate: 460800

# Enable u-blox message publishers
publish:
  all: false
  nav:
    all: true
    relposned: true
    posllh: true
    posecef: true

 

※ 포트 오류가 난다면 포드 명을 확인한 후 문제가 없다면 아래 링크를 참고하도록 한다.※

https://github.com/esp8266/source-code-examples/issues/26

 

Cannot open /dev/ttyUSB0: Permission denied · Issue #26 · esp8266/source-code-examples

I had an issue , while trying to do flash Cannot open /dev/ttyUSB0: Permission denied https://bugs.launchpad.net/ubuntu/+source/gtkterm/+bug/949597 I palliated to this problem with the command &quo...

github.com

https://github.com/KumarRobotics/ublox/issues/127

 

Unable to Poll Monver issue · Issue #127 · KumarRobotics/ublox

Hi, I have connected a zed f9p using UART1 with UBX and NMEA at 115200 baud rate but I am unable to use ublox ros as it fails with the following code: [INFO] [1615994871.828988598]: U-Blox: Opened ...

github.com

 

 

4. ublox_f9p 패키지의 launch 파일 수정

 

/ublox_gps/launch/ublox_device.launch 파일을 수정해준다. 

 

<launch> 부분의 첫 줄 <arg name="node_name" /> 부분에 value="zed-f9p"를 추가해준 후 doc와 default를 value로 수정해준다. 

또한 doc 부분을 value="zed-f9p"로 수정해준 후 clear_param 줄의 true를 false로 바꿔준다.

 

## 수정 전 ##

 

<?xml version="1.0" encoding="UTF-8"?>

<launch>
  <arg name="node_name" />
  <arg name="param_file_name" doc="name of param file, e.g. rover" />
  <arg name="output" default="screen" />
  <arg name="respawn" default="true" />
  <arg name="respawn_delay" default="30" />
  <arg name="clear_params" default="true" />

  <node pkg="ublox_gps" type="ublox_gps" name="$(arg node_name)"
        output="$(arg output)" 
        clear_params="$(arg clear_params)"
        respawn="$(arg respawn)" 
        respawn_delay="$(arg respawn_delay)">
    <rosparam command="load" 
              file="$(find ublox_gps)/config/$(arg param_file_name).yaml" />
  </node>
</launch>

 

## 수정 후 ##

 

<?xml version="1.0" encoding="UTF-8"?>

<launch>
  <arg name="node_name" value="ublox_gps"/>
	    <arg name="param_file_name" value="zed-f9p"/>
	    <arg name="output" value="screen"/>
	    <arg name="respawn" value="true"/>
	    <arg name="respawn_delay" value="30"/>
	    <arg name="clear_params" value="false"/>

  <node pkg="ublox_gps" type="ublox_gps" name="$(arg node_name)"
        output="$(arg output)" 
        clear_params="$(arg clear_params)"
        respawn="$(arg respawn)" 
        respawn_delay="$(arg respawn_delay)">
    <rosparam command="load" 
              file="$(find ublox_gps)/config/$(arg param_file_name).yaml" />
  </node>
</launch>

 

 

5. RTK 사용 

 

(1) 국토지리정보원 회원 가입

(2) ntrip client 패키지 설치

  • 이는 위 2. 드라이버 설치에서 미리 설치해 두었으므로 넘어가도록 한다.

(3) ublox 스크립트 수정

처음 설치한 ublox_f9p 패키지의 /ublox_gps/src/node.cpp 파일에 RTK 보정 신호인 RTCM을 받기 위한 부분이 존재한다.  이때 ntrip client 노드에서 퍼블리쉬하는 토픽의 이름, 메시지 타입과 ublox 노드가 서브 스크라이브 하는 것이 같아야 한다. 따라서 수정이 필요하다.

※ 토픽 이름은 /ublox_gps/rtcm으로 할 것이다. ※

 

/ublox_gps/src/node.cpp 스크립트에 토픽 이름을 수정해준다. (1861 번째 줄을 아래와 같이 수정한다.)

 

## 수정 전 ##

param_nh.param("rtcm_topic", rtcm_topic, std::string("rtcm"));

## 수정 후 ##

param_nh.param("/ublox_gps/rtcm", rtcm_topic, std::string("rtcm"));

 

cpp 파일을 수정해줬으므로 다시 catkin_make를 통해 빌드를 해준다.

 

(4) ntrip launch 파일 수정 

4. ublox_f9p 패키지의 launch 파일 수정에서 value로 바꿔준 부분을 수정하여 RTK 신호를 받을 수 있도록 한다.

  • rtcm_topic의 value를 아까 설정한 토픽 이름인 /ublox_gps/rtcm으로 수정해준다.
  • ntrip_server의 value를 국토정보 플랫폼의 접속 경로로 바꿔준다.  ( 서버의 경로가 바뀔 수 있으니 잘 확인해야 한다. )
  • ntrip_user의 value를 네트워크 RTK의 ID로 변경한다.
  • ntrip_pass의 value를 네트워크 RTK의 비밀번호로 변경한다. ngii로 모두 동일하다.
  • ntrip_stream의 value를 VRS-RTCM31로 변경한다. RTCM31 포맷으로 출력을 한다는 뜻이다.
  • ntrip_gga의 value를 설정한다. NMEA 프로토콜 sentence이므로 장치 등 GNSS를 사용하기 위한 다양한 정보를 담고 있다. 자세한 사항은 아래 링크를 참고하도록 한다.

https://techlog.gurucat.net/239

 

[GPS 이야기] NMEA-0183 형식, NMEA Sentence Format

만약 당신이 GNSS와 직접적으로 관련된 일을 한다면. 혹은 간접적으로 GPS등과 같은 것을 통해 얻은 위치정보등을 다뤄야 할 일이 있다면. 조만간 'NMEA' 라는 것을 마주하게 될 수도 있다. 위치정

techlog.gurucat.net

 

## 수정 전 ##

<?xml version="1.0" encoding="UTF-8"?>

<launch>
  <node pkg="ntrip_ros" type="ntripclient.py" name="ntrip_ros" output="screen">
 	 <param name="rtcm_topic" value="/rtcm"/>
 	 <param name="ntrip_server" value="URL:PORT"/>
 	 <param name="ntrip_user" value="USER"/>
 	 <param name="ntrip_pass" value="PASS"/>
 	 <param name="ntrip_stream" value="MOUNTPOINT"/>
 	 <param name="nmea_gga" value="$GPGGA,..."/>
  </node>
</launch>

## 수정 후 ##

<?xml version="1.0" encoding="UTF-8"?>

<launch>
 <node pkg="ntrip_ros" type="ntripclient.py" name="ntrip_ros" output="screen">
 	 <param name="rtcm_topic" value="/ublox_gps/rtcm"/>
 	 <param name="ntrip_server" value="vrs3.ngii.go.kr:2101"/>
 	 <param name="ntrip_user" value="ID"/>
 	 <param name="ntrip_pass" value="ngii"/>
 	 <param name="ntrip_stream" value="VRS-RTCM31"/>
 	 <param name="nmea_gga" value="$GPGGA,024539.902,3723.004,N,12639.255,E,1,12,1.0,0.0,M,0.0,M,,*60"/>
  </node>
</launch>

 Server가 변경되었으니 무작정 복붙하지 말고 한번 더 확인해보자

(5) ntrip , ublox 실행

각각의 launch 파일을 실행하여 RTK 신호를 이용한 GNSS 신호를 받기 위해 아래 명령어를 입력한다.

※각각의 터미널에 각각의 명령어를 실행한다.※

 

$ roslaunch ntrip_ros ntrip_ros.launch
$ roslaunch ublox_gps ublox_device.launch

 

(6) ntrip launch 파일 수정

ntrip_ros.launch 에서 ublox_device.launch를 불러와 ntrip_ros.launch만을 실행해도 ublox_device.launch가 실행되도록 ntrip launch 파일을 수정해보도록 하자

 

## 수정 전 ##

<?xml version="1.0" encoding="UTF-8"?>

<launch>
 <node pkg="ntrip_ros" type="ntripclient.py" name="ntrip_ros" output="screen">
 	 <param name="rtcm_topic" value="/ublox_gps/rtcm"/>
 	 <param name="ntrip_server" value="vrs3.ngii.go.kr:2101"/>
 	 <param name="ntrip_user" value="####"/>
 	 <param name="ntrip_pass" value="ngii"/>
 	 <param name="ntrip_stream" value="VRS-RTCM31"/>
 	 <param name="nmea_gga" value="$GPGGA,024539.902,3723.004,N,12639.255,E,1,12,1.0,0.0,M,0.0,M,,*60"/>
  </node>
</launch>

 

## 수정 후 ##

<?xml version="1.0" encoding="UTF-8"?>

<launch>
  <include file="$(find ublox_gps)/launch/ublox_device.launch">
  </include>

  <node pkg="ntrip_ros" type="ntripclient.py" name="ntrip_ros" output="screen">
    <param name="rtcm_topic" value="/ublox_gps/rtcm"/>
    <param name="ntrip_server" value="vrs3.ngii.go.kr:2101"/>
    <param name="ntrip_user" value="####"/>
    <param name="ntrip_pass" value="ngii"/>
    <param name="ntrip_stream" value="VRS-RTCM31"/>
    <param name="nmea_gga" value="$GPGGA,024539.902,3723.004,N,12639.255,E,1,12,1.0,0.0,M,0.0,M,,*60"/>
  </node>
</launch>

 

이제 아래 명령어만 실행해도 터미널에서 ublox  보드까지 함께 실행된다.

$ roslaunch ntrip_ros ntrip_ros.launch

 

(7) 발행되는 토픽 확인 

 

아래 명령어를 통해 토픽들을 확인할 수 있다.

$ rostopic list

 

아래 명령어를 통해 토픽과 노드 사이의 관계를 확인할 수 있다.

$ rqt_graph

 

(8) 주요 토픽 메시지 확인

 

아래 토픽의 메시지를 확인해보자

$ rostopic echo /ublox_gps/fix
$ rostopic echo /ublox_gps/rtcm

rostopic echo /ublox_gps/fix
rostopic echo /ublox_gps/rtcm

 

 

 

  • std_msgs/Header header: 시간, 프레임 ID 등 헤더 값
  • sensor_msgs/NavSatStatus status: 위성 fix 상태 값
  • float64 latitude: 도(degrees) 단위의 위도 값. 북쪽이 (+)이고 남쪽이 (-)이다.
  • float64 longitude: 도(degrees) 단위의 경도 값. 본초 좌오선의 동쪽이 (+)이고 서쪽이 (-)이다.
  • float64 altitude: 미터(m) 단위의 고도. WGS84형 타원체의 위쪽이 (+) 값
  • float64[9] position_covariance: 접 평면에 대한 제곱미터(m2) 단위의 자세 공분산. 행 우선(row-major order)으로 한 ENU(East, North, Up) 구성요소로 
  • uint8 position_covariance_type

 

위에서 얻은 위도, 경도 값을 구글 지도에 넣어줬을 때 위치 정보가 제대로 나오는 것을 알 수 있었다.

 

 

 

 


참고 자료

https://velog.io/@717lumos/GPS-ublox-ZED-F9P-GPS-%EC%82%AC%EC%9A%A9%EB%B2%95

 

[GPS] ublox ZED-F9P GPS, RTK 사용법

ublox C099-F9P application board, 드라이버 설치, RTK 사용법(ntrip client)

velog.io

 

728x90

'ROS > GPS' 카테고리의 다른 글

Mapviz에서 구글 위성 지도 사용  (2) 2022.04.09
Mapviz 사용법  (0) 2022.04.08
ROS Melodic에 Mapviz 설치  (0) 2022.04.08
Resolve gps-waypoint-based-autonomous-navigation-in-ros PKG Cmake Error  (0) 2022.03.29
Linux 에서 U-center 사용  (0) 2022.01.06