Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix simulation container and refactoring #12

Open
wants to merge 2 commits into
base: humble-devel
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"MD033": false,
"MD013": {
"line_length": 100
}
}
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,31 @@

## Description

This repository contains useful packages and tools to work with the [vda5050_connector](https://github.com/inorbit-ai/ros_amr_interop/tree/galactic-devel/vda5050_connector) package. These resources provide a starting point to implement your own VDA5050 Adapter.
This repository contains useful packages and tools to work with the [vda5050_connector](https://github.com/inorbit-ai/ros_amr_interop/tree/galactic-devel/vda5050_connector)
package. These resources provide a starting point to implement your own VDA5050 Adapter.

## Examples

### Docker

The **docker** directory contains a build / deployment configuration to easily work and test the vda5050_connector package, your custom adapter and their dependencies. Check its [README](/docker/README.md) for more details.
The **docker** directory contains a build / deployment configuration to easily work and test the
`vda5050_connector` package, your custom adapter and their dependencies. Check its [README](/docker/README.md)
for more details.

### VDA5050 TB3 Adapter

The **vda5050_tb3_adapter** is a ROS2 package with a python implementation of the adapter. Check its [README](/vda5050_tb3_adapter/README.md) for more details.
The **vda5050_tb3_adapter** is a ROS2 package with a python implementation of the adapter. Check its
[README](/vda5050_tb3_adapter/README.md) for more details.

### VDA5050 Template package (C++)

The **vda5050_template_package** is a ROS2 package with a C++ template to implement a custom VDA5050 adapter. Check its [README](/vda5050_template_package/README.md) for more details.
The **vda5050_template_package** is a ROS2 package with a C++ template to implement a custom VDA5050
adapter. Check its [README](/vda5050_template_package/README.md) for more details.

## Contributing

Please see the [CONTRIBUTING](CONTRIBUTING.md) document.

## License

[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](LICENSE)
[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](LICENSE)
14 changes: 10 additions & 4 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ This directory contains two Dockerfiles:

- **development**: useful to compile, run and test the connector package with its adapter.

- **simulation**: launches a TB3 Gazebo simulation to test navigation commands and VDA actions using the adapter.
- **simulation**: launches a TB3 Gazebo simulation to test navigation commands and VDA actions
using the adapter.

These docker images can be built and run using the **docker-compose** file. The compose allows:

- Manipulating the execution of three containers: _development_, _simulation_ and _mosquitto_ (MQTT broker).
- DISPLAY capabilities.
- `DISPLAY` capabilities.
- Creating a shared network between the containers.
- Mounting the example adapter packages.

Expand All @@ -27,10 +28,15 @@ To work with it, there are two bash scripts that launch, attach and stop the con
./setup-sim.sh # Run the three containers.
```

These scripts automatically attach to the _development_ container. To attach another terminal to a given container (`development`, `simulation` or `mosquitto`) use:
**Note**: the simulation logs will be flooded with `discarding message because the queue is full`
messages. This is expected, and they will go away after setting simulated robot initial pose.

These scripts automatically attach to the _development_ container. To attach another terminal to a
given container (`development`, `simulation` or `mosquitto`) use:

```sh
cd deployment && docker compose exec <container> bash
```

Inside the _development_ container, you can directly compile the ROS2 code (`colcon build`) under the `dev_ws` folder, open tools like `rqt` or even send a message via MQTT.
Inside the _development_ container, you can directly compile the ROS2 code (`colcon build`) under
the `dev_ws` folder, open tools like `rqt` or even send a message via MQTT.
1 change: 1 addition & 0 deletions docker/deployment/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ services:
context: ../build
dockerfile: ../build/simulation.Dockerfile
user: docker
ipc: host
environment:
- DISPLAY
- QT_X11_NO_MITSHM=1
Expand Down
221 changes: 215 additions & 6 deletions vda5050_tb3_adapter/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# VDA5050 TB3 Adapter

ROS2 package with a Python implementation of the adapter for a [Turtlebot 3](https://github.com/ROBOTIS-GIT/turtlebot3/tree/galactic-devel). It contains the following directories:
ROS2 package with a Python implementation of the adapter for a
[Turtlebot 3](https://github.com/ROBOTIS-GIT/turtlebot3/tree/galactic-devel).
It contains the following directories:

- **config**: provides a _connector_tb3.yaml_ file to configure the MQTT bridge, controller and adapter parameters.
- **launch**: provides two `.launch.py` files, one for running the `tb3_adapter` node alone and the other to run the whole connector (`mqtt_bridge` and `controller` nodes from the `vda5050_connector` package, as well as the `tb3_adapter` node).
- **config**: provides a _connector_tb3.yaml_ file to configure the MQTT bridge,
controller and adapter parameters.
- **launch**: provides two `.launch.py` files, one for running the `tb3_adapter`
node alone and the other to run the whole connector (`mqtt_bridge` and
`controller` nodes from the `vda5050_connector` package, as well as the
`tb3_adapter` node).

## Running the TB3 adapter

Expand All @@ -17,13 +23,29 @@ To test the TB3 adapter sample, follow these steps:
# Build workspace packages
colcon build && source install/setup.bash
# Set gazebo simulated `tb3` initial pose
ros2 topic pub -1 --qos-reliability reliable /initialpose geometry_msgs/PoseWithCovarianceStamped \
"{header: {frame_id: map}, pose: {pose: {position: {x: -2.1, y: -0.5, z: 0.0}, orientation: {x: 0.0, y: 0.0, z: 0, w: 1.0000000}}, covariance: [0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.06853891945200942]}}"
ros2 topic pub -1 --qos-reliability reliable \
/initialpose geometry_msgs/PoseWithCovarianceStamped \
"{
header: {frame_id: map},
pose: {
pose: {
position: {x: -2.1, y: -0.5, z: 0.0},
orientation: {x: 0.0, y: 0.0, z: 0, w: 1.0000000}
},
covariance: [
0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.06853891945200942
]
}
}"
# Launch the TB3 VDA5050 connector
ros2 launch vda5050_tb3_adapter connector_tb3.launch.py
```

- Attach a new terminal to the _development_ container by running `docker compose exec development bash` inside the `docker/deployment/` folder (see [docker environment](../docker/README.md)). Send any of the following samples.
- Attach a new terminal to the _development_ container by running
`docker compose exec development bash` inside the `docker/deployment/` folder
(see [docker environment](../docker/README.md)). Send any of the following samples.

<details>
<summary>4 nodes order</summary>
Expand Down Expand Up @@ -134,6 +156,7 @@ To test the TB3 adapter sample, follow these steps:
]
}'
```

</details>

<details>
Expand Down Expand Up @@ -277,6 +300,7 @@ To test the TB3 adapter sample, follow these steps:
]
}'
```

</details>

<details>
Expand Down Expand Up @@ -315,4 +339,189 @@ To test the TB3 adapter sample, follow these steps:
]
}'
```

</details>

<details>
<summary>2 nodes order and subsequent stitch order with 2 extra nodes</summary>

```sh
RANDOM_ORDER_ID=$(cat /proc/sys/kernel/random/uuid)
STITCH_NODE_ACTION_ID=$(cat /proc/sys/kernel/random/uuid)
# Publish initial order
echo "Publishing order $RANDOM_ORDER_ID"
mosquitto_pub -h mosquitto -p 1883 -t uagv/v1/OSRF/TB3_1/order -m '
{
"orderId": "'$RANDOM_ORDER_ID'",
"orderUpdateId": 0,
"version": "2.0.0",
"manufacturer": "OSRF",
"serialNumber": "TB3_1",
"nodes": [
{
"nodeId": "node1",
"released": true,
"sequenceId": 0,
"nodePosition": {
"x": 2.0,
"y": 0.95,
"theta": -0.66,
"mapId": "map"
},
"actions": []
},
{
"nodeId": "node2",
"released": true,
"sequenceId": 2,
"nodePosition": {
"x": 1.18,
"y": -1.76,
"theta": 0.0,
"mapId": "map"
},
"actions": [
{
"actionType": "beep",
"actionId": "'$(cat /proc/sys/kernel/random/uuid)'",
"actionDescription": "Make a beep noise on node",
"blockingType": "NONE",
"actionParameters": []
}
]
},
{
"nodeId": "node3",
"released": true,
"sequenceId": 4,
"nodePosition": {
"x": -0.38,
"y": 1.89,
"theta": 0.0,
"mapId": "map"
},
"actions": [
{
"actionType": "beep",
"actionId": "'$STITCH_NODE_ACTION_ID'",
"actionDescription": "Make a beep noise on node",
"blockingType": "NONE",
"actionParameters": []
}
]
}
],
"edges": [
{
"edgeId": "edge1",
"released": true,
"sequenceId": 1,
"startNodeId": "node1",
"endNodeId": "node2",
"actions": []
},
{
"edgeId": "edge2",
"released": true,
"sequenceId": 3,
"startNodeId": "node2",
"endNodeId": "node3",
"actions": []
}
]
}'
# Wait 3 seconds before publishing stitch order
sleep 3
# Publish stitch order
echo "Publishing stitch order $RANDOM_ORDER_ID"
mosquitto_pub -h mosquitto -p 1883 -t uagv/v1/OSRF/TB3_1/order -m '
{
"orderId": "'$RANDOM_ORDER_ID'",
"orderUpdateId": 1,
"version": "2.0.0",
"manufacturer": "OSRF",
"serialNumber": "TB3_1",
"nodes": [
{
"nodeId": "node3",
"released": true,
"sequenceId": 4,
"nodePosition": {
"x": -0.38,
"y": 1.89,
"theta": 0.0,
"mapId": "map"
},
"actions": [
{
"actionType": "beep",
"actionId": "'$STITCH_NODE_ACTION_ID'",
"actionDescription": "Make a beep noise on node",
"blockingType": "NONE",
"actionParameters": []
}
]
},
{
"nodeId": "node4",
"released": true,
"sequenceId": 6,
"nodePosition": {
"x": -0.17,
"y": 1.74,
"theta": -2.6,
"mapId": "map"
},
"actions": [
{
"actionType": "beep",
"actionId": "'$(cat /proc/sys/kernel/random/uuid)'",
"actionDescription": "Make a beep noise on node",
"blockingType": "NONE",
"actionParameters": []
}
]
},
{
"nodeId": "node1",
"released": true,
"sequenceId": 8,
"nodePosition": {
"x": 2.0,
"y": 0.95,
"theta": -0.66,
"mapId": "map"
},
"actions": [
{
"actionType": "beep",
"actionId": "'$(cat /proc/sys/kernel/random/uuid)'",
"actionDescription": "Make a beep noise on node",
"blockingType": "NONE",
"actionParameters": []
}
]
}
],
"edges": [
{
"edgeId": "edge3",
"released": true,
"sequenceId": 5,
"startNodeId": "node3",
"endNodeId": "node4",
"actions": []
},
{
"edgeId": "edge4",
"released": true,
"sequenceId": 7,
"startNodeId": "node4",
"endNodeId": "node1",
"actions": []
}
]
}'
```

</details>