AutoAPMS
Resilient Robot Mission Management
|
Fundamental helper classes and utility functions. More...
Namespaces | |
namespace | auto_apms_util |
Fundamental helper classes and utility functions. | |
Classes | |
class | ActionClientWrapper< ActionT > |
Convenience wrapper for a rclcpp_action::Client that introduces synchronous goal handling functions. More... | |
class | ActionContext< ActionT > |
Helper class that stores contextual information related to a ROS 2 action. More... | |
class | ActionWrapper< ActionT > |
Generic base class for implementing robot skills using the ROS 2 action concept. More... | |
class | PluginClassLoader< BaseT > |
Class for loading plugin resources registered according to the conventions defined by the pluginlib package. More... | |
Enumerations | |
enum class | ActionGoalStatus : uint8_t |
Enum for indicating a ROS 2 action goal's current status. More... | |
enum class | ActionStatus : uint8_t |
Status of the auto_apms_util::ActionWrapper execution process. More... | |
std::string | makeColoredText (const std::string &text, TextColor color) |
Add ANSI color escape sequences to display the text in color when printed to console. | |
std::vector< std::string > | splitString (const std::string &str, const std::string &delimiter, bool remove_empty=true) |
Split a string into multiple tokens using a specific delimiter string (Delimiter may consist of multiple characters). | |
std::string | printMap (const std::map< std::string, std::string > &map, const std::string &key_val_sep="=", const std::string &entry_sep=", ") |
Converts a map to a string representation that is suited for printing to console. | |
std::string | trimWhitespaces (const std::string &str) |
Trim whitespaces from both ends of a string. | |
std::string | toCamelCase (const std::string &str) |
Transform a string to camelCase. | |
std::string | toSnakeCase (const std::string &str) |
Transform a string to snake_case. | |
template<typename ValueT, typename AllocatorT, template< typename T, class A > class ContainerT> | |
bool | contains (const ContainerT< ValueT, AllocatorT > &c, const ValueT &val) |
Check whether a particular container structure contains a value. | |
template<typename KeyT, typename CompareT, typename AllocatorT> | |
std::set< KeyT, CompareT, AllocatorT > | getCommonElements (std::set< KeyT, CompareT, AllocatorT > c1, std::set< KeyT, CompareT, AllocatorT > c2) |
Assemble common elements of two sets. | |
template<typename KeyT, typename AllocatorT> | |
std::vector< KeyT, AllocatorT > | getCommonElements (std::vector< KeyT, AllocatorT > c1, std::vector< KeyT, AllocatorT > c2) |
Assemble common elements of two vectors. | |
bool | isFileEmpty (const std::string &path) |
Determine if a file is empty. | |
void | exposeToGlobalDebugLogging (const rclcpp::Logger &logger) |
Enable ROS 2 debug logging, if the C preprocessor flag _AUTO_APMS_DEBUG_LOGGING is set. | |
void | setLoggingSeverity (const rclcpp::Logger &logger, const std::string &severity) |
Set the logging severity of a ROS 2 logger. | |
void | setLoggingSeverity (const rclcpp::Logger &logger, rclcpp::Logger::Level severity) |
Set the logging severity of a ROS 2 logger. | |
std::set< std::string > | getPackagesWithResourceType (const std::string &resource_type, const std::set< std::string > &exclude_packages={}) |
Get a list of all package names that register a certain type of ament_index resources. | |
std::set< std::string > | getPackagesWithPluginResources (const std::set< std::string > &exclude_packages={}) |
Get a list of all package names that register AutoAPMS plugin resources. | |
std::string | getPluginXMLPath (const std::string &package) |
Get the path of a plugin.xml manifest file used for initializing pluginlib::ClassLoader objects. | |
std::vector< std::string > | collectPluginXMLPaths (const std::set< std::string > &exclude_packages={}) |
Collect the paths of plugin.xml manifest files used for initializing pluginlib::ClassLoader objects. | |
#define | AUTO_APMS_UTIL_DEFINE_YAML_CONVERSION_METHODS(ClassType) |
Macro for defining YAML encode/decode methods for a class. | |
Fundamental helper classes and utility functions.
#define AUTO_APMS_UTIL_DEFINE_YAML_CONVERSION_METHODS | ( | ClassType | ) |
Macro for defining YAML encode/decode methods for a class.
ClassType | Fully qualified name of the class. |
|
strong |
Enum for indicating a ROS 2 action goal's current status.
It is used to represent the internal state of auto_apms_util::ActionClientWrapper.
Definition at line 42 of file action_client_wrapper.hpp.
|
strong |
Status of the auto_apms_util::ActionWrapper execution process.
Definition at line 34 of file action_wrapper.hpp.
bool contains | ( | const ContainerT< ValueT, AllocatorT > & | c, |
const ValueT & | val ) |
Check whether a particular container structure contains a value.
ValueT | Type of the values inside the container. |
AllocatorT | Container allocator type. |
c | Container to be searched. |
val | Comparison value. |
true
if c
contains val
, false
otherwise. Definition at line 36 of file container.hpp.
bool isFileEmpty | ( | const std::string & | path | ) |
Determine if a file is empty.
A file is considered empty if it has no content or the content consists of whitespace characters only. If there is any non-whitespace character, this function returns false
.
path | Path to the file. |
true
if the file has no content or consists of whitespaces only, false
otherwise. Definition at line 24 of file filesystem.cpp.
void exposeToGlobalDebugLogging | ( | const rclcpp::Logger & | logger | ) |
Enable ROS 2 debug logging, if the C preprocessor flag _AUTO_APMS_DEBUG_LOGGING
is set.
logger | Logger instance. |
Definition at line 25 of file logging.cpp.
std::set< std::string > getPackagesWithResourceType | ( | const std::string & | resource_type, |
const std::set< std::string > & | exclude_packages = {} ) |
Get a list of all package names that register a certain type of ament_index
resources.
resource_type | Name of the resource type. |
exclude_packages | Packages to exclude when searching for resources. |
resource_type
excluding exclude_packages
. auto_apms_util::exceptions::ResourceError | if no resources of type resource_type were found in any of the intalled packages. |
Definition at line 28 of file resource.cpp.
std::string makeColoredText | ( | const std::string & | text, |
TextColor | color ) |
Add ANSI color escape sequences to display the text in color when printed to console.
The text color will be reset to default after the text ends.
text | Text to be displayed. |
color | Desired color of the text. |
Definition at line 65 of file string.cpp.
std::set< KeyT, CompareT, AllocatorT > getCommonElements | ( | std::set< KeyT, CompareT, AllocatorT > | c1, |
std::set< KeyT, CompareT, AllocatorT > | c2 ) |
Assemble common elements of two sets.
KeyT | Type of the keys within the set. |
CompareT | Comparator type. |
AllocatorT | Allocator type. |
c1 | First set. |
c2 | Second set. |
c1
as well as c2
. Definition at line 53 of file container.hpp.
std::vector< KeyT, AllocatorT > getCommonElements | ( | std::vector< KeyT, AllocatorT > | c1, |
std::vector< KeyT, AllocatorT > | c2 ) |
Assemble common elements of two vectors.
KeyT | Type of the values within the vector. |
AllocatorT | Allocator type. |
c1 | First vector. |
c2 | Second vector. |
c1
as well as c2
. Definition at line 70 of file container.hpp.
void setLoggingSeverity | ( | const rclcpp::Logger & | logger, |
const std::string & | severity ) |
Set the logging severity of a ROS 2 logger.
logger | Logger instance. |
severity | Desired severity level encoded as a string. Must be one of DEBUG, INFO, WARN, ERROR, FATAL or UNSET. |
Definition at line 38 of file logging.cpp.
void setLoggingSeverity | ( | const rclcpp::Logger & | logger, |
rclcpp::Logger::Level | severity ) |
Set the logging severity of a ROS 2 logger.
logger | Logger instance. |
severity | Desired severity level. |
Definition at line 60 of file logging.cpp.
std::set< std::string > getPackagesWithPluginResources | ( | const std::set< std::string > & | exclude_packages = {} | ) |
Get a list of all package names that register AutoAPMS plugin resources.
exclude_packages | Packages to exclude when searching for resources. |
exclude_packages
. auto_apms_util::exceptions::ResourceError | if no AutoAPMS plugin resources were found in any of the installed packages. |
Definition at line 52 of file resource.cpp.
std::string getPluginXMLPath | ( | const std::string & | package | ) |
Get the path of a plugin.xml manifest file used for initializing pluginlib::ClassLoader objects.
This function requires packages to install plugins.xml manifest files and register them as an ament_index
resource using the CMake macro auto_apms_util_register_plugins().
package | Name of the package registering AutoAPMS plugin resources. |
pluginlib
-style plugin manifest xml file. auto_apms_util::exceptions::ResourceError | if failed to find a plugin manifest file. |
auto_apms_util::exceptions::ResourceError | if an ament_index resource marker file is invalid. |
Definition at line 57 of file resource.cpp.
std::vector< std::string > collectPluginXMLPaths | ( | const std::set< std::string > & | exclude_packages = {} | ) |
Collect the paths of plugin.xml manifest files used for initializing pluginlib::ClassLoader objects.
This function requires packages to install plugins.xml manifest files and register them as an ament_index
resource using the CMake macro auto_apms_util_register_plugins().
exclude_packages | Packages to exclude when searching for plugins.xml file paths. |
pluginlib
-style plugin manifest xml files. auto_apms_util::exceptions::ResourceError | if failed to find a plugin manifest file. |
auto_apms_util::exceptions::ResourceError | if an ament_index resource marker file is invalid. |
Definition at line 76 of file resource.cpp.
std::vector< std::string > splitString | ( | const std::string & | str, |
const std::string & | delimiter, | ||
bool | remove_empty = true ) |
Split a string into multiple tokens using a specific delimiter string (Delimiter may consist of multiple characters).
Will remove empty strings if remove_empty
is true
(Default). So for example with the delimiter being ::
passing the string ::foo
will output a vector with one elements {"foo"}. If you want {"", "foo"}, you must set remove_empty
to false
.
[in] | str | String to split into multiple tokens. |
[in] | delimiter | Delimiter string at which the string shall be split. |
[in] | remove_empty | Remove empty string tokens in the result vector. |
Definition at line 24 of file string.cpp.
std::string printMap | ( | const std::map< std::string, std::string > & | map, |
const std::string & | key_val_sep = "=", | ||
const std::string & | entry_sep = ", " ) |
Converts a map to a string representation that is suited for printing to console.
map | Map to be converted to string. |
key_val_sep | Separator for the key-value pairs. |
entry_sep | Separator for the map's entries. |
map
. Definition at line 50 of file string.cpp.
std::string trimWhitespaces | ( | const std::string & | str | ) |
Trim whitespaces from both ends of a string.
str | String to trim. |
Definition at line 84 of file string.cpp.
std::string toCamelCase | ( | const std::string & | str | ) |
Transform a string to camelCase.
[in] | str | String to transform. |
Definition at line 97 of file string.cpp.
std::string toSnakeCase | ( | const std::string & | str | ) |
Transform a string to snake_case.
[in] | str | String to transform. |
Definition at line 116 of file string.cpp.