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

플러그인 계약과 config 작성

/task_state 플러그인 계약

/task_state로 publish 해야 하나

  • 플러그인별 HTTP 중복 제거
  • 토큰과 주소 관리 일원화
  • 장애 및 로그 분석 지점 단일화
  • 플러그인이 도메인 로직에 집중 가능

publish 규약

필수 필드:

  • type
  • task_id (문자열/숫자 허용)
  • task_type (start, complete, fail, reject 등)

권장 필드:

  • action_name
  • device_id
  • device_name
  • reason
  • fail_point

예시:

{
"type": "TASK_STARTED",
"task_id": 12059,
"task_type": "start",
"action_name": "SLAM_NAVIGATION",
"device_id": 4559,
"device_name": "isaac-sim"
}

Python 예시:

from std_msgs.msg import String
import json

pub = node.create_publisher(String, '/task_state', 10)

body = {
'type': 'TASK_COMPLETED',
'task_id': task_id,
'task_type': 'complete',
'action_name': action_name,
'device_id': device_id,
'device_name': device_name,
}
msg = String()
msg.data = json.dumps(body)
pub.publish(msg)

상태 전이 권장

  1. 시작 시 TASK_STARTED
  2. 정상 완료 시 TASK_COMPLETED
  3. 실패 또는 중단 시 TASK_FAILED, TASK_ABORTED
  4. 동시 작업 거절 시 TASK_REJECTED

config.yaml 기본 위치

  • cobiz/src/cobiz_bridge/config/config.yaml
  • install/cobiz_bridge/share/cobiz_bridge/config/config.yaml

videos 설정

sourceformat 의미

  • type: topic
    • source: ROS image 토픽 이름
    • format: 입력 이미지 픽셀 포맷 힌트 (rgb8, bgr8, jpeg 등)
  • type: rtsp
    • source: RTSP URL
    • format: 스트림 코덱 힌트 (H264, H265, JPEG)
  • type: uvc
    • source: 카메라 디바이스 (예: /dev/video0)
    • format: 장치가 지원하는 캡처 포맷 (MJPEG, YUY2, H264 등)

UVC란 무엇인가

  • UVC(USB Video Class)는 USB 카메라 표준 규격입니다.
  • 일반적으로 /dev/video0, /dev/video1처럼 보이는 USB 카메라를 type: uvc로 설정합니다.
  • 실무적으로는 “USB 카메라”라고 생각하면 대부분 맞습니다.

width, height, fps 확인 절차

v4l2-ctl --list-devices
ls -l /dev/video*
v4l2-ctl --device=/dev/video0 --list-formats-ext

출력값을 설정으로 옮기는 예:

  • Pixel Format: 'MJPG'format: MJPEG
  • Size: Discrete 1280x720width: 1280, height: 720
  • Interval: Discrete 0.033s (30.000 fps)fps: 30

UVC 예시:

videos:
- name: usb_front
type: uvc
source: /dev/video0
format: MJPEG
width: 1280
height: 720
fps: 30

토픽 입력 점검 예시:

ros2 topic list | grep image
ros2 topic info -v /realsense/color/image_raw
ros2 topic hz /realsense/color/image_raw
videos:
- name: front_camera
type: topic
source: /realsense/color/image_raw
format: rgb8
width: 1280
height: 720
fps: 30

audios 설정

  • type: alsa
    • source: ALSA 입력 장치명 (hw:CARD=PCH,DEV=0, plughw:CARD=PCH,DEV=0 등)
  • type: pulse
    • source: Pulse source 이름
  • type: rtsp
    • source: RTSP URL
    • format: mulaw 또는 alaw
    • sample_rate: RTP clock-rate 힌트

ALSA 입력 장치 확인 절차:

cat /proc/asound/cards
arecord -l
arecord -L

speaker 설정

  • type: alsa
    • source: ALSA 출력 장치명
  • type: pulse
    • source: Pulse sink 이름
  • 핵심값은 type, source, rate, channels

출력 장치 확인 절차:

aplay -l
aplay -L
pactl info
pactl list short sinks
fuser -v /dev/snd/*

bridge와 server 설정

  • bridge.address: request API 대상 주소
  • server.id, server.token: 등록 후 채워짐

전체 예시

videos:
- name: front_camera
type: topic
source: /realsense/color/image_raw
format: rgb8
width: 1280
height: 720
fps: 30

- name: rear_usb_camera
type: uvc
source: /dev/video0
format: MJPEG
width: 1280
height: 720
fps: 30

- name: ceiling_rtsp
type: rtsp
source: rtsp://user:pass@192.168.0.10:554/stream1
format: H264
width: 1920
height: 1080
fps: 15

audios:
- name: mic_front
type: alsa
source: plughw:CARD=Device,DEV=0
sample_rate: 16000
channels: 1

topics:
battery: /battery_state
custom:
- /diagnostics
- /robot_state

bridge:
address: dev.cobiz.kr
device_name: robot-01
secret_key: change-me
device_info_period: 5.0

lidar:
- name: main_lidar
topic: /points

control:
default_mode: false
default_topic: /joy
topics:
- name: go2_control
topic: /go2_control
- name: arm_control
topic: /arm/joy

actions:
custom:
- CUSTOM_ACTION1
- CUSTOM_ACTION2
slam_navigation:
enabled: true
map_topic: /map
odom_topic: /odom
3d_navigation:
enabled: true
odom_topic: /odom
path_topic: /trajectory
map_navigation:
enabled: true
gps_navigation:
enabled: false
gps_topic: /fix
tts: true
parking: false

speaker:
- name: speaker
type: pulse
source: alsa_output.usb-robot_speaker.analog-stereo
format: S16LE
rate: 48000
channels: 1

server:
state: NotRegistered
id: ~
token: ~

최소 구성 예시:

videos:
- name: front_camera
type: topic
source: /realsense/color/image_raw
format: rgb8
width: 1280
height: 720
fps: 30

audios: ~
topics:
battery: /battery_state
custom: ~

bridge:
address: dev.cobiz.kr
device_name: robot-01
secret_key: change-me
device_info_period: 5.0

lidar: ~

control:
default_mode: false
default_topic: ~
topics: ~

actions:
custom: ~
slam_navigation:
enabled: false
map_topic: ~
odom_topic: ~
3d_navigation:
enabled: false
odom_topic: ~
path_topic: ~
map_navigation:
enabled: false
gps_navigation:
enabled: false
gps_topic: ~
tts: false
parking: false

speaker: ~

server:
state: NotRegistered
id: ~
token: ~

actions.3d_navigation.enabled: true이면 odom_topicODOMETRY, path_topicTRAJECTORY 트랙으로 등록되며 TRAJECTORYmanager_node에서 sensor_node로 실행됩니다.