Overview: Robot and GameMode

_images/robot_and_gamemode.png

Above figure shows typical way of creating Robot and GameMode with RapyutaSimulationPlugins and how expose ROS 2 interfaces. Please check each components overview in Components and main C++ classes and UE API.

Robot

Robot Actor is composed of ARRBaseRobot, URRRobotROS2Interface and ARRBaseRobotROSController . You can create your own robot by creating child class of following components. Robot can be placed from UE interface, e.g drag and drop from UE Editor, or spawned from ROS 2 /SpawnEntity srv.

Features

  • ROS 2 interface

    ARRBaseRobot is designed to be controlled from ROS 2 via URRRobotROS2Interface.

    ARRBaseRobot has only basic interface such as /cmd_vel, /odom, /joint_states , /joint_commands. Please create child class and add necessary ROS 2 APIs.

  • Spawning from ROS 2 with parameters

    ARRBaseRobot and URRRobotROS2Interface can be spawnd from /SpawnEntity service. You can pass Robot Name, Namespace and etc.

    SpawnEntity.srv also has a field named json_parameters to pass random parameters. Please add your own custom parser in child class by overwriting InitPropertiesFromJSON() which is called in the PreInitializeComponents()

  • Distributed simulation

    ARRBaseRobot has a setting to be used for client-server. Please check Distrubuted Simulation for detailed information.

Components

Examples and more

Todo

  • Support spawning robot from URDF

  • Non Robot actor with ROS 2 Interfaces

GameMode

The GameMode start all the simulation components, mainly the Simulation State and its associated ROS 2 Node.

  • ASimulationState

    Simulation component, which has implementation of ROS 2 services and communicate with URRROS2SimulationstateClient.

    ASimulationState can not control all actors, but it only manages actors in Entities . Actors in the level at BeginPlay and actors spawned by ROS 2 services are added automatically. You need to manually call ServerAddEntity() if you want to control actors that are not spawned from ASimulationState at runtime.

    ASimulationState can not spawn all UE actor classes, but only SpawnableEntityTypes If you want to control actors that are not spawned from ASimulationState at runtime, you need to manually call AddSpawnableEntityTypes() You can also change spawnable entities in the level Blueprint, by overwriting the game mode, and so on.

  • URRROS2SimulationstateClient

    Simulation component, which provides ROS 2 services interface to manipulate actors. ASimulationState and URRROS2SimulationstateClient are separated to be used in client-server.

  • URRROS2ClockPublisher

    ROS 2 publisher class publishes /clock topic at every tick in the simulation.

    In the example turtlebot3-UE project, It is set to use URRLimitRTFFixedSizeCustomTimeStep which enables running simulation with fixed timestep while limiting the RTF(Real Time Factor).

    The turtlebot3-UE project is set to update DefaultEngine.ini` with environment variable from DefaultEngineBase.ini . The frame rate and max RTF are set from environment variable FIXED_FRAME_RATE and TARGET_RTF.

SimulationState ROS 2 Service

Service name

Service type

About

/GetEntityState

GetEntityState.srv

return the actor actor state

/SetEntityState

SetEntityState.srv

et the actor state.

/GetEntityState

GetEntityState.srv

return the actor state

/SpawnEntity

SpawnEntity.srv

spawn actor

/SpawnEntities

SpawnEntities.srv

spawn many actors from a list

/DeleteEntity

DeleteEntity.srv

return the actor actor state

/Attach

Attach.srv

attach two actors which are not connected or detach two actors which are connected.

Todo

  • SpawnWorld service