Public Types | Public Member Functions | Protected Attributes | List of all members
tf_remapper_cpp::TfRemapper Class Reference

Remap frames in TF messages according to given rules. More...

#include <tf_remapper.h>

Public Types

typedef std::map< std::string, std::string > MappingsType
 

Public Member Functions

void doRemapping (tf2_msgs::TFMessage &message) const
 Rewrite TF frame names according to the rules given in constructor. More...
 
tf2_msgs::TFMessage doRemapping (const tf2_msgs::TFMessage &inMessage) const
 Rewrite TF frame names according to the rules given in constructor. More...
 
const MappingsTypegetMappings () const
 Get the mappings this remapper uses. More...
 
 TfRemapper ()
 Empty constructor with no remappings. More...
 
 TfRemapper (MappingsType mappings, bool reverse=false)
 Create the remapper from a constructed set of mappings. More...
 
 TfRemapper (const XmlRpc::XmlRpcValue &mappingsParam, bool reverse=false)
 Create the remapper from a XmlRpcValue as read by ros::NodeHandle::getParam(). More...
 
virtual ~TfRemapper ()
 

Protected Attributes

MappingsType mappings
 The mappings (keys are old frame names, values are remapped names). More...
 

Detailed Description

Remap frames in TF messages according to given rules.

Definition at line 10 of file tf_remapper.h.

Member Typedef Documentation

◆ MappingsType

typedef std::map<std::string, std::string> tf_remapper_cpp::TfRemapper::MappingsType

Definition at line 12 of file tf_remapper.h.

Constructor & Destructor Documentation

◆ TfRemapper() [1/3]

tf_remapper_cpp::TfRemapper::TfRemapper ( )

Empty constructor with no remappings.

Definition at line 5 of file tf_remapper.cpp.

◆ TfRemapper() [2/3]

tf_remapper_cpp::TfRemapper::TfRemapper ( MappingsType  mappings,
bool  reverse = false 
)
explicit

Create the remapper from a constructed set of mappings.

Parameters
mappingsThe mappings to use (keys are old frame names, values are remapped names).
reverseIf true, switch role of keys and values in the given map. Entries with empty values are omitted.
Exceptions
ros::InvalidParameterExceptionif an 'old' key has empty value.

Definition at line 9 of file tf_remapper.cpp.

◆ TfRemapper() [3/3]

tf_remapper_cpp::TfRemapper::TfRemapper ( const XmlRpc::XmlRpcValue mappingsParam,
bool  reverse = false 
)
explicit

Create the remapper from a XmlRpcValue as read by ros::NodeHandle::getParam().

Parameters
mappingsParamThe XML-RPC-parsed value of the ROS parameter 'mappings'. It is expected to be an array of dicts, each of which contains keys 'old' and 'new'. At least on of them has to have nonempty value. Empty values mark tf frames to be deleted in the given direction.
reverseIf true, switch role of 'old' and 'new' in the given map. Entries with empty 'new' are omitted.
Exceptions
ros::InvalidParameterExceptionif an 'old' key has empty value.
ros::InvalidParameterExceptionif the mappings do not satisfy the given format.

Definition at line 25 of file tf_remapper.cpp.

◆ ~TfRemapper()

tf_remapper_cpp::TfRemapper::~TfRemapper ( )
virtual

Definition at line 7 of file tf_remapper.cpp.

Member Function Documentation

◆ doRemapping() [1/2]

void tf_remapper_cpp::TfRemapper::doRemapping ( tf2_msgs::TFMessage &  message) const

Rewrite TF frame names according to the rules given in constructor.

Parameters
messageThe original message which is to be modified.

Definition at line 68 of file tf_remapper.cpp.

◆ doRemapping() [2/2]

tf2_msgs::TFMessage tf_remapper_cpp::TfRemapper::doRemapping ( const tf2_msgs::TFMessage &  inMessage) const

Rewrite TF frame names according to the rules given in constructor.

Parameters
inMessageThe original message.
Returns
A copy of the original message with rewritten TF frame names.

Definition at line 62 of file tf_remapper.cpp.

◆ getMappings()

const tf_remapper_cpp::TfRemapper::MappingsType & tf_remapper_cpp::TfRemapper::getMappings ( ) const

Get the mappings this remapper uses.

Returns
The mappings (keys are old frame names, values are remapped names).

Definition at line 92 of file tf_remapper.cpp.

Member Data Documentation

◆ mappings

MappingsType tf_remapper_cpp::TfRemapper::mappings
protected

The mappings (keys are old frame names, values are remapped names).

Definition at line 49 of file tf_remapper.h.


The documentation for this class was generated from the following files:


tf_remapper_cpp
Author(s): Martin Pecka
autogenerated on Mon Feb 28 2022 23:52:08