Overview: Robot and GameMode ============================= .. image:: 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 :doc:`components` and :doc:`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 :doc:`distributed_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 ^^^^^^^^^^^^^^^^^ .. toctree:: :maxdepth: 1 robots/mobile_robot robots/robot_arm 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`. .. list-table:: SimulationState ROS 2 Service :header-rows: 1 * - 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