ROS2 통신 메시지
본 섹션에서는 시뮬레이터에서 지원하는 통신에 따라, 주고받는 메시지의 종류 및 데이터 구조 등에 대한 ROS2 메시지 프로토콜에 대해 기술한다.
ROS2 통신 메시지
Network Settings 에서 제공하는 Ego Network 및 Simulator Network 에서 ROS2 통신 방식에 따라 주고받는 메시지 타입 및 메시지 토픽, 메시지 구조에 대해 설명한다.
ROS2 메세지 파일 다운로드 링크
개발용 Linux 환경에 직접 다운로드 가능하도록 아래 GitHub 링크를 제공한다. 26.R1.0 UPDATE
ROS2 를 사용하기 위해서는 ROS 환경이 설정되어 있어야 하며 아래 명령어를 통해 반드시 cyclone 설치가 필요합니다.
sudo apt install ros-$ROS_DISTRO-rmw-cyclonedds-cpp
Ego Network

Cmd Control

Publisher, Subscriber, Service
통신 방식: Publisher (SIM → User)
Ego Vehicle Status
차량 상태 정보
MoraiInfoPublisher
Message Type : morai_ros2_msgs/msg/EgoVehicleStatus
Default Topic : /ego_vehicle_status
QOS Profile : Default
타입 설명 : 제어 차량의 상태 정보를 나타내는 메시지
Name | Type | Unit | Remarks | |
|---|---|---|---|---|
| 1 | header | - | Message header | |
| 2 | unique_id | int32 | - | 오브젝트의 unique id 값 |
| 3 | acceleration | m/s2 | ego 차량의 현재 가속도 벡터 값 | |
| 4 | position | m | ego 차량의 현재 위치 | |
| 5 | velocity | m/s | ego 차량의 현재 속도 벡터 값 | |
| 6 | angular_velocity | deg/s | 차량의 중심 기준 회전 각속도 | |
| 7 | heading | float64 | deg | 차량의 heading을 나타냄 |
| 8 | accel | float32 | - | 차량의 가속 페달의 상태 값 0~1 범위를 가진다. |
| 9 | brake | float32 | - | 차량의 브레이크 페달의 상태 값 0~1 범위를 가진다. |
| 10 | front_steer_angle | float32 | deg | 차량의 현재 앞 바퀴 조향각 |
| 11 | rear_steer_angle | float32 | deg | 차량의 현재 뒷 바퀴 조향각 |
| 12 | tire_lateral_force_fl | float32 | N | Tire force - 앞축 왼쪽 휠 |
| 13 | tire_lateral_force_fr | float32 | N | Tire force- 앞축 오른쪽 휠 |
| 14 | tire_lateral_force_rl | float32 | N | Tire force- 뒷축 왼쪽 휠 |
| 15 | tire_lateral_force_rr | float32 | N | Tire force- 뒷축 오른쪽 휠 |
| 16 | side_slip_angle_fl | float32 | deg | 사이드 슬립 앵글 - 앞축 왼쪽 휠 |
| 17 | side_slip_angle_fr | float32 | deg | 사이드 슬립 앵글- 앞축 오른쪽 휠 |
| 18 | side_slip_angle_rl | float32 | deg | 사이드 슬립 앵글- 뒷축 왼쪽 휠 |
| 19 | side_slip_angle_rr | float32 | deg | 사이드 슬립 앵글- 뒷축 오른쪽 휠 |
| 20 | tire_cornering_stiffness_fl | float32 | N/deg | Cornering Stiffness - 앞축 왼쪽 휠 |
| 21 | tire_cornering_stiffness_fr | float32 | N/deg | Cornering Stiffness - 앞축 오른쪽 휠 |
| 22 | tire_cornering_stiffness_rl | float32 | N/deg | Cornering Stiffness - 뒷축 왼쪽 휠 |
| 23 | tire_cornering_stiffness_rr | float32 | N/deg | Cornering Stiffness - 뒷축 오른쪽 휠 |
| 24 | distance_left_lane_boundary | float32 | m | 가장 가까운 Link의 좌측 차선 경계선까지의 거리 (원본 데이터에 차선 경계 정보가 없으면 미출력) |
| 25 | distance_right_lane_boundary | float32 | m | 가장 가까운 Link의 우측 차선 경계선까지의 거리 (원본 데이터에 차선 경계 정보가 없으면 미출력) |
| 26 | cross_track_error | float32 | m | 좌측 차선 거리 − 우측 차선 거리 (원본 데이터에 차선 경계 정보가 없으면 미출력) |
Object Info
주변 물체 정보
MoraiObjectInfoPublisher
Message Type : morai_ros2_msgs/msg/ObjectStatusList
Default Topic : /object_status
QOS Profile : Default
타입 설명 : 사용자가 배치한 주변 물체들에 대한 정보를 나타내는 메시지
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | header | - |
| |
2 | num_of_npcs | int32 | - | 사용자가 배치한 npc 차량의 개수 |
3 | num_of_pedestrian | int32 | - | 사용자가 배치한 pedestrian의 개수 |
4 | num_of_obstacle | int32 | - | 사용자가 배치한 obstacle(static objects)의 개수 |
5 | npc_list | ObjectStatus | - | npc 차량 정보 (아래의 ObjectStatus 타입 참고) |
6 | pedestrian_list | ObjectStatus | - | pedestrian 정보 (아래의 ObjectStatus 타입 참고) |
7 | obstacle_list | ObjectStatus | - | obstacle 정보 (아래의 ObjectStatus 타입 참고) |
Object Status
ObjectStatus 는 MoraiObjectInfoPublisher 에서 사용하는 목록으로 Topic이 없음
ROS message details
Message Type: morai_ros2_msgs/msg/ObjectStatus
NOTE 차량의 위치 값은 ENU 좌표계로 표시됨 (x: east, y: north, z: up)
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | unique_id | int32 | - | 물체의 unique id 값 |
2 | type | int32 | - | 0: Pedestrian, 1: NPC vehicle, 2: Static object (obstacle), -1: Ego-vehicle |
3 | name | string | - | 물체의 이름 |
4 | heading | float64 | - | 물체의 heading을 나타냄 |
5 | velocity | km/h | 물체의 현재 속도 벡터 값 | |
6 | acceleration | m/s2 | 물체의 현재 가속도 벡터 값 | |
7 | size | m | 물체의 크기 (width, length, height) | |
8 | position | m | 물체의 현재 위치 |
Collision Data
충돌 정보
CollisionData
Message Type : morai_ros2_msgs/msg/CollisionData
Default Topic : /collision_data
QOS Profile : Default
타입 설명 : Ego 차량과의 충돌 데이터를 나타내는 메시지
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | header | - |
| |
2 | global_offset_x | float32 | The x-axis position of the collided object w.r.t the map coordinate system | |
3 | global_offset_y | float32 | The y-axis position of the collided object w.r.t the map coordinate system | |
4 | global_offset_z | float32 | The z-axis position of the collided object w.r.t the map coordinate system | |
5 | collision_object | ObjectStatus[] | - | Ego 와 충돌한 Object 정보 |
Get TrafficLight Status
신호등 상태 정보
TLStatusPublisher
Message Type : morai_ros2_msgs/msg/GetTrafficLightStatus
Default Topic : /traffic_light_status
QOS Profile : Default
타입 설명 : TrafficLight 에 대한 정보를 나타내는 메시지
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | header | - |
| |
2 | traffic_light_index | string | - | TrafficLight 의 unique index 값 |
3 | traffic_light_type | int16 | - | TrafficeLight의 LightType 값 0: Red/Yellow/Green |
4 | traffic_light_status | int16 | - | TrafficeLight의 Status 값 1: Red Combined lights (multiple lights on simultaneously) can be applied using standard bitwise operations |
Get Intersection Status
교차로 정보
IntersectionStatusPublisher
Message Type : morai_ros2_msgs/msg/IntersectionStatus
Default Topic : /intersection_status
QOS Profile : Default
타입 설명 : 교차로 신호등 정보
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | header | - |
| |
2 | intersection_index | int32 | - | 교차로 index |
3 | intersection_status | int16 | - | 교차로 상태 |
4 | intersection_status_time | float32 | - | 현재 교차로 상태로 지난 시간 (s) |
통신 방식: Subscriber (User → SIM)
Ego Ctrl Cmd
차량 제어 명령
MoraiCmdController
Message Type : morai_ros2_msgs/msg/CtrlCmd
Default Topic : /ctrl_cmd_0
QOS Profile : Default
타입 설명 : Ego 차량을 제어하기 위한 메시지
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | header | - | ||
2 | longl_cmd_type | int32 | - | 제어 방식을 결정하는 인덱스 |
3 | accel | float64 | - | 차량의 가속 페달 값을 의미하며 0~1 범위를 가진다. |
4 | brake | float64 | - | 차량의 브레이크 페달 값을 의미하며 0~1 범위를 가진다. |
5 | front_steer | float64 | - | 전륜 조향 제어 명령
|
6 | rear_steer | float64 | - | 후륜 조향 제어 명령
|
7 | velocity | float64 | km/h | ( Only active if CmdType == 2 ) |
8 | acceleration | float64 | m/s2 | ( Only active if CmdType == 3 ) |
Ghost Ctrl Cmd
차량 제어 명령
Ghost Mode Ego
Message Type : morai_ros2_msgs/msg/GhostCmd
Default Topic : /ghost_ctrl_cmd
QOS Profile : Default
타입 설명 : Ghost Mode 이용 Ego 차량을 제어하기 위한 메세지
Ghost Mode : 차량을 원하는 위치에 생성 할 수 있는 모드이다.
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | header | - | ||
2 | position | m | ego 차량의 위치 지정 (X, Y, Z) | |
3 | rotation | deg | ego 차량의 회전 지정 (roll, pitch, yaw) | |
4 | velocity | float64 | km/h | ego 차량의 속도 |
5 | steer_angle | float64 | deg | ego 차량 앞바퀴 조향 각도 |
Set Traffic Light Control
신호등 상태 제어
TLCtrlSubscriber
Message Type : morai_ros2_msgs/msg/SetTrafficLight
Default Topic : /traffic_light_control
QOS Profile : Default
타입 설명 : TrafficLight의 상태를 제어하기 위한 메시지
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | header | - | ||
2 | traffic_light_index | string | - | TrafficLight 의 unique index 값 |
3 | traffic_light_status | int16 | - | TrafficeLight의 Status 값 1: Red |
Set Intersection Control
교차로 제어
IntersectionControlSubscriber
Message Type : morai_ros2_msgs/msg/IntersectionControl
Default Topic : /intersection_control
QOS Profile : Default
타입 설명 : 교차로 신호등 제어 정보
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | header | - |
| |
2 | intersection_index | int32 | - | 교차로 index |
3 | intersection_status | int16 | - | 교차로 상태 |
4 | intersection_status_time | float32 | s | 현재 교차로 상태로 지난 시간 |
Save Sensor Data
센서 Data 저장
SensorSyncDataSubscriber
Message Type : morai_ros2_msgs/msg/SaveSensorData
Default Topic : /save_sensor_data
QOS Profile : Default
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | header | - |
| |
2 | is_custom_file_name | bool | - | Determines if the save file name is custom input by the user |
3 | custom_file_name | string | - | The custom save file name input by the user |
4 | file_dir | string | - | The full path string of the save file |
Turn Signal Lamp Control
Lamps
Message Type : morai_ros2_msgs/msg/Lamps
Default Topic : /lamps
QOS Profile : Default
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | header | - |
| |
2 | turn_signal | int8 | - | 0: No signal, 1: Left turn signal, 2: Right turn signal |
3 | emergency_signal | int8 | - | 0: No signal, 1: Emergency lamps on |
Sensor Pose Subscriber
Message Type : morai_ros2_msgs/msg/SensorPosControl
Default Topic : /sensor_pos_control
QOS Profile : Default
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | header | - | ||
2 | sensor_index | int16[] | - | 위치를 제어할 센서 인덱스 번호 이름 |
3 | pose_x | float32[] | m |
|
4 | pose_y | float32[] | m |
|
5 | pose_z | float32[] | m |
|
6 | roll | float32[] | rad | Sensor roll angle |
7 | pitch | float32[] | rad | Sensor pitch angle |
8 | yaw | float32[] | rad | Sensor yaw angle |

통신 방식: Service Model (User → Sim)
Service 통신 방식으로 주고받는 ROS2 메시지 프로토콜에 대해 설명한다.
이벤트 제어 요청 메시지
Morai Event Cmd Service Provider
Service Type : morai_ros2_msgs/srv/EventCmd
Default Name : /event_cmd
Request
Message Type : morai_ros2_msgs/msg/EventInfo
Response
Message Type : morai_ros2_msgs/msg/EventInfo
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | header | - | ||
2 | option | int8 | - | 이벤트 제어를 요청하는 필드 옵션
|
3 | ctrl_mode | int32 | - | 차량의 control mode 제어
|
4 | gear | int32 | - | 차량의 기어 변경
|
5 | lamps | Lamps | - | 방향 지시등 제어 |
6 | set_pause | bool | ms |
|
Lamps
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | header | - |
| |
2 | turn_signal | int8 | - |
|
3 | emergency_signal | int8 | - |
|
MAP 데이터 호출 메시지
Morai Map Spec Service Provider
Service Type : morai_ros2_msgs/srv/MapSpec
Default Name : /map_spec
Request
Message Type : Empty
Response
Message Type : morai_ros2_msgs/msg/MapSpec
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | header | - |
| |
2 | plane_coordinate_system | int32 | - | 맵의 평면 좌표계 정보
|
3 | utm_num | int32 | - | UTM Zone 정보
|
4 | utm_offset | - | 맵의 오프셋 정보 | |
5 | ellipse | string | - | 타원체 종류
|
6 | central_latitude | float64 | central latitude (y-axis origin) | |
7 | central_meridian | float64 | central meridian (x-axis origin) | |
8 | scale_factor | float64 |
| |
9 | false_easting | float64 | X 좌표 동위 이동 추가 값 | |
10 | false_northing | float64 | Y 좌표 북위 이동 추가 값 |
Simulator Network

Simulator Network
통신 방식: Publisher (SIM → User)
NPC Vehicle Collision Data
NPC 차량 충돌 정보
VehicleCollisionInfoPublisher
Message Type : morai_ros2_msgs/msg/VehicleCollisionData
Default Topic : /vehicle_collision_data
QOS Profile : Default
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | header | - |
| |
2 | collisions | VehicleCollision[] | - | 충돌한 NPC 차량의 목록 |
Vehicle Collision
Vehicle Collision 은 VehicleCollisionInfoPublisher 에서 사용하는 목록으로 Topic이 없음
ROS message details
Message Type: morai_ros2_msgs/msg/VehicleCollision
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | crashed_vehicles | ObjectStatus[] | - | 충돌한 NPC 차량의 정보 |
통신 방식: Subscriber (User → SIM)
Multi Ego Setting
Multi_Ego 제어 명령
MultiEgoTransformHandler
Message Type : morai_ros2_msgs/msg/MultiEgosetting
Default Topic : /multi_ego_setting
타입 설명 : MultiEgo 에 대한 정보 메세지 타입
QOS Profile : Default
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | header | - |
| |
2 | number_of_ego_vehicle | int32 | - | Multi_ego vehicle 의 수 |
3 | camera_index | int32 | - | Multi_ego 세팅 시 바라볼 차량의 unique index |
4 | ego_index | int32[] | - | 제어할 Multi_ego 의 unique index |
5 | global_position_x | float64[] | - | Multi_ego의 현재 X-axis 위치 |
6 | global_position_y | float64[] | - | Multi_ego의 현재 Y-axis 위치 |
7 | global_position_z | float64[] | - | Multi_ego의 현재 Z-axis 위치 (elevation) |
8 | global_roll | float32[] | - | Multi_ego의 현재 roll 각도 |
9 | global_pitch | float32[] | - | Multi_ego의 현재 pitch 각도 |
10 | global_yaw | float32[] | - | Multi_ego의 현재 heading 각도 |
11 | velocity | float32[] | - | Multi_ego의 velocity |
12 | gear | int8[] | - | 1: Parking, 2: Reverse, 3: Neutral, 4: Drive |
13 | ctrl_mode | int8[] | - | 1: keyboard mode, 16: automode |
통신 방식: Service Model (User → Sim)
ScenarioLoad
Morai SLService Provider
Service Type : morai_ros2_msgs/srv/ScenarioLoad
Default Name : /scenario_load
Request
Message Type : morai_ros2_msgs/msg/ScenarioLoad
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | header | - |
| |
2 | file_name | string | - | load 할 Scenario_file_name |
3 | delete_all | bool | - |
|
4 | load_ego_vehicle_data | bool | - |
|
5 | load_surrounding_vehicle_data | bool | - |
|
6 | load_pedestrian_data | bool | - |
|
7 | load_obstacle_data | bool | - |
|
8 | set_pause | bool | - |
|
Response
Message Type : morai_ros2_msgs/msg/MoraiSrvResponse
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | header | - |
| |
2 | result | bool | - | Service request 에 대한 결과 |
Traffic Light 상태 호출 메시지
Morai TLService Provider
Service Type : morai_ros2_msgs/srv/TrafficLightInfo
Default Name : /traffic_light_info
Request
Message Type : morai_ros2_msgs/msg/MoraiTrafficLightIndex
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | header | - |
| |
2 | idx | string | - | Traffic Light Index |
Response
Message Type : morai_ros2_msgs/msg/MoraiTrafficLightInfo
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | header | - |
| |
2 | idx | string | - | Traffic Light Index |
3 | status | int16 | - | Traffic Light의 상태 정보
|
차량 스펙 호출 메시지
Morai Vehicle Spec Service Provider
Service Type : morai_ros2_msgs/srv/VehicleSpec
Default Name : /vehicle_spec
Request
Message Type : morai_ros2_msgs/msg/VehicleSpecIndex
No | Name | Type | Unit | Remarks |
|---|---|---|---|---|
1 | header | - |
| |
2 | unique_id | int32 | - | 차량의 unique_id |
Response
Message Type : morai_ros2_msgs/msg/VehicleSpec