Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 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
21 changes: 21 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"version": "0.2",
"words": [
"Allman",
"cppcheck",
"doxyfile",
"graphviz",
"mattnotmitt",
"mrad",
"multirobot",
"pacman",
"teleop",
"Ulzer",
"wbsim",
"webots",
"Webots",
"XRCE",
"zumo",
"Zumo"
]
}
12 changes: 2 additions & 10 deletions DroidControlShip.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,8 @@
],
"settings": {
"editor.formatOnSave": true,
"cSpell.words": [
"cppcheck",
"teleop",
"Ulzer",
"wbsim",
"webots",
"Webots",
"XRCE",
"zumo",
"Zumo"
"conventionalCommits.scopes": [
"Logging"
]
}
}
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,24 +99,24 @@ Set the IP address and the port in [platformio_override.ini](./platformio_overri

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. |
| 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 --> <APP-NAME> --> Custom --> Launch

#### Run without Webots launcher

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

PlatformIO project tasks --> <APP-NAME> --> General --> Upload

#### Run via terminal

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

## The target

Expand Down Expand Up @@ -144,15 +144,15 @@ In a similar way, not providing a WiFi configuration will force the target into

## The Applications

| Application | Standalone | Zumo32U4 Robot Required | RadonUlzer Application | MQTT Broker Required |
| - | - | - | - | - |
| ConvoyLeader | No | Yes | ConvoyLeader | Yes |
| ConvoyFollower | No | Yes | RemoteControl | Yes |
| LineFollower | No | Yes | RemoteControl | No |
| RemoteControl | No | Yes | RemoteControl | Yes |
| SensorFusion | No | Yes | SensorFusion | Yes |
| Test | Yes | No | N/A | No |
| Turtle | No | Yes | RemoteControl | Yes (ROS2 + Micro-ROS Agent) |
| Application | Standalone | Zumo32U4 Robot Required | RadonUlzer Application | MQTT Broker Required |
| -------------- | ---------- | ----------------------- | ---------------------- | ---------------------------- |
| ConvoyLeader | No | Yes | ConvoyLeader | Yes |
| ConvoyFollower | No | Yes | RemoteControl | Yes |
| LineFollower | No | Yes | RemoteControl | No |
| RemoteControl | No | Yes | RemoteControl | Yes |
| SensorFusion | No | Yes | SensorFusion | Yes |
| Test | Yes | No | N/A | No |
| Turtle | No | Yes | RemoteControl | Yes (ROS2 + Micro-ROS Agent) |

## Documentation

Expand Down
2 changes: 1 addition & 1 deletion doc/ROS2/setup/Agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Start the MicroXRCEAgent binary to listen to **TCP** connections:

## Using the agent with the UDP interface

> [!WARNING]
> [!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.
Expand Down
6 changes: 3 additions & 3 deletions doc/ROS2/setup/Webots.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The setup procedure is described on [this page](https://docs.ros.org/en/jazzy/Tu

### 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)
See Task 2 from this [Jazzy documentation 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:

Expand Down Expand Up @@ -94,12 +94,12 @@ Required change:
```python
def is_wsl():
# return 'microsoft-standard' in uname().release
return False
return False
```

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

```bash
export WEBOTS_HOME=/usr/local/webots
Expand Down
7 changes: 3 additions & 4 deletions doc/ROS2/setup/wsl.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,11 @@ In the Ubuntu terminal:

## New Terminal Window

Is is recommended to install the new Microsoft Terminal Window
if not done already. It is available from
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).
[Github Microsoft Terminal](https://github.com/microsoft/terminal)

It offers tabs, history and embedds all kinds of shells (cmd, powershell, Ubuntu, git ...)
It offers tabs, history and embeds all kinds of shells (cmd, powershell, Ubuntu, git ...)

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

Expand Down
4 changes: 2 additions & 2 deletions doc/ROS2/uml/turtle_sim_webots.plantuml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ node "PC" {
package "ROS2" {
cloud "ROS2 Logical Network" as ros2LogicalNetwork

node "teleop_turtle" <<executable>> as teleopTurtle {
node "turtle_teleop_key" <<executable>> as teleopTurtle {
component "/teleop_turtle" <<ros2-node>> as teleopTurtleNode
}

node "Ros2SuperVisor" <<executable>> as wbSupervisorApp {
component "/Ros2SuperVisor/Ros2SuperVisor" <<ros2-node>> as ros2SupervisorNode
note bottom of ros2SupervisorNode
Simulation time through /clock topic.
May not be required.
May not be required. Currently disabled.
end note
}

Expand Down
24 changes: 16 additions & 8 deletions doc/ROS2/webots/webots.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,43 @@
# Using DCS with Webots under ROS2
# Using DCS with Webots under ROS2 <!-- omit in toc -->

The page discussed how to integrate DCS with Webots and ROS2.
This page discusses how to integrate DCS with Webots and ROS2.

- [Deployment for TurtleSim Example](#deployment-for-turtlesim-example)
- [Option 1: Building and Launching via Platformio](#option-1-building-and-launching-via-platformio)
- [RadonUlzer](#radonulzer)
- [DroidControlShip](#droidcontrolship)
- [Option 2: Building and Launching via ROS2 Launcher](#option-2-building-and-launching-via-ros2-launcher)

## Deployment for TurtleSim Example

![turtle_sim_webots](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/BlueAndi/DroidControlShip/main/doc/ROS2/uml/turtle_sim_webots.plantuml)

## Building and Launching via Platformio
## Option 1: Building and Launching via Platformio

### RadonUlzer

1. Run the following command in the terminal:
1. Run the following commands in the terminal:

```bash
cd ~/RadonUlzer
pio run -e RemoteControlSim -t webots_launcher_zumo_com_system
```

### DroidControlShip

1. Set micro-ROS agent ip address and port in ```data/config.json``` in microROSAgent section.
2. Run the following command in the terminal:
1. Check/adapt micro-ROS agent host/port in the microROSAgent section of ```data/config.json```.
2. Run the following commands in the terminal:

```bash
cd ~/DroidControlShip
pio run -e TurtleSim -t webots_launcher
```

## Building and Launching via ROS2 Launcher
## Option 2: Building and Launching via ROS2 Launcher

Use the ROS2 Package wrapper `ros2_dcs_turtlesim` to build and launch
the TurtleSim demo with DroidControlShip and RadonUlzer robots.
The `ros2_dcs_turtlesim` package is availabe from it's own GIT repository at
The `ros2_dcs_turtlesim` package is available from it's own GIT repository at
[https://github.com/nhjschulz/ros2_dcs_turtlesim](https://github.com/nhjschulz/ros2_dcs_turtlesim).

Create a Webots ros2 workspace as described in [setup/Webots.md](../setup/Webots.md),
Expand Down
2 changes: 1 addition & 1 deletion lib/APPConvoyFollower/src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void App::setup()
/* Register serial log sink and select it per default. */
if (true == Logging::getInstance().registerSink(&gLogSinkSerial))
{
(void)Logging::getInstance().selectSink("Serial");
(void)Logging::getInstance().selectSink(gLogSinkSerial.getName());

/* Set severity of logging system. */
Logging::getInstance().setLogLevel(CONFIG_LOG_SEVERITY);
Expand Down
2 changes: 1 addition & 1 deletion lib/APPConvoyLeader/src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void App::setup()
/* Register serial log sink and select it per default. */
if (true == Logging::getInstance().registerSink(&gLogSinkSerial))
{
(void)Logging::getInstance().selectSink("Serial");
(void)Logging::getInstance().selectSink(gLogSinkSerial.getName());

/* Set severity of logging system. */
Logging::getInstance().setLogLevel(CONFIG_LOG_SEVERITY);
Expand Down
2 changes: 1 addition & 1 deletion lib/APPLineFollower/src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void App::setup()
/* Register serial log sink and select it per default. */
if (true == Logging::getInstance().registerSink(&gLogSinkSerial))
{
(void)Logging::getInstance().selectSink("Serial");
(void)Logging::getInstance().selectSink(gLogSinkSerial.getName());

/* Set severity of logging system. */
Logging::getInstance().setLogLevel(CONFIG_LOG_SEVERITY);
Expand Down
4 changes: 2 additions & 2 deletions lib/APPRemoteControl/src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void App::setup()
/* Register serial log sink and select it per default. */
if (true == Logging::getInstance().registerSink(&gLogSinkSerial))
{
(void)Logging::getInstance().selectSink("Serial");
(void)Logging::getInstance().selectSink(gLogSinkSerial.getName());

/* Set severity of logging system. */
Logging::getInstance().setLogLevel(CONFIG_LOG_SEVERITY);
Expand Down Expand Up @@ -481,4 +481,4 @@ void App_currentVehicleChannelCallback(const uint8_t* payload, const uint8_t pay
LOG_WARNING("%s: Invalid payload size. Expected: %u Received: %u", CURRENT_VEHICLE_DATA_CHANNEL_NAME,
CURRENT_VEHICLE_DATA_CHANNEL_DLC, payloadSize);
}
}
}
4 changes: 2 additions & 2 deletions lib/APPSensorFusion/src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void App::setup()
/* Register serial log sink and select it per default. */
if (true == Logging::getInstance().registerSink(&gLogSinkSerial))
{
(void)Logging::getInstance().selectSink("Serial");
(void)Logging::getInstance().selectSink(gLogSinkSerial.getName());

/* Set severity of logging system. */
Logging::getInstance().setLogLevel(CONFIG_LOG_SEVERITY);
Expand Down Expand Up @@ -285,4 +285,4 @@ void App_sensorChannelCallback(const uint8_t* payload, const uint8_t payloadSize
LOG_WARNING("SENSOR_DATA:: Invalid payload size. Expected: %u Received: %u", SENSORDATA_CHANNEL_DLC,
payloadSize);
}
}
}
8 changes: 5 additions & 3 deletions lib/APPTurtle/src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void App::setup()
/* Register serial log sink and select it per default. */
if (true == Logging::getInstance().registerSink(&gLogSinkSerial))
{
(void)Logging::getInstance().selectSink("Serial");
(void)Logging::getInstance().selectSink(gLogSinkSerial.getName());

/* Set severity of logging system. */
Logging::getInstance().setLogLevel(CONFIG_LOG_SEVERITY);
Expand Down Expand Up @@ -293,10 +293,12 @@ void App::handleTurtle()
/* Check for new data. */
if (true == m_isNewTurtleSpeedSetpoint)
{
// clang-format off
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 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
// clang-format on

payload.linearCenter = linearSpeed;
payload.angular = angularSpeed;
Expand Down
6 changes: 3 additions & 3 deletions lib/APPTurtle/src/MicroRosClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ bool MicroRosClient::createEntities()
else
{
m_isExecutorInitialized = true;
isSuccessful = true;
isSuccessful = true;
}
}
}
Expand All @@ -244,7 +244,7 @@ void MicroRosClient::destroyEntities()
/* Clean up entities in reverse order of initialization. */
if (true == m_isExecutorInitialized)
{
ret = rclc_executor_fini(&m_executor);
ret = rclc_executor_fini(&m_executor);
m_isExecutorInitialized = false;
}

Expand Down Expand Up @@ -323,7 +323,7 @@ void MicroRosClient::waitingForAgentState()
if (RMW_RET_OK == rmw_uros_ping_agent(MICRO_ROS_AGENT_PING_TIMEOUT, MICRO_ROS_AGENT_PING_ATTEMPTS))
{
m_timer.stop();
m_state = STATE_CONNECTING;
m_state = STATE_CONNECTING;
m_numberOfConnectionAttempts = MAX_CONNECTING_ATTEMPTS;
}
else if (false == m_timer.isTimerRunning())
Expand Down
2 changes: 1 addition & 1 deletion lib/APPTurtle/src/MicroRosClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class MicroRosClient
BaseSubscriber* m_subscribers[RMW_UXRCE_MAX_SUBSCRIPTIONS];

/**
* Counter of subscribtions.
* Counter of subscriptions.
*/
size_t m_numberOfHandles;

Expand Down
2 changes: 1 addition & 1 deletion lib/PlatoonService/src/CollisionAvoidance.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class CollisionAvoidance
*/
CollisionAvoidance(Telemetry::Range closestProximityRangeValue, Telemetry::Range rangeThreshold) :
m_closestProximityRangeValue(closestProximityRangeValue),
m_rangeThreshold(rangeThreshold) {};
m_rangeThreshold(rangeThreshold){};

/**
* Default Destructor.
Expand Down
4 changes: 2 additions & 2 deletions lib/Utilities/src/Logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,11 @@ class Logging
void unregisterSink(LogSink* sink);

/**
* Select log sink.
* Selects a log sink by name.
*
* @param[in] name Log sink name
*
* @return If sink is selected, it will return true otherwise false.
* @return True if the sink has been selected successfully; false otherwise.
*/
bool selectSink(const String& name);

Expand Down