diff --git a/include/mros2.h b/include/mros2.h index 8296738..b1fa15b 100644 --- a/include/mros2.h +++ b/include/mros2.h @@ -13,6 +13,14 @@ extern void* __dso_handle; #endif +namespace rtps +{ +namespace Config +{ +extern std::array IP_ADDRESS; +} +} + namespace mros2 { @@ -81,6 +89,8 @@ class Subscriber void spin(); +void setIPAddrRTPS(std::array ipaddr); + } /* namespace mros2 */ namespace message_traits diff --git a/src/mros2.cpp b/src/mros2.cpp index d42af45..b9b1f93 100644 --- a/src/mros2.cpp +++ b/src/mros2.cpp @@ -282,6 +282,13 @@ void spin() } } +void setIPAddrRTPS(std::array ipaddr) +{ + rtps::Config::IP_ADDRESS = ipaddr; + + MROS2_DEBUG("[MROS2LIB] set IP address for RTPS communication"); +} + } /* namespace mros2 */ @@ -311,6 +318,14 @@ void setTrue(void* args) *static_cast(args) = true; } +namespace rtps +{ +namespace Config +{ +std::array IP_ADDRESS; +} +} /* namespace rtps */ + /* * specialize template functions described in platform's workspace */