Overview: Robot and GameMode

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
- URRRobotROS2Interface
Controls ROS 2 node, publisher/subscriber, service client/server and action via UROS2NodeComponent
ROS2Interface is created in the PreInitializeComponents if ROS2InterfaceClass is specified and initialized by ROS2Controller.
ROS2Interface can be override from Bluepritn as well.
- ARRBaseRobot
Base Robot class which has basic ROS 2 topic interfaces such as Twist msg, JointState and etc via ROS2Interface. - URRROS2BaseSensorComponent
Base class of ROS 2 sensors. Other ROS 2 sensor should be child class of this class, e.g. lidar, camera, etc.
URRROS2BaseSensorComponent has URRROS2BaseSensorPublisher which publish Sensor topic and is initialized from URRROS2Interface.
- URobotVehicleMovementComponent
Base class of Robot movement, which is controlled by ROS 2 Twist Msg via URRRobotROS2Interface .
Other movement class should be child class of this class, e.g. differential drive, ackermann drive, etc.
- URRJointComponent
Representative of joint of the robot, which is controlled by ROS 2 JointState Msg via URRRobotROS2Interface .
- ARRBaseRobotROSController
Actor controller class which has authority to start/stop ROS 2 Interfaces. Following the Pawn and AIController structure in Unreal Engine, Ref.
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.
-
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.
-
Simulation component, which provides ROS 2 services interface to manipulate actors. ASimulationState and URRROS2SimulationstateClient are separated to be used in client-server.
-
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.
Service name |
Service type |
About |
---|---|---|
/GetEntityState |
return the actor actor state |
|
/SetEntityState |
et the actor state. |
|
/GetEntityState |
return the actor state |
|
/SpawnEntity |
spawn actor |
|
/SpawnEntities |
spawn many actors from a list |
|
/DeleteEntity |
return the actor actor state |
|
/Attach |
attach two actors which are not connected or detach two actors which are connected. |
Todo
SpawnWorld service