Overview

As the name suggests, Synchronous Mode synchronizes MORAI SIM’s internal clock to the connected SUT. This feature is currently only available for ROS systems. As the simulator must be connected to a SUT, controlling the ego-vehicle with the keyboard or a steering wheel peripheral is disabled in Synchronous Mode.

ROS Message specifications

NOTE Many of the messages in this section contain the frame variable, which acts differently depending on whether it is part of a request message or a status response message. When part of a request message, frame is the time step count the SUT wants to sync at. When it is included in the status response, frame is the current frame count reported by the simulation.

Synchronous Mode Call Service

SyncModeCmd Service Provider establishes the base time step between the simulator and SUT (User → Sim)

  • Service Name: /SyncModeCmd

  • srv: morai_msgs/srv/MoraiSyncModeCmdSrv

  • Request Message Type: morai_msgs/msg/SyncModeCmd

No

Name

Type

Unit

Remarks

1

user_id

string

 -

Unique identifier when sending a tick to SIM

2

start_sync_mode

bool

-

True when synchronous mode is active

3

time_step

uint32

ms

Time step value for each tick. Is always a multiple of 20ms.

  • Response Message Type: morai_msgs/msg/SyncModeCmdResponse

No

Name

Type

Unit

Remarks

1

user_id

string

 -

Unique identifier when receiving a tick from User

2

frame

uint64

-

Current frame count. Is calculated using frame = time_step/20

3

result

bool

-

True if the request was acknowledged

4

time_step

unit32

ms

Time step value set by the request message

Synchronous Mode Tick Transmission Service

SyncModeWaitForTick Service Provider (User → Sim)

  • Service Name: /SyncModeWaitForTick

  • srv: morai_msgs/srv/MoraiWaitForTickSrv

  • Request Message Type: morai_msgs/msg/WaitForTick

No

Name

Type

Unit

Remarks

1

user_id

string

 -

Unique identifier when sending a tick to SIM

2

frame

uint64

-

The requested frame value

  • Response Message Type: morai_msgs/msg/WaitForTickResponse

No

Name

Type

Unit

Remarks

1

tick_status

bool

 -

True if the WaitForTick request is acknowledged

2

pause_status

bool

-

True when synchronous mode is active

3

frame

uint64

-

Current frame count

4

vehicle_status

EgoVehicleStatus

-

Vehicle state information for the current simulation frame

5

time

string

-

Current system time

Synchronous Mode Vehicle Control Service

SyncModeCtrlCmd Service Provider (User → Sim)

  • Service Name: /SyncModeCtrlCmd

  • srv: morai_msgs/srv/MoraiSyncModeCtrlCmdSrv

  • Request Message Type: morai_msgs/msg/SyncModeCtrlCmd

No

Name

Type

Unit

Remarks

1

frame

uint64

-

The requested frame value

2

command

CtrlCmd

-

Ego-vehicle control commands for the current simulation frame

3

sensor_capture

bool

-

True if sensor capture mode is enabled

  • Response Message Type : morai_msgs/msg/SyncModeResultResponse

No

Name

Type

Unit

Remarks

1

result

bool

-

True if /SyncModeCtrlCmd request is acknowledged

Synchronous Mode Gear Control Service

SyncModeSetGear Service Provider (User → Sim)

  • Service Name: /SyncModeSetGear

  • srv: morai_msgs/srv/MoraiSyncModeSetGearSrv

  • Request Message Type: morai_msgs/msg/SyncModeSetGear

No

Name

Type

Unit

Remarks

1

gear

int32

-

Gear change command to the ego-vehicle

2

frame

uint64

-

The requested frame value

  • Response Message Type: morai_msgs/msg/SyncModeResultResponse

No

Name

Type

Unit

Remarks

1

result

bool

-

True if /SyncModeSetGear request is acknowledged

Synchronous Mode Scenario Load Service

SyncModeScenarioLoad Service Provider (User → Sim)

  • Service Name: /SyncModeScenarioLoad

  • srv: morai_msgs/srv/SyncModeSLSrv

  • Request Message Type: morai_msgs/msg/SyncModeScenarioLoad

No

Name

Type

Unit

Remarks

1

frame

uint64

-

The requested frame value

2

file_name

string

-

The scenario file name

3

delete_all

bool

-

True if the scenario initializes by overwriting all current scenario settings

4

load_network_connection

bool

-

True if network settings data exists

5

load_ego_vehicle_data

bool

-

True if ego-vehicle settings change will change upon loading scenario data

6

load_surrounding_vehicle_data

bool

-

True if NPC vehicle data exists

7

load_pedestrian_data

bool

-

True if pedestrian scenario data exists

8

load_obstacle_data

bool

-

True if obstacle placement data exists

9

set_pause

bool

-

True if the simulator is set to pause upon loading scenario data

  • Response Message Type: morai_msgs/msg/SyncModeResultResponse

No

Name

Type

Unit

Remarks

1

result

bool

-

True if /SyncModeScenarioLoad request is acknowledged

Synchronous Mode Status Information Publisher

SyncMode Info Publisher returns the current state of the Synchronous Mode module to the SUT (Sim → User)

  • Topic Name: /SyncModeInfo

  • Message Type: morai_msgs/msg/SyncModeInfo

No

Name

Type

Unit

Remarks

1

master_id

string

-

Valid user_id that can send /SyncModeWaitForTick

2

status

bool

-

True if Synchronous Mode is enabled

3

frame

uint64

-

The current simulation frame value

4

can_send_tick

bool

-

True if /SyncModeWaitForTick can be received by the simulator

Synchronous Mode Object Addition Subscriber

SyncMode Add Object Subscriber (User → Sim)

  • Topic Name: /SyncModeAddObj

  • Message Type: morai_msgs/msg/SyncModeAddObj

No

Name

Type

Unit

Remarks

1

name

string

-

Name of the added object

2

position

Vector3

-

Position of the added object

3

heading

float64

-

Heading angle of the added object

4

frame

uint64

-

The requested frame value

Synchronous Mode Object Removal Subscriber

SyncMode Remove Object Subscriber (User → Sim)

  • Topic Name: /SyncModeRemoveObj

  • Message Type: morai_msgs/msg/SyncModeRemoveObj

No

Name

Type

Unit

Remarks

1

unique_id

int32

-

Unique identifier number of the object

2

frame

uint64

-

The requested frame value