Open 3D Engine ROS2 Gem API Reference  24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
ROS2::NamespaceConfiguration Struct Reference

#include <NamespaceConfiguration.h>

Public Types

enum class  NamespaceStrategy { Default , Empty , FromEntityName , Custom }
 

Public Member Functions

 AZ_TYPE_INFO (NamespaceConfiguration, "{5E5BC6EA-DD01-480E-A4D1-6857CF70FDC8}")
 
void PopulateNamespace (bool isRoot, const AZStd::string &entityName)
 
AZStd::string GetNamespace () const
 
AZStd::string GetNamespace (const AZStd::string &parentNamespace) const
 
void SetNamespace (const AZStd::string &ros2Namespace, NamespaceStrategy strategy)
 
void SetParentNamespace (const AZStd::string &parentNamespace)
 
void Init ()
 

Static Public Member Functions

static void Reflect (AZ::ReflectContext *context)
 

Detailed Description

Configuration for handling of namespaces. Namespaces are useful for various ROS2 components. This structure encapsulates the namespace itself, composing namespaces and context-dependent default values.

Note
This structure is handled through ROS2FrameComponent.

Member Enumeration Documentation

◆ NamespaceStrategy

A choice of methods to handle namespaces.

Note
Top level ROS2FrameComponent will likely be associated with an interesting object (robot). For multi-robot simulations, namespaces are often derived from the robot name itself. For this reason, the default behavior for top level ROS2FrameComponent is to generate the namespace from entity name.
Enumerator
Default 

FromEntityName for top-level frames, Empty otherwise.

Empty 

An empty, blank namespace.

FromEntityName 

Generate from Entity name, but substitute disallowed characters through RosifyName.

Custom 

Non-empty and based on user-provided value.

Member Function Documentation

◆ GetNamespace() [1/2]

AZStd::string ROS2::NamespaceConfiguration::GetNamespace ( ) const

Get the namespace of the frame, based on the parent namespace from the ROS2FrameSystemComponent.

Returns
namespace of the frame.

◆ GetNamespace() [2/2]

AZStd::string ROS2::NamespaceConfiguration::GetNamespace ( const AZStd::string &  parentNamespace) const

Get the namespace of the frame, based on the provided namespace.

Parameters
parentNamespacenamespace of the parent frame.
Returns
namespace of the frame.

◆ Init()

void ROS2::NamespaceConfiguration::Init ( )

Initializes the namespace configuration. This function should be called in the Init functions of frame components.

◆ PopulateNamespace()

void ROS2::NamespaceConfiguration::PopulateNamespace ( bool  isRoot,
const AZStd::string &  entityName 
)

Set namespace based on context.

Parameters
isRootWhether or not the namespace belongs to top-level entity in the entity hierarchy.
entityNameRaw (not ros-ified) name of the entity to which the namespace belongs.

◆ SetNamespace()

void ROS2::NamespaceConfiguration::SetNamespace ( const AZStd::string &  ros2Namespace,
NamespaceStrategy  strategy 
)

Update namespace and strategy.

Parameters
ros2NamespaceDesired namespace.
strategyNamespace strategy.

◆ SetParentNamespace()

void ROS2::NamespaceConfiguration::SetParentNamespace ( const AZStd::string &  parentNamespace)

Update the parents namespace.

Parameters
parentNamespaceparent namespace.

The documentation for this struct was generated from the following file: