Skip to content

Commit

Permalink
Update ROS2 documentation
Browse files Browse the repository at this point in the history
+ TCP support documented
  • Loading branch information
nhjschulz committed Oct 30, 2024
1 parent a427430 commit ab1f873
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
26 changes: 25 additions & 1 deletion doc/ROS2/setup/Agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Sources: [here](https://micro-xrce-dds.docs.eprosima.com/en/latest/index.html)
* [Installation](#installation)
* [Using the agent with the serial interface](#using-the-agent-with-the-serial-interface)
* [Using the agent with the UDP interface](#using-the-agent-with-the-udp-interface)
* [Using the agent with the TCP interface](#using-the-agent-with-the-tcp-interface)
* [Troubleshooting on WSL environment](#troubleshooting-on-wsl-environment)
* [Testing the node](#testing-the-node)

Expand Down Expand Up @@ -37,9 +38,30 @@ Once the Agent and the Client are connected, the terminal should show something
[1723186868.574254] info | ProxyClient.cpp | create_datawriter | datawriter created | client_key: 0x64C59DFF, datawriter_id: 0x000(5), publisher_id: 0x000(3)
```

## Using the agent with the TCP interface

Start the MicroXRCEAgent binary to listen to **TCP** connections:

```bash
./MicroXRCEAgent tcp4 -p 8888 -v 6
[1730295182.773705] info | TCPv4AgentLinux.cpp | init | running... | port: 8888
[1730295182.774347] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 6
[1730295187.775068] debug | TCPv4AgentLinux.cpp | recv_message | [==>> TCP <<==] | client_key: 0x00000000, len: 16, data:
0000: 80 00 00 00 02 01 08 00 00 0A FF FD 02 00 00 00
[1730295187.775861] debug | TCPv4AgentLinux.cpp | send_message | [** <<TCP>> **] | client_key: 0x00000000, len: 36, data:
0000: 80 00 00 00 06 01 1C 00 00 0A FF FD 00 00 01 0D 58 52 43 45 01 00 01 0F 00 01 0D 00 01 00 00 00
0020: 00 00 00 00
[1730295188.777062] debug | TCPv4AgentLinux.cpp | recv_message | [==>> TCP <<==] | client_key: 0x00000000, len: 24, data:
...
```

## Using the agent with the UDP interface

Start the MicroXRCEAgent binary to listen to UDP connections
> [!WARNING]
> Note: UDP ports on WSL are not working properly if you need to access them outside of the WSL VM. Use TCP with WSL instead.
Start the MicroXRCEAgent binary to listen to UDP connections:

```bash
./MicroXRCEAgent udp4 -p 8888 -v 6
[1724834512.980210] info | UDPv4AgentLinux.cpp | init | running... | port: 8888
Expand All @@ -56,6 +78,8 @@ Start the MicroXRCEAgent binary to listen to UDP connections

UDP connections [setup wsl](./wsl.md#exposing-wsl-udp-ports-to-the-network) (Requires Win 11).

Update: 2024-10-30: TCP transport is available in DroidControlShip, making UDP usage optional. Use TCP on WSL to avoid the trouble.

## Testing the node

In order to test your node, you can use `ros2 topic list` to list all topics used, or `ros2 topic echo <topic_name>` to listen to incoming data in a specific topic.
Expand Down
2 changes: 1 addition & 1 deletion lib/APPTurtle/src/CustomRosTransport.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
DESCRIPTION
*******************************************************************************/
/**
* @brief Custom Micro-ROS transport class selector
* @brief Custom Micro-ROS transport class selector.
* @author Norbert Schulz <[email protected]>
*
* @addtogroup Application
Expand Down
2 changes: 0 additions & 2 deletions lib/WiFiNative/src/WifiClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ void WiFiClient::stop()
}
}


size_t WiFiClient::write(const uint8_t* buffer, size_t size)
{
size_t remaining = size;
Expand All @@ -132,7 +131,6 @@ int WiFiClient::read(uint8_t* buffer, size_t size)
{
int retval = -1;


if (connected())
{
if (-1 != ::poll(&m_poll, 1, 10))
Expand Down

0 comments on commit ab1f873

Please sign in to comment.