Skip to content

Commit

Permalink
Merge pull request #614 from RI-SE/fix_foxglove_in_docker
Browse files Browse the repository at this point in the history
Add foxglove to compose, fix sercurity settings for GUI
  • Loading branch information
SebastianSvanland committed Feb 5, 2024
2 parents 414eec9 + 3657bae commit e68d1c5
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 28 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ You can also start ATOS without the compose file with docker run:

If you run Docker Engine you can start ATOS using the computers own network stack with
```bash
docker run --network="host" --ipc=host --privileged -it -v ~/.astazero/ATOS/:/root/.astazero/ATOS/ astazero/atos_docker_env:latest bash -c "source /root/atos_ws/install/setup.sh ; ros2 launch atos launch_basic.py"
docker run --network="host" --ipc=host --privileged -it -v ~/.astazero/ATOS/:/root/.astazero/ATOS/ astazero/atos_docker_env:latest bash -c "source /root/atos_ws/install/setup.sh ; ros2 launch atos launch_basic.py insecure:=True"
```
If you run Docker Desktop you will need to specify the ports to expose to the host computer.
```bash
docker run --ipc=host --privileged -it -v ~/.astazero/ATOS/:/root/.astazero/ATOS/ -p 80:80 -p 8080:8080 -p 8081:8081 -p 8082:8082 -p 3000:3000 -p 3443:3443 -p 55555:55555 -p 443:443 -p 9090:9090 astazero/atos_docker_env:latest bash -c "source /root/atos_ws/install/setup.sh ; ros2 launch atos launch_basic.py"
docker run --ipc=host --privileged -it -v ~/.astazero/ATOS/:/root/.astazero/ATOS/ -p 80:80 -p 8080:8080 -p 8081:8081 -p 8082:8082 -p 3000:3000 -p 3443:3443 -p 55555:55555 -p 443:443 -p 9090:9090 astazero/atos_docker_env:latest bash -c "source /root/atos_ws/install/setup.sh ; ros2 launch atos launch_basic.py insecure:=True"
```

See the [GUI](../Usage/GUI/foxglove.md) documentation on how to enable secure connections.
You might wish to mount the config directory at ~/.astazero/ATOS/ to a different location on your host computer. This can be done by changing the path after the -v flag in the above command. You might also wish to inspect the image with instead of running the launch_basic.py script. This can be done by removing the last "bash -c ..." part of the command.


Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:
# - "55555:55555"
# - "443:443"
# - "9090:9090"
command: bash -c "source /root/atos_ws/install/setup.sh ; ros2 launch atos launch_basic.py"
command: bash -c "source /root/atos_ws/install/setup.sh ; ros2 launch atos launch_basic.py insecure:=True"
foxglove-studio:
image: ghcr.io/foxglove/studio:1.76
network_mode: host
Expand Down
5 changes: 3 additions & 2 deletions docs/Installation/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ sudo -E docker compose up

If you run Docker Engine you can start ATOS using the computers own network stack with
```bash
docker run --network="host" --ipc=host --privileged -it -v ~/.astazero/ATOS/:/root/.astazero/ATOS/ astazero/atos_docker_env:latest bash -c "source /root/atos_ws/install/setup.sh ; ros2 launch atos launch_basic.py"
docker run --network="host" --ipc=host --privileged -it -v ~/.astazero/ATOS/:/root/.astazero/ATOS/ astazero/atos_docker_env:latest bash -c "source /root/atos_ws/install/setup.sh ; ros2 launch atos launch_basic.py insecure:=True"
```
See the [GUI](../Usage/GUI/foxglove.md) documentation on how to enable secure connections.
If you run Docker Desktop, special care must be taken to allow the container running in the Docker Desktop VM to communicate with clients running on the host network. If uncertain about this we suggest installing Docker Engine instead.

Note: If no preexisting .astazero/ATOS folder is found, the docker image will create one. This folder will have root user permissions due to the way the docker image is built. For ease of use, change owner to your own user, run the following command on the host machine:
Expand Down Expand Up @@ -174,6 +175,6 @@ Also add the above line to ~/.bashrc or similar.
## <a name="running"></a> Running ATOS
Launch ATOS
```bash
ros2 launch atos launch_basic.py
ros2 launch atos launch_basic.py insecure:=True
```
When running ATOS for the first time and the no pre-existing .astazero/ATOS folder is found, ATOS will create some barebone configuration files which you can read more about in the configuration section [here](../Usage/How-to/configuration.md).
27 changes: 13 additions & 14 deletions docs/Installation/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ Make sure you have installed ATOS by following the instructions in the [Installa

# Quick start

This section will walk you through the steps of starting the ATOS server for the first time.
This section will walk you through the steps of starting ATOS, connecting it with a virtual test object and visualizing the scenario in Foxglove studio.

* Start ATOS by running either one of the docker commands (or with "ros2 launch ..." if you have installed it locally). In this guide, the docker compose command is used.```
* Start ATOS by running either one of the docker commands (or with "ros2 launch ..." if you have installed it locally). In this guide, the docker compose command is used.

/<git_repo_path>/ATOS $ docker compose up
(or if you are not in the docker group)
/<git_repo_path>/ATOS $ sudo -E docker compose up

!!! Warning
Running the default docker compose command will run network traffic insecurely between ATOS and Foxglove. See the [GUI](../Usage/GUI/foxglove.md) documentation on how to enable secure connections.


* Make sure the folder ~/.astazero/ATOS/ was created on the host machine. Since it was created by docker you will need to change the owner to your own user. Run the following command on the host machine:
Expand All @@ -21,22 +24,18 @@ This section will walk you through the steps of starting the ATOS server for the
sudo chown -R $USER:$USER ~/.astazero/ATOS/

* Download and build the client software _ISO\_objectDemo_ from the [isoObject repo](https://github.com/RI-SE/isoObject). Follow the build instructions and execute the binary ISO\_objectDemo in the build folder. This client software creates a virtual test object which will respond to control messages from ATOS. This software can be used to verify the correctness of communication between server and client.

![Alt text](isoobject_preconnect.png)

* Open a web browser and go to [https://localhost:3443](https://localhost:3443). You should see a page warning about NET::ERR_CERT_AUTHORITY_INVALID. This is because the certificates we create are self signed. Click on "Advanced" and then "Proceed to localhost (unsafe)". Now you should see the ATOS control panel.
* Start a virtual test object by running

Repeat the above steps for the self-signed WebSocket SSL certificate [https://localhost:9090](https://localhost:9090)
![Alt text](controlpanel.png)
docker run -it --rm --network host -v ~/.astazero/ATOS/:/root/.astazero/ATOS/ --name iso_object_demo astazero/iso_object_demo:latest

* In your browser, go to [Foxglove studio](https://studio.foxglove.dev/). Press Open connection -> Rosbridge. Enter WebSocket URL wss://localhost:9090. Press Open. You should now see ROS topics in the left panel named "Topics".
This docker command creates a virtual object which will respond to control messages from ATOS. You can find the source code for the _ISO\_objectDemo_ at the [isoObject repo](https://github.com/RI-SE/isoObject).

* Install the foxglove ATOS extensions from the ATOS repo. Do this by draging the .foxe files from the folder /{repo_path}/ATOS/plugins/foxglove/ into the Foxglove studio browser window.
* Open Chrome and go to [http://localhost:8080](http://localhost:8080).

* Install the ATOS layout by chosing Layout -> "Import from file" and select the file /{repo_path}/ATOS/plugins/foxglove/Map, 3D and control layout.json.
* Press Open connection -> Foxglove WebSocket. Enter WebSocket URL ws://localhost:8765. Press Open. You should now see ROS topics in the left panel named "Topics".

* Press the buttons Init and Connect in the control panel. You should now see several trajectories and an object appear in the 3D view.
* Install the foxglove ATOS extensions from the ATOS repo. Do this by dragging the .foxe files from the folder /{repo_path}/ATOS/plugins/foxglove/ into the Foxglove studio browser window.

* Press the buttons Init and Connect in the control panel pane. You should now see several trajectories and an object appear in the 3D view.

![Alt text](connected.gif)
* Now press Arm and Start. The object should now follow one of the trajectories.
6 changes: 3 additions & 3 deletions docs/Usage/GUI/foxglove.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ In order for everything to be displayed correctly, some extensions needs to be a
The premade layouts for ATOS are located [here](https://github.com/RI-SE/ATOS/tree/dev/plugins/foxglove). To add a layout in Foxglove Studio, go to `Layouts -> Import layout` and select one of the layouts for ATOS.

## Panels in Foxglove Studio
The panels used in layouts for ATOS are Simple Control, Map, and 3D. To change settings for the panels, press `Settings` that are located at the top right of each panel.
The panels used in layouts for ATOS are Control Panel, Map, and 3D. To change settings for the panels, press `Settings` that are located at the top right of each panel.

### Simple Control
This is a panel for Simple Control as described previously. It has the following settings:
### Control Panel
This is a panel for viewing the Control Panel as described [here](controlpanel.md). It has the following settings:

- `ATOS hostname` - The host address of ATOS.
- `ATOS port` - The port to connect to.
Expand Down
4 changes: 2 additions & 2 deletions docs/Usage/How-to/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ After starting ATOS the first time, you will find the test directory `.astazero/
This directory contains all configuration settings and journals which are located in the following directories:

- **Catalogs**
- Explanation: Catalog directory containing various OpenSCENARIO-files with settings and parameters used by esmini.
- Explanation: Catalog directory containing various OpenSCENARIO-files with settings and parameters used by scenario engine esmini.
- Vehicle/VehicleCatalog.xosc - Contains object details about vehicles that can be used in a test.
Mandatory properties are the "ip" and "model_id". The "ip" is the IP-address of the vehicle and the "model_id" is the ID which must be the same as the ID in the object .opro file in the objects folder.
- **certs**
Expand All @@ -23,7 +23,7 @@ This directory contains all configuration settings and journals which are locate
- **osc**
- Explanation: Directory containing the OpenSCENARIO-files.
- **pointclouds**
- Explanation: Directory containing site scans as pointclouds.
- Explanation: Directory containing site scans as point clouds.


## Changing ROS parameters
Expand Down
8 changes: 4 additions & 4 deletions plugins/foxglove/Map, 3D and control layout.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"configById": {
"atos_simple_control.Simple Control!494eifz": {
"atos_control_panel.Control Panel!494eifz": {
"atosHostname": "localhost",
"atosPort": "3443",
"atosProtocol": "https"
"atosPort": "3000",
"atosProtocol": "http"
},
"map!2s6yzns": {
"center": {
Expand Down Expand Up @@ -171,7 +171,7 @@
},
"layout": {
"first": {
"first": "atos_simple_control.Simple Control!494eifz",
"first": "atos_control_panel.Control Panel!494eifz",
"second": "map!2s6yzns",
"direction": "column",
"splitPercentage": 22.626441881100266
Expand Down
Binary file not shown.

0 comments on commit e68d1c5

Please sign in to comment.