본문으로 건너뛰기
버전: 3.0.x

디바이스 에이전트 설치 및 연동

TeamGRIT Agent SDK는 ROS2에서 사용가능한 패키지로, 메시지 형식을 하나로 통합하여 어떤 데이터든지 Topic을 통해 Moth 서버로 전송할 수 있도록 설계되었습니다.

실행 환경 준비

Agent SDK를 사용하기 위해서는 ROS2가 설치되어 있어야 합니다. ROS2 설치 방법은 ROS2 공식 홈페이지를 참고해 주세요.

권장 실행 환경은 Ubuntu 20.04 LTS, ROS2 Foxy입니다.

yaml 파일 작성

Agent SDK를 사용하기 위해서는 다음 두 가지 yaml 파일을 작성해야 합니다.

  • config.yaml
  • request.yaml

config.yaml

config.yaml 파일에는 ROS 메시징 시스템 내부에서 사용할 topic 정보와, 해당 정보를 moth 서버와 매칭시키기 위한 트랙 이름(name)mime 정보를 작성합니다.

mime 작성법

mime 작성법은 모듈 타입과 Mime을 참고해 주세요.

topics:
- topic: "/teamgrit/image/h264"
name: "front_camera"
mime: "video/h264;width=640;height=480;framerate=30;codecs=avc1.42002A"
- topic: "/teamgrit/image/h264_2"
name: "back_camera"
mime: "video/h264;width=640;height=480;framerate=30;codecs=avc1.42002A"
- topic: "/teamgrit/lidar"
name: "lidar"
mime: "lidar/draco"
- topic: "/teamgrit/sensor"
name: "sensor"
mime: "text/json"
- topic: "/teamgrit/control"
name: "control"
mime: "text/json"

request.yaml

request.yaml 파일에는 CoBiz 서버와 연동하기 위한 정보를 작성합니다.

state: "NotRegistered"
id: null
token: null
preset: "<preset_name>"
secret_key: "<server_secret_key>"
  • state, id, token은 Agent SDK를 사용하기 위한 인증 정보로, 처음 세팅된 기본값을 그대로 사용하시면 됩니다.
  • preset은 CoBiz 서버에 업로드한 프리셋 JSON 파일에 기재된 프리셋 이름을 작성합니다. 로봇이 등록되면 해당 프리셋의 설정들이 로봇에 적용됩니다.
  • secret_key는 CoBiz 서버에 로봇을 등록하기 위한 키로, CoBiz 서버 설정 시 환경변수로 설정한 값을 사용합니다.

디바이스 에이전트 빌드 및 실행

메시지 패키지 빌드

다음 명령어를 따라 메시지 패키지를 가장 먼저 빌드합니다.

cd teamgrit-agent/teamgrit_agent_msgs
colcon build

빌드가 완료되면 환경 변수에 패키지를 추가해 줍니다.

source install/setup.bash

Agent 빌드

teamgrit_agent_sdk 디렉토리로 이동하여 sdk를 빌드합니다.

cd teamgrit-agent/teamgrit_agent_sdk
colcon build

이후 환경변수에 패키지를 추가합니다.

source install/setup.bash

Agent 실행

Agent SDK를 실행하기 위해서는 다음 명령어를 실행합니다.

ros2 run teamgrit_agent_sdk teamgrit_agent_sdk