Skip to content

Commit 641613f

Browse files
Added Dev container and clang format, restructured folder to follow the ROS structure
1 parent e1fa94e commit 641613f

32 files changed

+1692
-1215
lines changed

.clang-format

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
BasedOnStyle: LLVM
2+
IndentWidth: 4
3+
ColumnLimit: 120

.devcontainer/Dockerfile

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Use an official ROS1 environment as a parent image
2+
FROM ros:noetic-robot
3+
4+
# Set the default shell to bash
5+
SHELL ["/bin/bash", "-c"]
6+
7+
# Set a non-interactive shell to avoid stuck prompts during build
8+
ARG DEBIAN_FRONTEND=noninteractive
9+
10+
# Update package lists and install only necessary packages
11+
RUN apt-get update && apt-get install -y \
12+
build-essential \
13+
cmake \
14+
git \
15+
sudo \
16+
lsb-release \
17+
gnupg2 \
18+
net-tools \
19+
clang-format \
20+
clangd \
21+
gdb \
22+
libpcl-dev \
23+
libopencv-dev \
24+
python3-pip \
25+
ros-noetic-catkin \
26+
ros-noetic-pcl-ros \
27+
ros-noetic-grid-map \
28+
python3-catkin-tools \
29+
&& apt-get clean \
30+
&& rm -rf /var/lib/apt/lists/*
31+
32+
# Install cmake-format via pip
33+
RUN pip3 install cmake-format
34+
35+
# Add a user for the development environment
36+
ARG USERNAME=devuser
37+
ARG USER_UID=1000
38+
ARG USER_GID=$USER_UID
39+
40+
# Create user with specified home directory
41+
RUN groupadd --gid $USER_GID $USERNAME || echo "Group $USERNAME already exists"
42+
RUN useradd --uid $USER_UID --gid $USER_GID --create-home --home-dir /home/$USERNAME $USERNAME || echo "User $USERNAME already exists"
43+
RUN echo "$USERNAME ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/$USERNAME
44+
RUN chmod 0440 /etc/sudoers.d/$USERNAME
45+
46+
# Set the working directory
47+
WORKDIR /home/$USERNAME/workspace
48+
49+
# Setup ROS1 environment in the bashrc for interactive bash shells
50+
RUN echo "source /opt/ros/noetic/setup.bash" >> /home/$USERNAME/.bashrc
51+
52+
# Setup GUI forwarding with the correct DISPLAY setting
53+
RUN echo "export DISPLAY=:1" >> /home/$USERNAME/.bashrc
54+
55+
# Command to run on container start
56+
CMD ["/bin/bash"]

.devcontainer/devcontainer.json

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
{
2+
"name": "GroundGrid",
3+
"privileged": true,
4+
"build": {
5+
"dockerfile": "Dockerfile",
6+
"args": {
7+
"USER_UID": "1000",
8+
"USER_GID": "1000"
9+
}
10+
},
11+
"containerEnv": {
12+
"DISPLAY": "unix:1",
13+
"ROS_AUTOMATIC_DISCOVERY_RANGE": "LOCALHOST",
14+
"ROS_DOMAIN_ID": "0"
15+
},
16+
"runArgs": [
17+
"--gpus",
18+
"all",
19+
"--runtime=nvidia",
20+
"--net",
21+
"host",
22+
"--privileged",
23+
"--env=DISPLAY=:1",
24+
"--volume=/tmp/.X11-unix:/tmp/.X11-unix:rw"
25+
],
26+
"remoteUser": "devuser",
27+
"workspaceFolder": "/home/devuser/workspace/groundgrid",
28+
"mounts": [
29+
{
30+
"source": "${env:HOME}/workspace",
31+
"target": "/home/devuser/workspace",
32+
"type": "bind"
33+
}
34+
],
35+
"postCreateCommand": "bash -c 'source /opt/ros/noetic/setup.bash'",
36+
"customizations": {
37+
"vscode": {
38+
"extensions": [
39+
"ms-iot.vscode-ros",
40+
"ms-python.black-formatter",
41+
"ms-python.vscode-pylance",
42+
"ms-python.python",
43+
"ms-python.debugpy",
44+
"xaver.clang-format",
45+
"eamodio.gitlens",
46+
"twxs.cmake",
47+
"ClemensPeters.format-json",
48+
"DavidAnson.vscode-markdownlint",
49+
"redhat.vscode-xml",
50+
"redhat.vscode-yaml",
51+
"mechatroner.rainbow-csv",
52+
"llvm-vs-code-extensions.vscode-clangd"
53+
],
54+
"settings": {
55+
"terminal.integrated.defaultProfile.linux": "bash",
56+
"C_Cpp.clang_format_style": "file",
57+
"C_Cpp.default.cppStandard": "c++17",
58+
"C_Cpp.default.cStandard": "c11",
59+
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
60+
"C_Cpp.default.browse.path": [
61+
"${workspaceFolder}"
62+
],
63+
"C_Cpp.errorSquiggles": "enabled",
64+
"[c]": {
65+
"editor.formatOnSave": true,
66+
"editor.defaultFormatter": "xaver.clang-format"
67+
},
68+
"[cpp]": {
69+
"editor.formatOnSave": true,
70+
"editor.defaultFormatter": "xaver.clang-format"
71+
},
72+
"[python]": {
73+
"editor.formatOnSave": true,
74+
"editor.defaultFormatter": "ms-python.black-formatter"
75+
},
76+
"[yaml]": {
77+
"editor.formatOnSave": true,
78+
"editor.defaultFormatter": "redhat.vscode-yaml"
79+
},
80+
"[json]": {
81+
"editor.formatOnSave": true,
82+
"editor.defaultFormatter": "ClemensPeters.format-json"
83+
},
84+
"[xml]": {
85+
"editor.formatOnSave": true,
86+
"editor.defaultFormatter": "redhat.vscode-xml"
87+
},
88+
"files.trimTrailingWhitespace": true,
89+
"files.insertFinalNewline": true,
90+
"terminal.integrated.scrollback": 10000
91+
}
92+
}
93+
}
94+
}

.gitignore

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Prerequisites
2+
*.d
3+
4+
# Compiled Object files
5+
*.slo
6+
*.lo
7+
*.o
8+
*.obj
9+
10+
# Precompiled Headers
11+
*.gch
12+
*.pch
13+
14+
# Compiled Dynamic libraries
15+
*.so
16+
*.dylib
17+
*.dll
18+
19+
# Fortran module files
20+
*.mod
21+
*.smod
22+
23+
# Compiled Static libraries
24+
*.lai
25+
*.la
26+
*.a
27+
*.lib
28+
29+
# Executables
30+
*.exe
31+
*.out
32+
*.app
33+
34+
# Build
35+
build
36+
37+
# Clang-format index
38+
.cache
39+
40+
# ROS
41+
.catkin_tools
42+
devel
43+
logs

.vscode/c_cpp_properties.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "Linux",
5+
"includePath": [
6+
"${default}",
7+
"${workspaceFolder}/**",
8+
"/usr/local/include/**",
9+
"/opt/ros/noetic/include/**",
10+
"/opt/ros/noetic/include/rclcpp/**",
11+
"/opt/ros/noetic/include/sensor_msgs/**",
12+
"/opt/ros/noetic/include/visualization_msgs/**"
13+
],
14+
"defines": [],
15+
"compilerPath": "/usr/bin/g++",
16+
"intelliSenseMode": "linux-gcc-x64",
17+
"configurationProvider": "ms-vscode.cmake-tools",
18+
"cStandard": "c11",
19+
"cppStandard": "c++17",
20+
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
21+
}
22+
],
23+
"version": 4
24+
}

.vscode/settings.json

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{
2+
"files.associations": {
3+
"cctype": "cpp",
4+
"clocale": "cpp",
5+
"cmath": "cpp",
6+
"cstdarg": "cpp",
7+
"cstddef": "cpp",
8+
"cstdio": "cpp",
9+
"cstdlib": "cpp",
10+
"cstring": "cpp",
11+
"ctime": "cpp",
12+
"cwchar": "cpp",
13+
"cwctype": "cpp",
14+
"array": "cpp",
15+
"atomic": "cpp",
16+
"bit": "cpp",
17+
"*.tcc": "cpp",
18+
"bitset": "cpp",
19+
"chrono": "cpp",
20+
"compare": "cpp",
21+
"complex": "cpp",
22+
"concepts": "cpp",
23+
"condition_variable": "cpp",
24+
"cstdint": "cpp",
25+
"deque": "cpp",
26+
"forward_list": "cpp",
27+
"list": "cpp",
28+
"map": "cpp",
29+
"set": "cpp",
30+
"string": "cpp",
31+
"unordered_map": "cpp",
32+
"unordered_set": "cpp",
33+
"vector": "cpp",
34+
"exception": "cpp",
35+
"algorithm": "cpp",
36+
"functional": "cpp",
37+
"iterator": "cpp",
38+
"memory": "cpp",
39+
"memory_resource": "cpp",
40+
"numeric": "cpp",
41+
"optional": "cpp",
42+
"random": "cpp",
43+
"ratio": "cpp",
44+
"string_view": "cpp",
45+
"system_error": "cpp",
46+
"tuple": "cpp",
47+
"type_traits": "cpp",
48+
"utility": "cpp",
49+
"fstream": "cpp",
50+
"initializer_list": "cpp",
51+
"iomanip": "cpp",
52+
"iosfwd": "cpp",
53+
"iostream": "cpp",
54+
"istream": "cpp",
55+
"limits": "cpp",
56+
"mutex": "cpp",
57+
"new": "cpp",
58+
"numbers": "cpp",
59+
"ostream": "cpp",
60+
"semaphore": "cpp",
61+
"sstream": "cpp",
62+
"stdexcept": "cpp",
63+
"stop_token": "cpp",
64+
"streambuf": "cpp",
65+
"thread": "cpp",
66+
"cinttypes": "cpp",
67+
"typeindex": "cpp",
68+
"typeinfo": "cpp",
69+
"strstream": "cpp",
70+
"codecvt": "cpp",
71+
"future": "cpp",
72+
"shared_mutex": "cpp",
73+
"cfenv": "cpp",
74+
"variant": "cpp",
75+
"any": "cpp",
76+
"*.txx": "cpp",
77+
"valarray": "cpp"
78+
},
79+
"terminal.integrated.env.linux": {
80+
"CMAKE_PREFIX_PATH": "/opt/ros/noetic:$CMAKE_PREFIX_PATH",
81+
"LD_LIBRARY_PATH": "/opt/ros/noetic/lib:$LD_LIBRARY_PATH"
82+
},
83+
"search.exclude": {
84+
"**/build": true,
85+
"**/install": true,
86+
"**/log": true
87+
},
88+
"ros.rosSetupScript": "/opt/ros/noetic/setup.bash",
89+
"python.autoComplete.extraPaths": [
90+
"/opt/ros/noetic/lib/python3/dist-packages/"
91+
],
92+
"python.analysis.extraPaths": [
93+
"/opt/ros/noetic/lib/python3/dist-packages/"
94+
],
95+
"clangd.path": "/usr/bin/clangd",
96+
"clangd.checkUpdates": false,
97+
"C_Cpp.autocomplete": "disabled",
98+
"C_Cpp.intelliSenseEngine": "disabled",
99+
"C_Cpp.errorSquiggles": "disabled",
100+
"C_Cpp.formatting": "disabled",
101+
"C_Cpp.intelliSenseEngineFallback": "disabled",
102+
"C_Cpp.configurationWarnings": "disabled",
103+
"C_Cpp.vcpkg.enabled": false,
104+
"C_Cpp.inlayHints.parameterNames.enabled": false,
105+
"C_Cpp.autoAddFileAssociations": false,
106+
"C_Cpp.codeAnalysis.runAutomatically": false,
107+
"C_Cpp.default.enableConfigurationSquiggles": false
108+
}

0 commit comments

Comments
 (0)