Skip to content

Commit 10917eb

Browse files
committed
Add ability to debug from VSCode; added docs as well
Also print args to bws
1 parent 2d6039c commit 10917eb

19 files changed

+155
-52
lines changed

.vscode/c_cpp_properties.json

+36-14
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,37 @@
11
{
2-
"configurations": [
3-
{
4-
"name": "Linux",
5-
"includePath": ["${workspaceFolder}/ros_ws/**", "/opt/ros/humble/include/**"],
6-
"defines": [],
7-
"compilerPath": "/usr/bin/gcc",
8-
"cStandard": "c11",
9-
"cppStandard": "c++17",
10-
"intelliSenseMode": "clang-x64"
11-
}
12-
],
13-
"version": 4
14-
}
15-
2+
"configurations": [
3+
{
4+
"browse": {
5+
"databaseFilename": "${default}",
6+
"limitSymbolsToIncludedHeaders": false
7+
},
8+
"includePath": [
9+
"/root/AirStack/ros_ws/install/vdb_mapping_interfaces/include/**",
10+
"/root/AirStack/ros_ws/install/trajectory_library/include/**",
11+
"/root/AirStack/ros_ws/install/mavros_interface/include/**",
12+
"/root/AirStack/ros_ws/install/robot_interface/include/**",
13+
"/root/AirStack/ros_ws/install/px4_msgs/include/**",
14+
"/root/AirStack/ros_ws/install/mav_system_msgs/include/**",
15+
"/root/AirStack/ros_ws/install/mav_state_machine_msgs/include/**",
16+
"/root/AirStack/ros_ws/install/mav_planning_msgs/include/**",
17+
"/root/AirStack/ros_ws/install/mav_msgs/include/**",
18+
"/root/AirStack/ros_ws/install/disparity_map_representation/include/**",
19+
"/root/AirStack/ros_ws/install/map_representation_interface/include/**",
20+
"/root/AirStack/ros_ws/install/disparity_graph/include/**",
21+
"/root/AirStack/ros_ws/install/behavior_tree/include/**",
22+
"/root/AirStack/ros_ws/install/behavior_tree_msgs/include/**",
23+
"/root/AirStack/ros_ws/install/airstack_common/include/**",
24+
"/root/AirStack/ros_ws/install/airstack_msgs/include/**",
25+
"/opt/ros/humble/include/**",
26+
"/usr/include/**",
27+
"/root/AirStack/ros_ws/src/**"
28+
],
29+
"name": "ROS",
30+
"intelliSenseMode": "gcc-x64",
31+
"compilerPath": "/usr/bin/gcc",
32+
"cStandard": "gnu11",
33+
"cppStandard": "c++14"
34+
}
35+
],
36+
"version": 4
37+
}

.vscode/extensions.json

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
22
"recommendations": [
33
"ms-python.black-formatter",
4+
"ms-iot.vscode-ros",
5+
"ms-vscode-remote.remote-ssh",
6+
"ms-python.python",
7+
"ms-vscode-remote.remote-containers"
48
]
59
}

.vscode/launch.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "ROS2: Launch robot.launch.py",
6+
"type": "ros",
7+
"request": "launch",
8+
"target": "${workspaceFolder}/ros_ws/install/robot_bringup/share/robot_bringup/launch/robot.launch.xml",
9+
}
10+
]
11+
}

.vscode/tasks.json

+17-5
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,32 @@
22
"version": "2.0.0",
33
"tasks": [
44
{
5-
"label": "build",
5+
"label": "build ros_ws",
66
"type": "shell",
77
"options": {
88
"cwd": "${workspaceFolder}/ros_ws"
99
},
10-
"command": "colcon build --cmake-args '-DCMAKE_BUILD_TYPE=Debug'"
10+
"command": [
11+
"source /root/.bashrc &&",
12+
"bws --cmake-args '-DCMAKE_BUILD_TYPE=Debug'"
13+
],
14+
"problemMatcher": [],
15+
"group": {
16+
"kind": "build",
17+
"isDefault": true
18+
}
1119
},
1220
{
13-
"label": "test",
21+
"label": "test ros_ws",
1422
"type": "shell",
1523
"options": {
1624
"cwd": "${workspaceFolder}/ros_ws"
1725
},
18-
"command": "colcon test && colcon test-result"
26+
"command": [
27+
"source /opt/ros/humble/setup.bash;",
28+
"source ${workspaceFolder}/ros_ws/install/setup.bash;",
29+
"colcon test && colcon test-result"
30+
],
1931
}
2032
]
21-
}
33+
}

docker/Dockerfile.airstack-dev

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ RUN apt install -y \
99
vim nano wget curl tree \
1010
cmake build-essential \
1111
less htop jq \
12-
python3-pip
12+
python3-pip \
13+
gdb
1314

1415
# Package dependencies
1516
# perform ROS dependency installation for our workspace.

docker/docker-compose.yaml

+21-23
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
services:
33
# ==============================================================================
44
isaac-sim:
5+
image: &isaac-sim-image airlab-storage.andrew.cmu.edu:5001/shared/isaac-sim_ros-humble:v1.0.0
56
build:
67
context: ../
78
dockerfile: docker/Dockerfile.isaac-ros
89
tags:
9-
- airlab-storage.andrew.cmu.edu:5001/shared/isaac-sim_ros-humble:v1.0.0
10-
image: airlab-storage.andrew.cmu.edu:5001/shared/isaac-sim_ros-humble:v1.0.0
10+
- *isaac-sim-image
1111
container_name: isaac-sim
1212
entrypoint: bash
1313
# Interactive shell
@@ -58,16 +58,21 @@ services:
5858
- ./extras/config:/root/.nvidia-omniverse/config:rw
5959

6060
# ==============================================================================
61-
ground-control-station:
62-
image: airlab-storage.andrew.cmu.edu:5001/shared/airstack-dev:latest
63-
container_name: ground-control-station
61+
robot:
62+
image: &airstack-dev-image airlab-storage.andrew.cmu.edu:5001/shared/airstack-dev:v0.5.1
63+
build:
64+
context: ../
65+
dockerfile: docker/Dockerfile.airstack-dev
66+
tags:
67+
- *airstack-dev-image
6468
entrypoint: bash -c "service ssh restart && bash"
6569
# Interactive shell
6670
stdin_open: true # docker run -i
6771
tty: true # docker run -t
6872
# Needed to display graphical applications
69-
ipc: host
7073
privileged: true
74+
networks:
75+
- airstack_network
7176
environment:
7277
- DISPLAY
7378
- QT_X11_NO_MITSHM=1
@@ -80,37 +85,30 @@ services:
8085
count: 1
8186
capabilities: [ gpu ]
8287
ports:
83-
# for ssh
84-
- 2222:22
88+
# for ssh, starting from 2223-2243 on the host port all map to 22 in the container. Assumes no more than 21 robots
89+
- "2223-2243:22"
8590
volumes:
8691
# display stuff
8792
- $HOME/.Xauthority:/root/.Xauthority
8893
- /tmp/.X11-unix:/tmp/.X11-unix
8994
# developer stuff
90-
- ./ground_control_station/.bashrc:/root/.bashrc:rw # bash config
95+
- ./robot/.bashrc:/root/.bashrc:rw # bash config
9196
- ~/.bash_history:/root/.bash_history:rw # save cmdline history
9297
- /var/run/docker.sock:/var/run/docker.sock # access docker API for container name
9398
# autonomy stack stuff
9499
- ./..:/root/AirStack:rw
95100

96101
# ==============================================================================
97-
robot:
98-
build:
99-
context: ../
100-
dockerfile: docker/Dockerfile.airstack-dev
101-
tags:
102-
- airlab-storage.andrew.cmu.edu:5001/shared/airstack-dev:latest
103-
- airlab-storage.andrew.cmu.edu:5001/shared/airstack-dev:v0.5.0
104-
image: airlab-storage.andrew.cmu.edu:5001/shared/airstack-dev:v0.5.0
105-
# container_name: robot-1
102+
ground-control-station:
103+
image: *airstack-dev-image
104+
container_name: ground-control-station
106105
entrypoint: bash -c "service ssh restart && bash"
107106
# Interactive shell
108107
stdin_open: true # docker run -i
109108
tty: true # docker run -t
110109
# Needed to display graphical applications
110+
ipc: host
111111
privileged: true
112-
networks:
113-
- airstack_network
114112
environment:
115113
- DISPLAY
116114
- QT_X11_NO_MITSHM=1
@@ -123,14 +121,14 @@ services:
123121
count: 1
124122
capabilities: [ gpu ]
125123
ports:
126-
# for ssh, starting from 2223-2243 on the host port all map to 22 in the container. Assumes no more than 21 robots
127-
- "2223-2243:22"
124+
# for ssh
125+
- 2222:22
128126
volumes:
129127
# display stuff
130128
- $HOME/.Xauthority:/root/.Xauthority
131129
- /tmp/.X11-unix:/tmp/.X11-unix
132130
# developer stuff
133-
- ./robot/.bashrc:/root/.bashrc:rw # bash config
131+
- ./ground_control_station/.bashrc:/root/.bashrc:rw # bash config
134132
- ~/.bash_history:/root/.bash_history:rw # save cmdline history
135133
- /var/run/docker.sock:/var/run/docker.sock # access docker API for container name
136134
# autonomy stack stuff

docker/extras/config/omniverse.toml

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11

22
[bookmarks]
33
"AirLab Nucleus Server" = "omniverse://airlab-storage.andrew.cmu.edu:8443"
4+
"AirStack" = "omniverse://airlab-storage.andrew.cmu.edu:8443/Projects/AirStack/"

docker/robot/.bashrc

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# for examples
55

66
# If not running interactively, don't do anything
7-
[ -z "$PS1" ] && return
7+
# [ -z "$PS1" ] && return
88

99
# don't put duplicate lines in the history. See bash(1) for more options
1010
# ... or force ignoredups and ignorespace
@@ -120,7 +120,7 @@ export PYTHONWARNINGS
120120
# Convenience functions for ROS2 workspace
121121

122122
function bws(){
123-
echo "Running \`colcon build\` in $ROS2_WS_DIR"
123+
echo "Running \`colcon build $@\` in $ROS2_WS_DIR"
124124
COLCON_LOG_PATH="$ROS2_WS_DIR"/log colcon build --symlink-install --base-paths "$ROS2_WS_DIR"/ --build-base "$ROS2_WS_DIR"/build/ --install-base "$ROS2_WS_DIR"/install/ "$@"
125125
}
126126
function sws(){

docs/development/development_environment.md

Whitespace-only changes.

docs/development/docker_usage.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# General Usage with Docker Compose
12

23
AirStack is designed for multi-robot development, and is setup to run multiple robots in simulation.
34

@@ -64,7 +65,7 @@ docker exec -it isaac-sim bash
6465
`runapp` launches Isaac Sim.
6566
The `--path` argument can be passed with a path to a `.usd` file to load a scene.
6667

67-
It can also be run in headless mode with `./runheadless.native.sh` to stream to Omniverse Streaming Client or `./runheadless.webrtc.sh` to stream to a web browser.
68+
It can also be run in headless mode with `./runheadless.native.sh` to stream to [Omniverse Streaming Client](https://docs.omniverse.nvidia.com/streaming-client/latest/user-manual.html) or `./runheadless.webrtc.sh` to [stream to a web browser](https://docs.omniverse.nvidia.com/extensions/latest/ext_livestream/webrtc.html).
6869

6970
The container also has the isaacsim ROS2 package within that can be launched with `ros2 launch isaacsim run_isaacsim.launch.py`.
7071

docs/development/testing/ci_cd.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# CI/CD Pipeline
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Integration Testing
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Testing Frameworks
42.4 KB
Loading
17.4 KB
Loading

docs/development/vscode/index.md

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# VS Code: Docker Integration and Debugger Setup
2+
3+
Start containers
4+
```bash
5+
# optionally pass the --scale robot=N argument to start N robots
6+
dc compose up -d # --scale robot=2
7+
```
8+
9+
Open AirStack folder
10+
11+
```bash
12+
cd AirStack
13+
code .
14+
```
15+
16+
Install the ["Dev Containers" extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers).
17+
18+
Now click the "Remote Explorer" icon on the left side bar, hover over a robot container, and attach to the container.
19+
20+
![attach_container](attach_container.png)
21+
22+
Install recommended extensions within the image. This installs the `ROS`, `C++`, and `Python` extensions in the container.
23+
![extensions.png](extensions.png)
24+
25+
## Build ROS Workspace
26+
Hit `Ctrl-Shift-B` to build the project. This is a shortcut for `bws --cmake-args '-DCMAKE_BUILD_TYPE=Debug'`, which adds debug symbols to the build.
27+
28+
Build tasks are defined in `.vscode/tasks.json`.
29+
30+
31+
## Launch
32+
33+
Hit `F5` to launch `robot.launch.xml`, or click the "Run and Debug" button on the left side of the screen and click the green play button.
34+
35+
Launch tasks are defined in `.vscode/launch.json`.
36+
37+
![launch](launch.png)
38+
39+
You can now set breakpoints and debug as usual in VSCode.
40+
41+
42+
!!! warning "Warning about file permissions"
43+
44+
Folders and files created within the attached docker container will be owned by root. This can cause issues when trying to edit files from the host machine, especially when using git to switch branches.
45+
If you accidentally create files as root, you can change the owner to your user with the following command:
46+
```bash
47+
sudo chown -R $USER:$USER .
48+
```

docs/development/vscode/launch.png

58.9 KB
Loading
44 KB
Loading

mkdocs.yml

+8-6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ extra:
1010
extra_css:
1111
- stylesheets/extra.css
1212
markdown_extensions:
13+
- admonition
1314
- pymdownx.highlight:
1415
anchor_linenums: true
1516
line_spans: __span
@@ -32,14 +33,15 @@ nav:
3233
- Getting Started: getting_started.md
3334
- Development:
3435
- development/index.md
35-
- General Usage with Docker Compose: development/docker_usage.md
36+
- development/docker_usage.md
37+
- development/vscode/index.md
3638
- Testing:
3739
- development/testing/index.md
38-
- Testing Frameworks: development/testing/testing_frameworks.md
39-
- Integration Testing: development/testing/integration_testing.md
40-
- Unit Testing: development/testing/unit_testing.md
41-
- System Testing: development/testing/system_testing.md
42-
- CI/CD Pipeline: development/testing/ci_cd.md
40+
- development/testing/testing_frameworks.md
41+
- development/testing/integration_testing.md
42+
- development/testing/unit_testing.md
43+
- development/testing/system_testing.md
44+
- development/testing/ci_cd.md
4345
- Contributing: development/contributing.md
4446
- ROS Frame Conventions: development/frame_conventions.md
4547
- Robot:

0 commit comments

Comments
 (0)