-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #185 from BlueAndi/feature/ROS2_TCP
Feature/ros2 tcp
- Loading branch information
Showing
14 changed files
with
1,582 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
; ******************************************************************************** | ||
; Build mode log configurations | ||
; * debug: Standard debugging purposes during development. | ||
; * release: The release build contains only the relevant user informations. | ||
; * trace: Hardcore debugging by following e.g. method call hierarchy. | ||
; ******************************************************************************** | ||
[mode:debug_log] | ||
build_flags = | ||
-D LOG_DEBUG_ENABLE=1 | ||
-D LOG_TRACE_ENABLE=0 | ||
-D CONFIG_LOG_SEVERITY=Logging::LOG_LEVEL_DEBUG | ||
|
||
[mode:release_log] | ||
build_flags = | ||
-D LOG_DEBUG_ENABLE=0 | ||
-D LOG_TRACE_ENABLE=0 | ||
-D CONFIG_LOG_SEVERITY=Logging::LOG_LEVEL_INFO | ||
|
||
[mode:trace_log] | ||
build_flags = | ||
-D LOG_DEBUG_ENABLE=1 | ||
-D LOG_TRACE_ENABLE=1 | ||
-D CONFIG_LOG_SEVERITY=Logging::LOG_LEVEL_TRACE | ||
|
||
[mode:debug_native] | ||
build_flags = | ||
-O0 | ||
-ggdb | ||
|
||
[mode:release_native] | ||
build_flags = | ||
-O2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,8 +25,8 @@ | |
DESCRIPTION | ||
*******************************************************************************/ | ||
/** | ||
* @brief Custom Micro-ROS transport. | ||
* @author Gabryel Reyes <[email protected]> | ||
* @brief Custom Micro-ROS transport class selector. | ||
* @author Norbert Schulz <[email protected]> | ||
* | ||
* @addtogroup Application | ||
* | ||
|
@@ -38,185 +38,11 @@ | |
/****************************************************************************** | ||
* Compile Switches | ||
*****************************************************************************/ | ||
|
||
/****************************************************************************** | ||
* Includes | ||
*****************************************************************************/ | ||
#include <IPAddress.h> | ||
#include <rmw_microros/rmw_microros.h> | ||
#include <WiFiUdp.h> | ||
|
||
/****************************************************************************** | ||
* Macros | ||
*****************************************************************************/ | ||
|
||
/****************************************************************************** | ||
* Types and Classes | ||
*****************************************************************************/ | ||
|
||
/** | ||
* Micro-ROS custom transport adaption. | ||
* | ||
* The static functions are used as these are called from C-language | ||
*/ | ||
class CustomRosTransport | ||
{ | ||
public: | ||
/** | ||
* Constructs a custom Micro-ROS transport. | ||
*/ | ||
CustomRosTransport() : m_udpClient(), m_address(), m_port(DEFAULT_PORT) | ||
{ | ||
} | ||
|
||
/** | ||
* Destroys custom Micro-ROS transport. | ||
* | ||
*/ | ||
~CustomRosTransport() | ||
{ | ||
} | ||
|
||
/** | ||
* Initialize custom ROS transport with agent address and port. | ||
* | ||
* @param[in] addr Micro-ROS agent IP-address | ||
* @param[in] port Micro-ROS agent port | ||
*/ | ||
void init(const IPAddress& addr, uint16_t port) | ||
{ | ||
m_address = addr; | ||
m_port = port; | ||
} | ||
|
||
/** | ||
* Get IP-address of Micro-ROS agent. | ||
* | ||
* @return IP-address | ||
*/ | ||
const IPAddress& getIPAddress() const | ||
{ | ||
return m_address; | ||
} | ||
|
||
/** | ||
* Get IP-address of Micro-ROS agent as string | ||
* | ||
* @return IP-address as string | ||
*/ | ||
const String getIPAddressAsStr() const | ||
{ | ||
return m_address.toString(); | ||
} | ||
|
||
/** | ||
* Get port of Micro-ROS agent. | ||
* | ||
* @return Port | ||
*/ | ||
uint16_t getPort() const | ||
{ | ||
return m_port; | ||
} | ||
|
||
/** | ||
* Open and initialize the custom transport (C-Entry Point). | ||
* https://micro.ros.org/docs/tutorials/advanced/create_custom_transports/ | ||
* | ||
* @param[in] transport The arguments passed through uxr_init_custom_transport. | ||
* | ||
* @return A boolean indicating if the opening was successful. | ||
*/ | ||
static bool open(uxrCustomTransport* transport); | ||
|
||
/** | ||
* Close the custom transport (C-Entry Point). | ||
* https://micro.ros.org/docs/tutorials/advanced/create_custom_transports/ | ||
* | ||
* @param[in] transport The arguments passed through uxr_init_custom_transport. | ||
* | ||
* @return A boolean indicating if the closing was successful. | ||
*/ | ||
static bool close(uxrCustomTransport* transport); | ||
|
||
/** | ||
* Write data to the custom transport (C-Entry Point). | ||
* https://micro.ros.org/docs/tutorials/advanced/create_custom_transports/ | ||
* | ||
* @param[in] transport The arguments passed through uxr_init_custom_transport. | ||
* @param[in] buffer The buffer to write. | ||
* @param[in] size The size of the buffer. | ||
* @param[out] errorCode The error code. | ||
* | ||
* @return The number of bytes written. | ||
*/ | ||
static size_t write(uxrCustomTransport* transport, const uint8_t* buffer, size_t size, uint8_t* errorCode); | ||
|
||
/** | ||
* Read data from the custom transport (C-Entry Point). | ||
* https://micro.ros.org/docs/tutorials/advanced/create_custom_transports/ | ||
* | ||
* @param[in] transport The arguments passed through uxr_init_custom_transport. | ||
* @param[out] buffer The buffer to read into. | ||
* @param[in] size The size of the buffer. | ||
* @param[in] timeout The timeout in milliseconds. | ||
* @param[out] errorCode The error code. | ||
* | ||
* @return The number of bytes read. | ||
*/ | ||
static size_t read(uxrCustomTransport* transport, uint8_t* buffer, size_t size, int timeout, uint8_t* errorCode); | ||
|
||
private: | ||
/** | ||
* Open and initialize the custom transport. | ||
* | ||
* @return A boolean indicating if the opening was successful. | ||
*/ | ||
bool open(void); | ||
|
||
/** | ||
* Close the custom transport. | ||
* | ||
* @return A boolean indicating if the closing was successful. | ||
*/ | ||
bool close(void); | ||
|
||
/** | ||
* Write data to the custom transport. | ||
* | ||
* @param[in] buffer The buffer to write. | ||
* @param[in] size The size of the buffer. | ||
* @param[out] errorCode The error code. | ||
* | ||
* @return The number of bytes written. | ||
*/ | ||
size_t write(const uint8_t* buffer, size_t size, uint8_t* errorCode); | ||
|
||
/** | ||
* Read data from the custom transport. | ||
* | ||
* @param[out] buffer The buffer to read into. | ||
* @param[in] size The size of the buffer. | ||
* @param[in] timeout The timeout in milliseconds. | ||
* @param[out] errorCode The error code. | ||
* | ||
* @return The number of bytes read. | ||
*/ | ||
size_t read(uint8_t* buffer, size_t size, int timeout, uint8_t* errorCode); | ||
|
||
/** | ||
* Default Micro-ROS agent port. | ||
*/ | ||
static const int DEFAULT_PORT = 8888; | ||
|
||
WiFiUDP m_udpClient; /**< UDP client */ | ||
IPAddress m_address; /**< IP address of the Micro-ROS agent */ | ||
uint16_t m_port; /**< Port of the Micro-ROS agent */ | ||
}; | ||
|
||
/****************************************************************************** | ||
* Functions | ||
*****************************************************************************/ | ||
#if defined(TRANSPORT_USE_TCP) && TRANSPORT_USE_TCP != 0 | ||
#include "Transports/CustomRosTransportTcp.h" | ||
#else | ||
#include "Transports/CustomRosTransportUdp.h" | ||
#endif /* else defined(TRANSPORT_USE_TCP) && TRANSPORT_USE_TCP != 0 */ | ||
|
||
#endif /* CUSTOM_ROS_TRANSPORT_H */ | ||
/** @} */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.