Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 43 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ It provides different kind of exclusive applications, used for educational purpo

- [The ZumoComSystem Shield](#the-zumocomsystem-shield)
- [The simulation](#the-simulation)
- [Installation for simulation](#installation-for-simulation)
- [Installation for simulation](#installation-for-simulation)
- [How to start?](#how-to-start)
- [Run](#run)
- [Run with Webots launcher (recommended)](#run-with-webots-launcher-recommended)
- [Run without Webots launcher](#run-without-webots-launcher)
- [Run via terminal](#run-via-terminal)
- [The target](#the-target)
- [Installation for target](#installation-for-target)
- [Build and flash procedure](#build-and-flash-procedure)
Expand Down Expand Up @@ -48,7 +52,7 @@ The simulation is based on the open source robot simulator *Webots*. The applica

![simulation-deployment](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/BlueAndi/DroidControlShip/main/doc/architecture/uml/PhysicalView/SimulationDeployment.plantuml)

## Installation for simulation
### Installation for simulation

1. Install the native compiler toolchain:
- Linux
Expand All @@ -64,7 +68,7 @@ The simulation is based on the open source robot simulator *Webots*. The applica

### How to start?

After you built the application, you will find in in ```.pio/build/<APPLICATION-NAME>/program.exe```. It provides several command line arguments to configure certain features. Use -h or --help to get a short user friendly overview about them.
After you built the application, you will find it in ```.pio/build/<APPLICATION-NAME>/program[.exe]```. It provides several command line arguments to configure certain features. Use -h or --help to get a short user friendly overview about them.

The applications are using a configuration file in JSON format to retrieve certain settings. In the very first run, such a configuration file will be automatically be created. If there exists already one, it will be loaded without modifications (regardless of any other program arguments).

Expand All @@ -78,6 +82,42 @@ MQTT Broker --> Webots World --> RadonUlzer --> DroidControlShip

In order to simplify this process, the [Launcher](https://github.com/gabryelreyes/Launcher) project is under active development.

### Run

There are 3 ways how to run now the application. Choose according to your needs.

#### Run with Webots launcher (recommended)

The Webots launcher is recommended to connect to the simulation.

It is mandatory if the simulation contains more than one robot. The robot is identified by its name. Adapt the robot name in the [platformio_override.ini](./platformio_override.ini), see *webots_robot_name*.

The Webots documentation has more details about [Single Simulation and Multiple Local Extern Robot Controllers](https://cyberbotics.com/doc/guide/running-extern-robot-controllers?tab-os=windows#single-simulation-and-multiple-local-extern-robot-controllers).

It is mandatory too if the simulation does not run locally (e.g. Webots runs on windows host and RadonUlzer in WSL).
Set the IP address and the port in [platformio_override.ini](./platformio_override.ini), see *webots_ip_address* and *webots_protocol*.

Use *ipc* as *webots_protocol* for local connections and *tcp* for remote connections.

| Key | Description |
| --- | ----------- |
| webots\_ip\_address | The IP address of the Webots simulation, which is used for TCP communication. |
| webots\_protocol | \[ipc\|tcp\] - ipc is faster but only works on the same machine, tcp works also over network. |
| webots\_robot\_name | The robot name used to identify the robot in the Webots world. See Webots world robot prototype. |

PlatformIO project tasks --> &lt;APP-NAME&gt; --> Custom --> Launch

#### Run without Webots launcher

This can be choosen in case the simulation waits just for one robot.

PlatformIO project tasks --> &lt;APP-NAME&gt; --> General --> Upload

#### Run via terminal

1. Open a command line (shell) and change to the folder with the built executable in ```.pio/build/<APP-NAME>```. This folder contains all necessary shared libraries as well.
2. Start the executable.

## The target

The main target of the firmware is the [ZumoComSystem](https://github.com/NewTec-GmbH/ZumoComSystem) from NewTec GmbH, which is a shield for the [Pololu 32U4 Zumo](https://www.pololu.com/product/2510) robot.
Expand Down
7 changes: 5 additions & 2 deletions doc/ROS2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,14 @@ The following diagram illustrates the component deployment of micro-ROS in the D

## Installation Steps

The installation procedure handles how the WSL in Windows is used to install the Ubuntu Linux distribution, the ROS2, Webots and micro-ROS parts.

1. [WSL with Ubuntu](./setup/wsl.md)
2. [ROS2 Jazzy](./setup/ROS2_Jazzy.md)
3. [Webots](./setup/Webots.md)
4. [micro-ROS Native](./setup/microROS_Native.md)
5. [micro-ROS Agent](./setup/Agent.md)
4. [VSCode in WSL](./setup/vscode.md)
5. [micro-ROS Native](./setup/microROS_Native.md)
6. [micro-ROS Agent](./setup/Agent.md)

## Execution Steps

Expand Down
21 changes: 11 additions & 10 deletions doc/ROS2/setup/Agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

Sources: [here](https://micro-xrce-dds.docs.eprosima.com/en/latest/index.html)

* [Micro XRCE-DDS Agent](#micro-xrce-dds-agent)
* [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)
- [Micro XRCE-DDS Agent](#micro-xrce-dds-agent)
- [Installation](#installation)
- [Using the agent with the serial interface](#using-the-agent-with-the-serial-interface)
- [Using the agent with the TCP interface (recommended)](#using-the-agent-with-the-tcp-interface-recommended)
- [Using the agent with the UDP interface](#using-the-agent-with-the-udp-interface)
- [Troubleshooting on WSL environment](#troubleshooting-on-wsl-environment)
- [Testing the node](#testing-the-node)

## Installation

Follow the instructions detailed [here](https://micro-xrce-dds.docs.eprosima.com/en/latest/installation.html). It has only been tested as standalone executable (without Docker neither using Snap).
Follow the instructions detailed in [eProsima Micro XRCE-DDS documentation](https://micro-xrce-dds.docs.eprosima.com/en/latest/installation.html). It has only been tested as standalone executable (without Docker neither using Snap).
`cmake` and `make` are required to build the Agent.

## Using the agent with the serial interface
Expand All @@ -38,7 +38,7 @@ 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
## Using the agent with the TCP interface (recommended)

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

Expand All @@ -60,7 +60,7 @@ Start the MicroXRCEAgent binary to listen to **TCP** connections:
> [!WARNING]
> Note: UDP ports on WSL are not working properly if you need to access them outside of the WSL VM (Status 2024-10-31). Use TCP with WSL instead.
> See [https://github.com/micro-ROS/micro-ROS-Agent/issues/194](https://github.com/micro-ROS/micro-ROS-Agent/issues/194) for further details.
> The mentioned ```netsh`` tool for port proxy forwarding only supports TCP.
> The mentioned ```netsh``` tool for port proxy forwarding only supports TCP.

Start the MicroXRCEAgent binary to listen to UDP connections:

Expand All @@ -87,6 +87,7 @@ Update: 2024-10-30: TCP transport is available in DroidControlShip, making UDP u
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.

Publish some test messages (1Hz twist message):

```bash
ros2 topic pub -r 1.0 cmd_vel geometry_msgs/msg/Twist "{linear: {x: 2.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 1.8}}"
```
81 changes: 59 additions & 22 deletions doc/ROS2/setup/Webots.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,52 @@
# Installation of Webots
# Installation of Webots <!-- omit in toc -->

## Webots Setup Procedure
- [Windows](#windows)
- [Webots ROS2 Package (Webots on Windows)](#webots-ros2-package-webots-on-windows)
- [Running Webots ROS2 Universal Robot (on Windows)](#running-webots-ros2-universal-robot-on-windows)
- [Linux](#linux)
- [Webots Setup Procedure](#webots-setup-procedure)
- [Launching Webots](#launching-webots)
- [Webots ROS2 Package (Webots in WSL)](#webots-ros2-package-webots-in-wsl)
- [Running Webots ROS2 Universal Robot (on Linux)](#running-webots-ros2-universal-robot-on-linux)
- [Setting up a Webots Simulation with ROS2 controller](#setting-up-a-webots-simulation-with-ros2-controller)
- [Webots Supervisor](#webots-supervisor)

Follow the official installation guide for Webots on Linux with APT on the
[Webots installation Page](https://cyberbotics.com/doc/guide/installation-procedure#installing-the-debian-package-with-the-advanced-packaging-tool-apt).
## Windows

Follow the official installation guide for Webots on Windows in the [Webots User Guide Installation Procedure](https://cyberbotics.com/doc/guide/installation-procedure#installation-on-windows).

ROS2 requires Linux, therefore in this setup RadonUlzer and DroidControlShip are running inside the WSL. They will connect via TCP to Webots running on the host system.

### Webots ROS2 Package (Webots on Windows)

The setup procedure is described on [this page](https://docs.ros.org/en/jazzy/Tutorials/Advanced/Simulators/Webots/Installation-Windows.html) from the Jazzy documentation. If the listed package is not found by apt, you will need to install it by building from source.

### Running Webots ROS2 Universal Robot (on Windows)

See Task 2 from this [Jazzy documentaion page](https://docs.ros.org/en/jazzy/Tutorials/Advanced/Simulators/Webots/Installation-Ubuntu.html#launch-the-webots-ros2-universal-robot-example)

Replace ```<DRIVE>/<WEBOTS-INSTALLATION_DIRECTORY>``` in the following terminal commands:

```bash
export WEBOTS_HOME=/mnt/<DRIVE>/<WEBOTS-INSTALLATION_DIRECTORY>
export WEBOTS_CONTROLLER_LIB_PATH=$WEBOTS_HOME/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$WEBOTS_CONTROLLER_LIB_PATH/controller

cd ros2_webots_ws
source install/local_setup.bash

ros2 launch webots_ros2_universal_robot multirobot_launch.py
```

You should get the following simulation on the screen:

![Webots ROS2 Example](./img/Webots_ros2_example.png)

## Linux

### Webots Setup Procedure

Follow the official installation guide for Webots on Linux with APT in the [Webots User Guide Installation Procedure](https://cyberbotics.com/doc/guide/installation-procedure#installing-the-debian-package-with-the-advanced-packaging-tool-apt).

> **_NOTE:_**
Some of the steps result in larger package downloads.
Expand All @@ -17,7 +60,7 @@ Set environment variables for Webots home directory, the Webots controller libra
source $HOME/.bashrc
```

## Launching Webots
### Launching Webots

Try

Expand All @@ -36,31 +79,25 @@ If you get an error like "cannot open Display", try the following:

- try running Webots again

## Webots ROS2 Package

The setup procedure is described on [this page](https://docs.ros.org/en/jazzy/Tutorials/Advanced/Simulators/Webots/Installation-Ubuntu.html)
from the Jazzy documentation. The listed package is not found by apt, so
install it using building from source.
### Webots ROS2 Package (Webots in WSL)

Note: For the time being, we need to install a patched version from https://github.com/nhjschulz/webots_ros2.git.
The official one doesn't seem to support webots running inside WSL, but expects msys2/mingw.
The setup procedure is described on [this page](https://docs.ros.org/en/jazzy/Tutorials/Advanced/Simulators/Webots/Installation-Ubuntu.html) from the Jazzy documentation. If the listed package is not found by apt, you will need to install it by building from source.

transcript:
Because of [Webots Issue 6570 in webots-ros2-driver](https://github.com/cyberbotics/webots/issues/6570), running Webots inside the WSL requires a small local change. If it detects that the system is a WSL system, it will try to run ```webots.exe``` instead of ```webots```.

```bash
mkdir -p ros2_webots_ws/src
cd ros2_webots_ws
git clone --recurse-submodules https://github.com/nhjschulz/webots_ros2.git src/webots_ros2

sudo apt install python3-pip python3-rosdep python3-colcon-common-extensions
sudo rosdep init && rosdep update
rosdep install --from-paths src --ignore-src --rosdistro jazzy
sudo nano /opt/ros/jazzy/lib/python3.12/site-packages/webots_ros2_driver/utils.py
```

colcon build
Required change:

```python
def is_wsl():
# return 'microsoft-standard' in uname().release
return False
```

## Running Webots ROS2 Universal Robot
### Running Webots ROS2 Universal Robot (on Linux)

See Task 2 from this [Jazzy documentaion page](https://docs.ros.org/en/jazzy/Tutorials/Advanced/Simulators/Webots/Installation-Ubuntu.html#launch-the-webots-ros2-universal-robot-example)

Expand Down
29 changes: 29 additions & 0 deletions doc/ROS2/setup/vscode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# VSCode in WSL

All of the following steps are applied in the Ubuntu terminal.

If DroidControlShip is not cloned yet, this will be the first step:

```bash
cd ~
git clone https://github.com/BlueAndi/DroidControlShip.git
```

In VSCode the PlatformIO extension is required. The PlatformIO extension requires Python with virtual environment capabilities.

```bash
sudo apt install -y python3-venv
```

Start VSCode inside the DroidControlShip folder.

```bash
cd DroidControlShip
vscode .
```

Install now the PlatformIO extension (extension id: platformio.platformio-ide) in VSCode and wait until installation is complete.

After that a VSCode restart is required and VSCode is ready.

Install additionally the C/C++ Extension Pack (extension id: ms-vscode.cpptools-extension-pack).
36 changes: 26 additions & 10 deletions doc/ROS2/setup/wsl.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Installation of WSL for ROS2 Jazzy

Each ROS2 distribution targets a specific Linux environment.
For Jazzy it is *Ubuntu 24.04*. To run it on Windows 10/11,
Each ROS2 distribution targets a specific Linux environment.
For Jazzy it is *Ubuntu 24.04*. To run it on Windows 10/11,
the WSL2 feature will be used.

## Install WSL
## Install WSL

Installing WSL (Linux on Windows) is officially supported by Microsoft.
For details refer to the following
Expand All @@ -18,9 +18,12 @@ But all you need is this from a windows power shell:
```

> **_NOTE:_**
A Windows message dialog may popup in the background, to ask for elevated rights.
A Windows message dialog may popup in the background, to ask for elevated rights.
Check for such a window if the installation does not progress.

> **_NOTE:_**
If windows requests to restart after trying to install Ubuntu, do so and try to install again.

## First time use

A console window should appear with installation messages. It will ask you
Expand Down Expand Up @@ -51,6 +54,8 @@ Configure Ubuntu to login by default with your user in the windows power shell:

Check that you have the right distribution installed (Ubuntu 24.04 LTS):

In the Ubuntu terminal:

```bash
$ lsb_release -a
No LSB modules are available.
Expand All @@ -62,7 +67,7 @@ Check that you have the right distribution installed (Ubuntu 24.04 LTS):

## New Terminal Window

Is is recommended to install the new Microsoft Terminal Window
Is is recommended to install the new Microsoft Terminal Window
if not done already. It is available from

[Github Microsoft Terminal](https://github.com/microsoft/terminal).
Expand All @@ -71,20 +76,31 @@ It offers tabs, history and embedds all kinds of shells (cmd, powershell, Ubuntu

![New Shell](./img/new_shell.png)

## Exposing WSL UDP Ports to the Network
## Exposing WSL Ports to the Network

To make UDP ports listening in WSL accessible from your local network, follow these steps:
Find your WSL IP address by running this command in WSL:
To make TCP/UDP ports listening in WSL accessible from your local network, follow these steps:

Find your WSL IP address by running this command **in WSL**:

```bash
ip addr show eth0
```

or this **in a windows powershell**:

```bat
wsl hostname -I
```

> **_NOTE:_**
UDP port forwarding to wsl is not supported without mirrored networking (WSL 2.0.0 on win11)
TCP/UDP port forwarding to WSL is not supported without mirrored networking (WSL 2.0.0 on win11)

Open a terminal in an administrator shell on Windows.
Run the following command to forward the UDP port, replacing [PORT] with your desired port number (usually 8888) and [WSL_IP] with the IP address:
Run the following commands to forward the TCP/UDP port, replacing [PORT] with your desired port number and [WSL_IP] with the IP address.

| Port | Description |
| ---- | ------------------ |
| 8888 | ROS2 network port |

```bat
netsh interface portproxy add v4tov4 listenport=[PORT] listenaddress=0.0.0.0 connectport=[PORT] connectaddress=[WSL_IP]
Expand Down
10 changes: 0 additions & 10 deletions doc/ROS2/webots/webots.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,3 @@ The `ros2_dcs_turtlesim` package is availabe from it's own GIT repository at

Create a Webots ros2 workspace as described in [setup/Webots.md](../setup/Webots.md),
then follow the instructions in `ros2_dcs_turtlesim` readme.md for building and launching.

## Notes

If the robot display shows an MCAL error, the calibration for the RadonUlzer is missing. Perform it first or manipulate the settings:

```bash
nano .pio/build/RemoteControlSim/settings.json
```

Set the maxSpeed value to 4200.
2 changes: 1 addition & 1 deletion lib/APPTurtle/src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ void App::handleTurtle()
RobotSpeed payload;
const int32_t MILLI_CONVERSION_FACTOR = 1000;
int32_t linearSpeed = m_turtleSpeedSetpoint.linear.x * MILLI_CONVERSION_FACTOR; /* Linear speed in mm/s */
int32_t angularSpeed = m_turtleSpeedSetpoint.angular.z * MILLI_CONVERSION_FACTOR; /* Angular speed in mrad/s */
int32_t angularSpeed = m_turtleSpeedSetpoint.angular.z * MILLI_CONVERSION_FACTOR; /* Angular speed in mrad/s */

payload.linearCenter = linearSpeed;
payload.angular = angularSpeed;
Expand Down
Loading