Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-mueller committed Dec 14, 2024
1 parent 2dbef75 commit 8ffcd94
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 112 deletions.
77 changes: 16 additions & 61 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,65 +1,20 @@
# From https://github.com/PickNikRobotics/roscpp_code_format

# Based on https://github.com/ament/ament_lint/blob/rolling/ament_clang_format/ament_clang_format/configuration/.clang-format
---
Language: Cpp
BasedOnStyle: Google
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 2
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: true
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: true
BinPackParameters: true
ColumnLimit: 120
ConstructorInitializerAllOnOneLineOrOnePerLine: true
DerivePointerBinding: false
PointerBindsToType: true
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 60
PenaltyBreakString: 1
PenaltyBreakFirstLessLess: 1000
PenaltyExcessCharacter: 1000
PenaltyReturnTypeOnItsOwnLine: 90
SpacesBeforeTrailingComments: 2
Cpp11BracedListStyle: false
Standard: Auto
IndentWidth: 2
TabWidth: 2
UseTab: Never
IndentFunctionDeclarationAfterType: false
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
SortIncludes: false
SpaceAfterCStyleCast: false

# Configure each individual brace in BraceWrapping
BreakBeforeBraces: Custom

# Control of individual brace wrapping cases
AccessModifierOffset: -2
AlignAfterOpenBracket: AlwaysBreak
BraceWrapping:
AfterClass: 'true'
AfterControlStatement: 'true'
AfterEnum : 'true'
AfterFunction : 'true'
AfterNamespace : 'true'
AfterStruct : 'true'
AfterUnion : 'true'
BeforeCatch : 'true'
BeforeElse : 'true'
IndentBraces : 'false'
AfterClass: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterEnum: true
BreakBeforeBraces: Custom
ColumnLimit: 120
ConstructorInitializerIndentWidth: 0
ContinuationIndentWidth: 2
DerivePointerAlignment: false
PointerAlignment: Middle
ReflowComments: true
2 changes: 1 addition & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/install/**",
"/opt/ros/humble/include/**"
],
"defines": [],
Expand Down
3 changes: 1 addition & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"streetsidesoftware.code-spell-checker",
"ms-vscode.cpptools",
"dotjoshjohnson.xml",
"rioj7.command-variable",
"redhat.vscode-yaml",
"ms-python.black-formatter"
"ms-python.black-formatter",
]
}
13 changes: 0 additions & 13 deletions .vscode/launch.json

This file was deleted.

15 changes: 12 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
],
"files.associations": {
"*.cmake.in": "cmake",
"*.yaml.in": "yaml",
"*.repos": "yaml",
"*.world": "xml",
"*.xacro": "xml",
"*.sdf": "xml",
"*.plan": "json",
"*.btproj": "xml",
},
"python.analysis.extraPaths": [
"/opt/ros/humble/lib/python3.10/site-packages/",
Expand All @@ -34,7 +36,6 @@
"**/install": true,
"**/log": true
},
"cSpell.diagnosticLevel": "Hint",
"cSpell.words": [
"APMS",
"athackst",
Expand Down Expand Up @@ -68,11 +69,19 @@
"icon": "terminal-bash",
"args": [
"--init-file",
"${workspaceFolder:px4-ros2-env}/env.sh",
"${workspaceFolder}/env.sh",
"-i"
]
},
},
"terminal.integrated.defaultProfile.linux": "px4-ros2-env",
"editor.detectIndentation": false
"editor.detectIndentation": true,
"C_Cpp.clang_format_fallbackStyle": "none",
"C_Cpp.clang_format_style": "file:${workspaceFolder}/.clang-format",
"C_Cpp.files.exclude": {
"${workspaceFolder}/build": true,
"${workspaceFolder}/install": true,
"**/.vscode": true,
"**/.vs": true
},
}
10 changes: 3 additions & 7 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
"type": "shell",
"command": "${workspaceFolder}/world/export.sh",
"problemMatcher": []
}
},
{
"label": "New ament_cmake package",
"detail": "Create a new ROS cpp package from a template.",
Expand All @@ -181,12 +181,8 @@
"inputs": [
{
"id": "package",
"type": "command",
"command": "extension.commandvariable.promptStringRemember",
"args": {
"key": "package_name",
"description": "Package name"
}
"type": "promptString",
"description": "Package name"
}
]
}
6 changes: 2 additions & 4 deletions dep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@

set -e

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

vcs import < "${SCRIPT_DIR}/src/ros2.repos" "${SCRIPT_DIR}/src" --recursive
vcs import < "./src/ros2.repos" "./src" --recursive

if command -v rosdep &> /dev/null; then
if [ ! -d /etc/ros/rosdep/sources.list.d ]; then
sudo rosdep init -q # Init rosdep if not happend yet
fi
rosdep update
rosdep install --from-paths "${SCRIPT_DIR}/src" --ignore-src -y
rosdep install --from-paths "./src" --ignore-src -y
fi
6 changes: 3 additions & 3 deletions env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# ----------------------------------------------------------------------

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
WORKSPACE_ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

source ~/.bashrc

Expand All @@ -22,8 +22,8 @@ fi
if [ -d /usr/share/colcon_argcomplete ]; then
source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash
fi
if [ -f "${SCRIPT_DIR}/install/local_setup.bash" ]; then
source "${SCRIPT_DIR}/install/local_setup.bash"
if [ -f "${WORKSPACE_ROOT_DIR}/install/local_setup.bash" ]; then
source "${WORKSPACE_ROOT_DIR}/install/local_setup.bash"
fi

export PX4_ROS2_ENV_DEFAULT_BASE_DIR="$HOME/Desktop"
Expand Down
14 changes: 6 additions & 8 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
#
# ----------------------------------------------------------------------

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

set -e
source ${SCRIPT_DIR}/env.sh
source ./env.sh

# ROS2 Humble Hawksbill
sudo apt install software-properties-common -y
Expand All @@ -23,7 +21,7 @@ sudo apt install ros-humble-ros-base -y
sudo apt install ros-dev-tools -y

# PX4 Autopilot
PX4_VERSION="v1.15.0"
PX4_VERSION="v1.15.1"

if [ ! -d "$PX4_ROS2_ENV_PX4_AUTOPILOT_DIR" ]; then
echo -e "\e[1;33m--- PX4 Autopilot not found. Installing...\e[0m"
Expand All @@ -35,7 +33,7 @@ else
fi

# QGroundControl
QGC_VERSION="v4.4.0"
QGC_VERSION="v4.4.2"

if [ ! -f "${PX4_ROS2_ENV_QGROUNDCONTROL_APP}" ]; then
echo -e "\033[1;33m--- QGroundControl not found. Installing...\e[0m"
Expand All @@ -61,7 +59,7 @@ else
fi

# source again after major installations
source ${SCRIPT_DIR}/env.sh
source ./env.sh

${SCRIPT_DIR}/world/export.sh
${SCRIPT_DIR}/dep.sh
(cd ./world && ./export.sh)
./dep.sh
8 changes: 2 additions & 6 deletions src/ros2.repos
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,13 @@ repositories:
dep/px4/px4_msgs:
type: git
url: https://github.com/PX4/px4_msgs.git
version: 31d0ac838f4adc1730ca21169130c0073e8631de
version: release/1.15
dep/px4/px4_ros2_interface_lib:
type: git
url: https://github.com/Auterion/px4-ros2-interface-lib
version: 1.2.7
version: 1.3.0

# Additional requirements for developing with AutoAPMS framework
# dep/behaviortree_cpp:
# type: git
# url: https://github.com/BehaviorTree/BehaviorTree.CPP.git
# version: 4.6.2
# dep/auto-apms:
# type: git
# url: https://github.com/robin-mueller/auto-apms.git
Expand Down
6 changes: 2 additions & 4 deletions world/export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
#
# ----------------------------------------------------------------------

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

set -e
source ${SCRIPT_DIR}/../env.sh
source ./../env.sh

# Copy the .sdf file to the resource directory
echo "Exporting worlds to PX4 ($PX4_ROS2_ENV_PX4_AUTOPILOT_DIR)"
cp -v ${SCRIPT_DIR}/*.sdf "${PX4_ROS2_ENV_PX4_AUTOPILOT_DIR}/Tools/simulation/gz/worlds"
cp -v ./*.sdf "${PX4_ROS2_ENV_PX4_AUTOPILOT_DIR}/Tools/simulation/gz/worlds"

0 comments on commit 8ffcd94

Please sign in to comment.