From 8cfad98495d4de203374f580b830e54ab1628359 Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Fri, 9 Feb 2024 08:02:26 +0100 Subject: [PATCH 01/22] Use compression with web_video_server --- launch/deepracer_launcher.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/launch/deepracer_launcher.py b/launch/deepracer_launcher.py index c46e61a..25a2776 100644 --- a/launch/deepracer_launcher.py +++ b/launch/deepracer_launcher.py @@ -101,7 +101,7 @@ def launch_setup(context, *args, **kwargs): name='inference_node', parameters=[{ 'device': LaunchConfiguration("inference_engine").perform(context) - }] + }] ) model_optimizer_node = Node( package='model_optimizer_pkg', @@ -129,7 +129,7 @@ def launch_setup(context, *args, **kwargs): name='sensor_fusion_node', parameters=[{ 'image_transport': 'compressed' - }] + }] ) servo_node = Node( package='servo_pkg', @@ -159,7 +159,10 @@ def launch_setup(context, *args, **kwargs): package='web_video_server', namespace='web_video_server', executable='web_video_server', - name='web_video_server' + name='web_video_server', + parameters=[{ + 'default_transport': 'compressed' + }] ) if logging_enable: From a8aee461e813f813ab6f01cbb52e16c36972f88d Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Thu, 14 Mar 2024 21:31:10 +0000 Subject: [PATCH 02/22] TFLite for Foxy --- .gitignore | 4 + dev-stack-build.sh | 2 +- dev-stack-package.sh | 84 +++++++++++++++++++ files/aws_deepracer-community.list | 1 + files/aws_deepracer.list | 1 + files/deepracer-larsll.asc | 52 ++++++++++++ files/deepracer.asc | 51 +++++++++++ .../launch}/deepracer_launcher.py | 47 ++++++----- files/start_ros.sh | 31 +++++++ 9 files changed, 251 insertions(+), 22 deletions(-) create mode 100755 dev-stack-package.sh create mode 100644 files/aws_deepracer-community.list create mode 100644 files/aws_deepracer.list create mode 100644 files/deepracer-larsll.asc create mode 100644 files/deepracer.asc rename {launch => files/launch}/deepracer_launcher.py (81%) create mode 100755 files/start_ros.sh diff --git a/.gitignore b/.gitignore index 2ebcf82..ca7c632 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,7 @@ factory_reset* ws/* !ws/.rosinstall +__pycache__ +*.pyc +pkg-build/ +dist/ \ No newline at end of file diff --git a/dev-stack-build.sh b/dev-stack-build.sh index 0c716a5..9908286 100755 --- a/dev-stack-build.sh +++ b/dev-stack-build.sh @@ -57,7 +57,7 @@ rosdep install -i --from-path . --rosdistro foxy -y rm -rf install build log # Update deepracer_launcher.py (fix an issue in the file) -cp ../launch/deepracer_launcher.py ./aws-deepracer-launcher/deepracer_launcher/launch/deepracer_launcher.py +cp ../files/launch/deepracer_launcher.py ./aws-deepracer-launcher/deepracer_launcher/launch/deepracer_launcher.py # Turn off SW update sed -i "s/ENABLE_PERIODIC_SOFTWARE_UPDATE = True/ENABLE_PERIODIC_SOFTWARE_UPDATE = False/" aws-deepracer-systems-pkg/deepracer_systems_pkg/deepracer_systems_pkg/software_update_module/software_update_config.py diff --git a/dev-stack-package.sh b/dev-stack-package.sh new file mode 100755 index 0000000..c448f3b --- /dev/null +++ b/dev-stack-package.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash +set -e + +export DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" + +PACKAGES="aws-deepracer-core" + +while getopts "p:v:" opt; do + case $opt in + p) + PACKAGES=$OPTARG + ;; + v) + VERSION=$OPTARG + ;; + \?) + echo "Invalid option -$OPTARG" >&2 + usage + ;; + esac +done + +if [ -z "$PACKAGES" ]; then + echo "No packages provided. Exiting." + exit 1 +fi + +if [ -z "$VERSION" ]; then + echo "No version provided. Exiting." + exit 1 +fi + +# DeepRacer Repos +sudo cp $DIR/files/deepracer.asc /etc/apt/trusted.gpg.d/ +sudo cp $DIR/files/aws_deepracer.list /etc/apt/sources.list.d/ +sudo apt-get update + +rm -rf $DIR/pkg-build/aws* +mkdir -p $DIR/pkg-build $DIR/pkg-build/src $DIR/dist +cd $DIR/pkg-build +mkdir -p $PACKAGES + +# Check which packages we have +cd $DIR/pkg-build/src +for pkg in $PACKAGES; +do + if [ "$(compgen -G $pkg*.deb | wc -l )" -eq 0 ]; + then + PACKAGES_DOWNLOAD="$PACKAGES_DOWNLOAD $pkg:amd64" + fi +done + +# Download missing AMD64 packages +if [ -n "$PACKAGES_DOWNLOAD" ]; +then + sudo apt-get update + + echo -e '\n### Downloading original packages ###\n' + echo "Missing packages: $PACKAGES_DOWNLOAD" + apt download $PACKAGES_DOWNLOAD +fi + +# Build required packages +cd $DIR/pkg-build +for pkg in $PACKAGES; +do + if [ "$pkg" == "aws-deepracer-core" ]; + then + echo -e "\n### Building aws-deepracer-core $VERSION ###\n" + dpkg-deb -R src/aws-deepracer-core_*amd64.deb aws-deepracer-core + cd aws-deepracer-core + sed -i "s/Version: .*/Version: $VERSION/" DEBIAN/control + sed -i '/Depends/ s/$/, gnupg/' DEBIAN/control + rm -rf opt/aws/deepracer/lib/* + cp $DIR/files/start_ros.sh opt/aws/deepracer + cp -r $DIR/ws/install/* opt/aws/deepracer/lib/ + rm DEBIAN/preinst + cd .. + dpkg-deb --root-owner-group -b aws-deepracer-core + dpkg-name -o aws-deepracer-core.deb + FILE=$(compgen -G aws-deepracer-core*.deb) + mv $FILE $(echo $DIR/dist/$FILE | sed -e 's/\+/\-/') + fi +done \ No newline at end of file diff --git a/files/aws_deepracer-community.list b/files/aws_deepracer-community.list new file mode 100644 index 0000000..035125e --- /dev/null +++ b/files/aws_deepracer-community.list @@ -0,0 +1 @@ +deb [arch=amd64 signed-by=53E8F72A910FF5A5CB727871E388EE0DC3E499C1] https://larsll-build-artifact-share.s3.eu-north-1.amazonaws.com/deepracer-pi experimental focal \ No newline at end of file diff --git a/files/aws_deepracer.list b/files/aws_deepracer.list new file mode 100644 index 0000000..74d6264 --- /dev/null +++ b/files/aws_deepracer.list @@ -0,0 +1 @@ +deb [arch=amd64 signed-by=A27F7037558D8BBD6524877AC2F7276AFFFD6BBE] https://deepracer-update.us-east-1.amazonaws.com/deepracer-focal deepracer-focal main diff --git a/files/deepracer-larsll.asc b/files/deepracer-larsll.asc new file mode 100644 index 0000000..960cca0 --- /dev/null +++ b/files/deepracer-larsll.asc @@ -0,0 +1,52 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +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 +QxMJKAUAyw== +=H5SG +-----END PGP PUBLIC KEY BLOCK----- diff --git a/files/deepracer.asc b/files/deepracer.asc new file mode 100644 index 0000000..e55c231 --- /dev/null +++ b/files/deepracer.asc @@ -0,0 +1,51 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +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 +X7nFgVo5muwkFoG7yGquYKRcag== +=Uzlj +-----END PGP PUBLIC KEY BLOCK----- diff --git a/launch/deepracer_launcher.py b/files/launch/deepracer_launcher.py similarity index 81% rename from launch/deepracer_launcher.py rename to files/launch/deepracer_launcher.py index 25a2776..f0fb032 100644 --- a/launch/deepracer_launcher.py +++ b/files/launch/deepracer_launcher.py @@ -100,8 +100,9 @@ def launch_setup(context, *args, **kwargs): executable='inference_node', name='inference_node', parameters=[{ - 'device': LaunchConfiguration("inference_engine").perform(context) - }] + 'device': LaunchConfiguration("inference_device").perform(context), + 'inference_engine': LaunchConfiguration("inference_engine").perform(context) + }] ) model_optimizer_node = Node( package='model_optimizer_pkg', @@ -129,7 +130,7 @@ def launch_setup(context, *args, **kwargs): name='sensor_fusion_node', parameters=[{ 'image_transport': 'compressed' - }] + }] ) servo_node = Node( package='servo_pkg', @@ -162,7 +163,7 @@ def launch_setup(context, *args, **kwargs): name='web_video_server', parameters=[{ 'default_transport': 'compressed' - }] + }] ) if logging_enable: @@ -206,20 +207,24 @@ def launch_setup(context, *args, **kwargs): return ld def generate_launch_description(): - return LaunchDescription([DeclareLaunchArgument( - name="camera_fps", - default_value="30", - description="FPS of Camera"), - DeclareLaunchArgument( - name="camera_resize", - default_value="True", - description="Resize camera input"), - DeclareLaunchArgument( - name="inference_engine", - default_value="CPU", - description="Inference engine to use"), - DeclareLaunchArgument( - name="logging_enable", - default_value="False", - description="Enable the logging of results to ROS Bag"), - OpaqueFunction(function=launch_setup)]) \ No newline at end of file + return LaunchDescription([DeclareLaunchArgument( + name="camera_fps", + default_value="30", + description="FPS of Camera"), + DeclareLaunchArgument( + name="camera_resize", + default_value="True", + description="Resize camera input"), + DeclareLaunchArgument( + name="inference_engine", + default_value="TFLITE", + description="Inference engine to use (TFLITE or OV)"), + DeclareLaunchArgument( + name="inference_device", + default_value="CPU", + description="Inference device to use, applicable to OV only (CPU, GPU or MYRIAD)."), + DeclareLaunchArgument( + name="logging_enable", + default_value="False", + description="Enable the logging of results to ROS Bag"), + OpaqueFunction(function=launch_setup)]) \ No newline at end of file diff --git a/files/start_ros.sh b/files/start_ros.sh new file mode 100755 index 0000000..7a49fbc --- /dev/null +++ b/files/start_ros.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +################################################################################# +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"). # +# You may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################# + +source /opt/aws/deepracer/lib/setup.bash +source /opt/intel/openvino_2021/bin/setupvars.sh + +MYRIAD=$(lsusb | grep "Intel Movidius MyriadX") +if [ -n "${MYRIAD}" ]; then + INFERENCE_ENGINE='inference_engine:=OV' + INFERENCE_DEVICE='inference_device:=MYRIAD' +else + INFERENCE_ENGINE='inference_engine:=OV' + INFERENCE_DEVICE='inference_device:=CPU' +fi + +ros2 launch deepracer_launcher deepracer_launcher.py ${INFERENCE_ENGINE} ${INFERENCE_DEVICE} From e6f5725d58c559f1a2014e82f051362757891c3d Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Thu, 14 Mar 2024 21:38:34 +0000 Subject: [PATCH 03/22] Move to TFLite branch --- dev-stack-build.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dev-stack-build.sh b/dev-stack-build.sh index 9908286..fe26f84 100755 --- a/dev-stack-build.sh +++ b/dev-stack-build.sh @@ -17,8 +17,8 @@ rosws update # Update packages for PR's # https://github.com/aws-deepracer/aws-deepracer-inference-pkg/pull/4 cd aws-deepracer-inference-pkg -git fetch origin pull/4/head:compressed-image -git checkout compressed-image +git fetch origin pull/5/head:tflite +git checkout tflite cd .. # https://github.com/aws-deepracer/aws-deepracer-camera-pkg/pull/5 @@ -41,8 +41,8 @@ cd .. # https://github.com/aws-deepracer/aws-deepracer-model-optimizer-pkg/pull/2 cd aws-deepracer-model-optimizer-pkg -git fetch origin pull/2/head:cache-load -git checkout cache-load +git fetch origin pull/3/head:tflite +git checkout tflite cd .. # Resolve the dependanices From 7e1e029c955514b4f5de7020a2bbddcd77d47502 Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Fri, 15 Mar 2024 18:17:56 +0000 Subject: [PATCH 04/22] Fix typo --- .devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index b396567..fe15f23 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -25,7 +25,7 @@ RUN curl -o GPG-PUB-KEY-INTEL-SW-PRODUCTS https://apt.repos.intel.com/intel-gpg- apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS && \ curl -o GPG-PUB-KEY-INTEL-OPENVINO-2021 https://apt.repos.intel.com/openvino/2021/GPG-PUB-KEY-INTEL-OPENVINO-2021 && \ apt-key add GPG-PUB-KEY-INTEL-OPENVINO-2021 && \ - echo "deb https://apt.repos.intel.com/openvino/2021 all main" | tee - a /etc/apt/sources.list.d/intel-openvino-2021.list && \ + echo "deb https://apt.repos.intel.com/openvino/2021 all main" | tee -a /etc/apt/sources.list.d/intel-openvino-2021.list && \ apt-get update && apt-get install -y --no-install-recommends intel-openvino-dev-ubuntu20-"${build_id}" && \ /opt/intel/openvino_"${build_id}"/deployment_tools/model_optimizer/install_prerequisites/install_prerequisites.sh tf && \ ln --symbolic /opt/intel/openvino_"${build_id}"/ /opt/intel/openvino From d27fb1ea08a64c6b1645084dad5a1fc372ea8f8c Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Sun, 17 Mar 2024 12:59:58 +0000 Subject: [PATCH 05/22] Fixing workspace --- .devcontainer/devcontainer.json | 35 +++++++++++++++++++++++---------- .vscode/c_cpp_properties.json | 5 +++-- .vscode/settings.json | 21 ++++++++------------ 3 files changed, 36 insertions(+), 25 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a869e1a..cac1a92 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -10,19 +10,34 @@ "DISPLAY": "${localEnv:DISPLAY}", "QT_X11_NO_MITSHM": "1" }, - "extensions": ["ms-python.python","ms-vscode.cpptools-extension-pack"], - "runArgs":["--privileged","--network", "host"], + "runArgs": [ + "--privileged", + "--network", + "host" + ], "mounts": [ "source=deepracer-ros-bashhistory,target=/commandhistory,type=volume", "source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind" ], - "settings": { - "terminal.integrated.profiles.linux": { - "bash (ROS)": { - "path": "/bin/bash", - "args": ["--init-file", ".devcontainer/bashrc"] - } - }, - "terminal.integrated.defaultProfile.linux": "bash (ROS)" + "customizations": { + "vscode": { + "settings": { + "terminal.integrated.profiles.linux": { + "bash (ROS)": { + "path": "/bin/bash", + "args": [ + "--init-file", + ".devcontainer/bashrc" + ] + } + }, + "terminal.integrated.defaultProfile.linux": "bash (ROS)" + }, + "extensions": [ + "ms-python.python", + "ms-vscode.cpptools-extension-pack", + "ms-python.autopep8" + ] + } } } \ No newline at end of file diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 6f001e9..03f9062 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -6,10 +6,11 @@ "${workspaceFolder}/**", "/opt/ros/foxy/include/**", "/usr/include/opencv4/", - "/opt/intel/openvino_2021/inference_engine/**" + "/opt/intel/openvino_2021/inference_engine/**", + "${workspaceFolder}/ws/build/inference_pkg/_deps/tensorflow-lite-src/**", + "${workspaceFolder}/ws/build/inference_pkg/flatbuffers/include/" ], "defines": [], - "compilerPath": "/usr/bin/gcc", "cStandard": "gnu17", "cppStandard": "gnu++14", "intelliSenseMode": "linux-gcc-x64" diff --git a/.vscode/settings.json b/.vscode/settings.json index c84c1ef..9a10c7d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,9 +2,11 @@ "cmake.configureOnOpen": false, "python.autoComplete.extraPaths": [ "/opt/ros/foxy/lib/python3.8/site-packages/", + "/workspaces/deepracer-scripts/ws/install/deepracer_interfaces_pkg/lib/python3.8/site-packages" ], "python.analysis.extraPaths": [ "/opt/ros/foxy/lib/python3.8/site-packages/", + "/workspaces/deepracer-scripts/ws/install/deepracer_interfaces_pkg/lib/python3.8/site-packages" ], "files.associations": { "condition_variable": "cpp", @@ -75,24 +77,17 @@ "typeinfo": "cpp", "valarray": "cpp", "variant": "cpp", - "*.ipp": "cpp" + "*.ipp": "cpp", + "unordered_set": "cpp" }, - "ros.distro": "foxy", - "python.linting.pylintEnabled": false, - "python.linting.enabled": true, - "python.linting.flake8Enabled": false, - "python.linting.pycodestyleEnabled": true, - "python.linting.pycodestyleArgs": ["--max-line-length","120"], - "python.formatting.provider": "autopep8", - "python.formatting.autopep8Args": [ - "--max-line-length", - "120", - "--experimental" - ], "files.exclude": { "**/build": true }, "search.exclude": { "**/build": true }, + "C_Cpp.default.compilerPath": "/usr/bin/g++-9", + "autopep8.args": [ + "--max-line-length=120" + ], } \ No newline at end of file From 64d77d8542e8156da93c485d976ccc2a8558620f Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Sun, 17 Mar 2024 16:17:29 +0000 Subject: [PATCH 06/22] Updated launch --- files/launch/deepracer_launcher.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/files/launch/deepracer_launcher.py b/files/launch/deepracer_launcher.py index f0fb032..c8aa707 100644 --- a/files/launch/deepracer_launcher.py +++ b/files/launch/deepracer_launcher.py @@ -174,8 +174,9 @@ def launch_setup(context, *args, **kwargs): name='bag_log_node', parameters=[{ 'monitor_topic_timeout': 15, - 'output_path': '/opt/aws/deepracer/logs/deepracer-bag-{}', + 'output_path': '/opt/aws/deepracer/logs', 'monitor_topic': '/deepracer_navigation_pkg/auto_drive', + 'file_name_topic': '/inference_pkg/model_artifact', 'log_topics': ['/ctrl_pkg/servo_msg', '/inference_pkg/rl_results'] }] From 1884b831e18e00eb6031c8abc84b78e341178c83 Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Mon, 25 Mar 2024 19:59:31 +0000 Subject: [PATCH 07/22] Updated logging --- dev-stack-install-package.sh | 14 ++++++++++ files/launch/deepracer_launcher.py | 44 ++++++++++++++---------------- 2 files changed, 34 insertions(+), 24 deletions(-) create mode 100755 dev-stack-install-package.sh diff --git a/dev-stack-install-package.sh b/dev-stack-install-package.sh new file mode 100755 index 0000000..49e79ea --- /dev/null +++ b/dev-stack-install-package.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# Build the core packages +sudo systemctl stop deepracer-core + +# DeepRacer Repos +sudo cp $DIR/files/deepracer-larsll.asc /etc/apt/trusted.gpg.d/ +sudo cp $DIR/files/aws_deepracer-community.list /etc/apt/sources.list.d/ +sudo apt-get update + +sudo apt-get install aws-deepracer-core + +# Restart deepracer +sudo systemctl start deepracer-core diff --git a/files/launch/deepracer_launcher.py b/files/launch/deepracer_launcher.py index c8aa707..d683e41 100644 --- a/files/launch/deepracer_launcher.py +++ b/files/launch/deepracer_launcher.py @@ -28,8 +28,6 @@ def launch_setup(context, *args, **kwargs): ld = [] - logging_enable = str2bool(LaunchConfiguration('logging_enable').perform(context)) - camera_node = Node( package='camera_pkg', namespace='camera_pkg', @@ -165,22 +163,22 @@ def launch_setup(context, *args, **kwargs): 'default_transport': 'compressed' }] ) - - if logging_enable: - bag_log_node = Node( - package='logging_pkg', - namespace='logging_pkg', - executable='bag_log_node', - name='bag_log_node', - parameters=[{ - 'monitor_topic_timeout': 15, - 'output_path': '/opt/aws/deepracer/logs', - 'monitor_topic': '/deepracer_navigation_pkg/auto_drive', - 'file_name_topic': '/inference_pkg/model_artifact', - 'log_topics': ['/ctrl_pkg/servo_msg', - '/inference_pkg/rl_results'] - }] - ) + bag_log_node = Node( + package='logging_pkg', + namespace='logging_pkg', + executable='bag_log_node', + name='bag_log_node', + parameters=[{ + 'logging_mode': LaunchConfiguration( + 'logging_mode').perform(context), + 'monitor_topic_timeout': 15, + 'output_path': '/opt/aws/deepracer/logs', + 'monitor_topic': '/deepracer_navigation_pkg/auto_drive', + 'file_name_topic': '/inference_pkg/model_artifact', + 'log_topics': ['/ctrl_pkg/servo_msg', + '/inference_pkg/rl_results'] + }] + ) ld.append(camera_node) ld.append(ctrl_node) @@ -201,9 +199,7 @@ def launch_setup(context, *args, **kwargs): ld.append(usb_monitor_node) ld.append(webserver_publisher_node) ld.append(web_video_server_node) - - if logging_enable: - ld.append(bag_log_node) + ld.append(bag_log_node) return ld @@ -225,7 +221,7 @@ def generate_launch_description(): default_value="CPU", description="Inference device to use, applicable to OV only (CPU, GPU or MYRIAD)."), DeclareLaunchArgument( - name="logging_enable", - default_value="False", - description="Enable the logging of results to ROS Bag"), + name="logging_mode", + default_value="usbonly", + description="Enable the logging of results to ROS Bag on USB stick"), OpaqueFunction(function=launch_setup)]) \ No newline at end of file From accdad0ad2260f37a610b38e7accea984685d314 Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Mon, 25 Mar 2024 20:51:49 +0000 Subject: [PATCH 08/22] Fix launcher --- files/launch/deepracer_launcher.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/files/launch/deepracer_launcher.py b/files/launch/deepracer_launcher.py index d683e41..f52b240 100644 --- a/files/launch/deepracer_launcher.py +++ b/files/launch/deepracer_launcher.py @@ -100,13 +100,16 @@ def launch_setup(context, *args, **kwargs): parameters=[{ 'device': LaunchConfiguration("inference_device").perform(context), 'inference_engine': LaunchConfiguration("inference_engine").perform(context) - }] + }] ) model_optimizer_node = Node( package='model_optimizer_pkg', namespace='model_optimizer_pkg', executable='model_optimizer_node', - name='model_optimizer_node' + name='model_optimizer_node', + parameters=[{ + 'inference_engine': LaunchConfiguration("inference_engine").perform(context) + }] ) rplidar_node = Node( package='rplidar_ros', From 8a0685f4fc382c62327f5bbc3f526b6ed65c13a8 Mon Sep 17 00:00:00 2001 From: Lars Lorentz Ludvigsen <59617571+larsll@users.noreply.github.com> Date: Tue, 26 Mar 2024 14:05:29 +0100 Subject: [PATCH 09/22] Include the standard path --- dev-stack-install-package.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dev-stack-install-package.sh b/dev-stack-install-package.sh index 49e79ea..4f35f75 100755 --- a/dev-stack-install-package.sh +++ b/dev-stack-install-package.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +export DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" + # Build the core packages sudo systemctl stop deepracer-core From 4f88b9a96791270ecfe826640f97175328fb38e9 Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Thu, 28 Mar 2024 22:20:02 +0000 Subject: [PATCH 10/22] Updates --- dev-stack-install-package.sh | 2 + dev-stack-package.sh | 2 +- tweaks.sh | 75 +++++++++++++++++++----------------- 3 files changed, 43 insertions(+), 36 deletions(-) diff --git a/dev-stack-install-package.sh b/dev-stack-install-package.sh index 4f35f75..4457ea1 100755 --- a/dev-stack-install-package.sh +++ b/dev-stack-install-package.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -e + export DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" # Build the core packages diff --git a/dev-stack-package.sh b/dev-stack-package.sh index c448f3b..5482fcb 100755 --- a/dev-stack-package.sh +++ b/dev-stack-package.sh @@ -70,7 +70,7 @@ do dpkg-deb -R src/aws-deepracer-core_*amd64.deb aws-deepracer-core cd aws-deepracer-core sed -i "s/Version: .*/Version: $VERSION/" DEBIAN/control - sed -i '/Depends/ s/$/, gnupg/' DEBIAN/control + sed -i '/Depends/ s/$/, gnupg, ros-foxy-ros-base, ros-foxy-std-msgs, ros-foxy-sensor-msgs, ros-foxy-image-transport, ros-foxy-compressed-image-transport, ros-foxy-cv-bridge/' DEBIAN/control rm -rf opt/aws/deepracer/lib/* cp $DIR/files/start_ros.sh opt/aws/deepracer cp -r $DIR/ws/install/* opt/aws/deepracer/lib/ diff --git a/tweaks.sh b/tweaks.sh index c3d87db..00e58b4 100644 --- a/tweaks.sh +++ b/tweaks.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +DEBIAN_FRONTEND=noninteractive + usage() { echo "Usage: sudo $0 -h HOSTNAME -p PASSWORD" @@ -71,27 +73,55 @@ else exit 1 fi +# Disable system suspend +echo -e -n "\nDisable system suspend\n" +systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target + +# Disable network power saving +echo -e -n "\nDisable network power saving" +echo -e '#!/bin/sh\n/usr/sbin/iw dev mlan0 set power_save off\n' > /etc/network/if-up.d/disable_power_saving +chmod 755 /etc/network/if-up.d/disable_power_saving + +# Enable SSH +echo -e -n "\nEnable SSH\n" +service ssh start +ufw allow ssh + +# Disable Gnome and other services +# - to enable gnome - systemctl set-default graphical +# - to start gnome - systemctl start gdm3 +systemctl stop bluetooth +systemctl stop cups-browsed + +# Disable X on startup +echo -e -n "\nSet console-only at startup\n" +systemctl set-default multi-user.target + echo -e -n "\nUpdating car...\n" # Get latest key from OpenVINO curl -o GPG-PUB-KEY-INTEL-SW-PRODUCTS https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB -sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS +apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS -# Update Ubuntu +# Get latest key from ROS +curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg +echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list >/dev/null + +# Update package lists echo -e -n "\nUpdating Ubuntu packages\n" sudo apt-get update -sudo apt-get upgrade -o Dpkg::Options::="--force-overwrite" -o Dpkg::Options::='--force-confold' -y -# Update DeepRacer -echo -e -n "\nUpdate DeepRacer packages\n" -sudo apt-get install aws-deepracer-* -y +# Remove unnecessary packages - first add the smaller versions +apt install -y --no-install-recommends ubuntu-server ros-foxy-ros-base ros-dev-tools +apt purge -y ubuntu-desktop ubuntu-desktop-minimal ubuntu-wallpapers ros-foxy-desktop firefox-locale-en firefox fonts-indic gnome-shell gnome-keyring gnome-terminal gnome-control-center language-pack-gnome-en-base wbritish wamerican mplayer hplip gvfs -# Ensure all packages installed -sudo apt-get update -sudo apt-get upgrade -y +echo -e -n "\nRemove redundant packages\n" +apt autoremove -y --purge + +# Update Ubuntu +sudo apt-get upgrade -o Dpkg::Options::="--force-overwrite" -o Dpkg::Options::='--force-confold' -y # Remove redundant packages -echo -e -n "\nRemove redundant packages\n" sudo apt autoremove -y # If changing hostname need to change the flag in network_config.py @@ -126,24 +156,6 @@ cp $bundlePath/bundle.js ${backupDir}/bundle.js.bak rm $bundlePath/bundle.js cat ${backupDir}/bundle.js.bak | sed -e "s/isVideoPlaying\: true/isVideoPlaying\: false/" > $bundlePath/bundle.js -# Disable system suspend -echo -e -n "\nDisable system suspend\n" -systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target - -# Disable X on startup -echo -e -n "\nSet console-only at startup\n" -systemctl set-default multi-user.target - -# Disable network power saving -echo -e -n "\nDisable network power saving" -echo -e '#!/bin/sh\n/usr/sbin/iw dev mlan0 set power_save off\n' > /etc/network/if-up.d/disable_power_saving -chmod 755 /etc/network/if-up.d/disable_power_saving - -# Enable SSH -echo -e -n "\nEnable SSH\n" -service ssh start -ufw allow ssh - # Allow multiple logins on the console echo -e -n "\nEnable multiple logins to the console\n" cp /etc/nginx/sites-enabled/default ${backupDir}/default.bak @@ -156,13 +168,6 @@ cp $webserverPath/login.py ${backupDir}/login.py.bak rm $webserverPath/login.py cat ${backupDir}/login.py.bak | sed -e "s/datetime.timedelta(hours=1)/datetime.timedelta(hours=12)/" > $webserverPath/login.py -# Disable Gnome and other services -# - to enable gnome - systemctl set-default graphical -# - to start gnome - systemctl start gdm3 -systemctl set-default multi-user -systemctl stop bluetooth -systemctl stop cups-browsed - # Default running service list # service --status-all | grep '\[ + \]' # [ + ] acpid From 3a02b6b94ffa0d7e45de0e24f830d24ace7e5717 Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Thu, 28 Mar 2024 22:27:14 +0000 Subject: [PATCH 11/22] No need for sudo --- tweaks.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tweaks.sh b/tweaks.sh index 00e58b4..9aaa77b 100644 --- a/tweaks.sh +++ b/tweaks.sh @@ -109,7 +109,7 @@ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-a # Update package lists echo -e -n "\nUpdating Ubuntu packages\n" -sudo apt-get update +apt update # Remove unnecessary packages - first add the smaller versions apt install -y --no-install-recommends ubuntu-server ros-foxy-ros-base ros-dev-tools @@ -119,10 +119,13 @@ echo -e -n "\nRemove redundant packages\n" apt autoremove -y --purge # Update Ubuntu -sudo apt-get upgrade -o Dpkg::Options::="--force-overwrite" -o Dpkg::Options::='--force-confold' -y +apt upgrade -o Dpkg::Options::="--force-overwrite" -o Dpkg::Options::='--force-confold' -y + +# Additional packages +apt install -y --no-install-recommends libboost-dev libboost-thread-dev libboost-regex-dev libboost-filesystem-dev # Remove redundant packages -sudo apt autoremove -y +apt autoremove -y # If changing hostname need to change the flag in network_config.py # /opt/aws/deepracer/lib/deepracer_systems_pkg/lib/python3.8/site-packages/deepracer_systems_pkg/network_monitor_module/network_config.py From fc24c8aa4fd51a09d59547c9194e9586d5ec23a6 Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Fri, 29 Mar 2024 08:28:11 +0000 Subject: [PATCH 12/22] Using mark manual to avoid deinstall --- tweaks.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tweaks.sh b/tweaks.sh index 9aaa77b..434e771 100644 --- a/tweaks.sh +++ b/tweaks.sh @@ -105,15 +105,16 @@ apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS # Get latest key from ROS curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg -echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list >/dev/null +echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2-latest.list >/dev/null # Update package lists echo -e -n "\nUpdating Ubuntu packages\n" apt update -# Remove unnecessary packages - first add the smaller versions -apt install -y --no-install-recommends ubuntu-server ros-foxy-ros-base ros-dev-tools -apt purge -y ubuntu-desktop ubuntu-desktop-minimal ubuntu-wallpapers ros-foxy-desktop firefox-locale-en firefox fonts-indic gnome-shell gnome-keyring gnome-terminal gnome-control-center language-pack-gnome-en-base wbritish wamerican mplayer hplip gvfs +# Remove unnecessary packages - first hold the smaller versions +apt-mark manual ubuntu-standard ros-foxy-ros-base libboost-all-dev +snap remove gnome-3-34-1804 gtk-common-themes snap-store && snap remove core18 && snap remove snapd +apt purge -y ubuntu-desktop ubuntu-desktop-minimal ubuntu-wallpapers ros-foxy-desktop firefox-locale-en firefox fonts-indic gnome-shell gnome-keyring gnome-terminal gnome-control-center language-pack-gnome-en-base wbritish wamerican mplayer hplip gvfs snapd echo -e -n "\nRemove redundant packages\n" apt autoremove -y --purge @@ -121,9 +122,6 @@ apt autoremove -y --purge # Update Ubuntu apt upgrade -o Dpkg::Options::="--force-overwrite" -o Dpkg::Options::='--force-confold' -y -# Additional packages -apt install -y --no-install-recommends libboost-dev libboost-thread-dev libboost-regex-dev libboost-filesystem-dev - # Remove redundant packages apt autoremove -y From 59263ca729a394e7140aa28f8419b73339c4de53 Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Fri, 29 Mar 2024 10:11:42 +0000 Subject: [PATCH 13/22] Missing packages --- tweaks.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tweaks.sh b/tweaks.sh index 434e771..b285aeb 100644 --- a/tweaks.sh +++ b/tweaks.sh @@ -122,6 +122,9 @@ apt autoremove -y --purge # Update Ubuntu apt upgrade -o Dpkg::Options::="--force-overwrite" -o Dpkg::Options::='--force-confold' -y +# Additional packages +apt install -y --no-install-recommends python3-websocket python3-click + # Remove redundant packages apt autoremove -y From a1328d1ee9676ffc39a10e94ab3be3f71cc18cb2 Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Fri, 29 Mar 2024 10:13:51 +0000 Subject: [PATCH 14/22] Updated list of services --- tweaks.sh | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/tweaks.sh b/tweaks.sh index b285aeb..96049a5 100644 --- a/tweaks.sh +++ b/tweaks.sh @@ -174,42 +174,26 @@ cat ${backupDir}/login.py.bak | sed -e "s/datetime.timedelta(hours=1)/datetime.t # Default running service list # service --status-all | grep '\[ + \]' -# [ + ] acpid # [ + ] alsa-utils # [ + ] apparmor -# [ + ] apport # [ + ] avahi-daemon -# [ + ] binfmt-support -# [ + ] bluetooth -# [ + ] console-setup # [ + ] cron -# [ + ] cups-browsed # [ + ] dbus # [ + ] dnsmasq # [ + ] fail2ban -# [ + ] grub-common # [ + ] irqbalance # [ + ] isc-dhcp-server -# [ + ] keyboard-setup # [ + ] kmod -# [ + ] lightdm # [ + ] network-manager -# [ + ] networking # [ + ] nginx -# [ + ] ondemand # [ + ] procps -# [ + ] rc.local -# [ + ] resolvconf # [ + ] rsyslog -# [ + ] speech-dispatcher # [ + ] ssh -# [ + ] thermald +# [ + ] system-init # [ + ] udev # [ + ] ufw -# [ + ] urandom # [ + ] uuidd -# [ + ] watchdog -# [ + ] whoopsie +# [ + ] wd_keepalive # Restart services echo 'Restarting services' From ff756854bcd0c784c75e2da2d7b5b838e31aa45c Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Fri, 29 Mar 2024 10:34:56 +0000 Subject: [PATCH 15/22] Remove swap --- tweaks.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tweaks.sh b/tweaks.sh index 96049a5..5ed6a4b 100644 --- a/tweaks.sh +++ b/tweaks.sh @@ -128,6 +128,11 @@ apt install -y --no-install-recommends python3-websocket python3-click # Remove redundant packages apt autoremove -y +# Remove Swap +swapoff -a +sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab +rm /swapfile + # If changing hostname need to change the flag in network_config.py # /opt/aws/deepracer/lib/deepracer_systems_pkg/lib/python3.8/site-packages/deepracer_systems_pkg/network_monitor_module/network_config.py # SET_HOSTNAME_TO_CHASSIS_SERIAL_NUMBER = False From 824232a4cef17035824deced054512995411ceeb Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Fri, 29 Mar 2024 10:35:48 +0000 Subject: [PATCH 16/22] Additional dependencies --- dev-stack-package.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-stack-package.sh b/dev-stack-package.sh index 5482fcb..a1be0ad 100755 --- a/dev-stack-package.sh +++ b/dev-stack-package.sh @@ -70,7 +70,7 @@ do dpkg-deb -R src/aws-deepracer-core_*amd64.deb aws-deepracer-core cd aws-deepracer-core sed -i "s/Version: .*/Version: $VERSION/" DEBIAN/control - sed -i '/Depends/ s/$/, gnupg, ros-foxy-ros-base, ros-foxy-std-msgs, ros-foxy-sensor-msgs, ros-foxy-image-transport, ros-foxy-compressed-image-transport, ros-foxy-cv-bridge/' DEBIAN/control + sed -i '/Depends/ s/$/, gnupg, ros-foxy-ros-base, ros-foxy-std-msgs, ros-foxy-sensor-msgs, ros-foxy-image-transport, ros-foxy-compressed-image-transport, ros-foxy-pybind11-vendor, ros-foxy-cv-bridge, python3-websocket, python3-click/' DEBIAN/control rm -rf opt/aws/deepracer/lib/* cp $DIR/files/start_ros.sh opt/aws/deepracer cp -r $DIR/ws/install/* opt/aws/deepracer/lib/ From 3e61e8736b91802a019deb5bec143c458b99dbd3 Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Fri, 29 Mar 2024 10:35:57 +0000 Subject: [PATCH 17/22] Install GPU driver --- dev-stack-install-package.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dev-stack-install-package.sh b/dev-stack-install-package.sh index 4457ea1..2657066 100755 --- a/dev-stack-install-package.sh +++ b/dev-stack-install-package.sh @@ -10,9 +10,13 @@ sudo systemctl stop deepracer-core # DeepRacer Repos sudo cp $DIR/files/deepracer-larsll.asc /etc/apt/trusted.gpg.d/ sudo cp $DIR/files/aws_deepracer-community.list /etc/apt/sources.list.d/ -sudo apt-get update +sudo apt update -sudo apt-get install aws-deepracer-core +# Install GPU driver +sudo /opt/intel/openvino_2021/install_dependencies/install_NEO_OCL_driver.sh -y + +# Update DR +sudo apt -y install aws-deepracer-core # Restart deepracer sudo systemctl start deepracer-core From 5ada0131b4b0fcac4f1e16afa4d26d20ca7208f2 Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Wed, 30 Oct 2024 20:49:44 +0000 Subject: [PATCH 18/22] Fix the web server commit as it breaks otherwise --- ws/.rosinstall | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ws/.rosinstall b/ws/.rosinstall index 68b1f36..6c12f81 100644 --- a/ws/.rosinstall +++ b/ws/.rosinstall @@ -61,7 +61,7 @@ - git: uri: https://github.com/RobotWebTools/web_video_server.git local-name: web_video_server - version: ros2 + version: fc7338449da5789a59337d57d7ca374bbd7a0ad9 - git: uri: https://github.com/Slamtec/rplidar_ros.git local-name: rplidar_ros From 606bc33beaf1f2252b3e068cb11f92110851f642 Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Wed, 30 Oct 2024 20:50:02 +0000 Subject: [PATCH 19/22] Fix to only update foxy deps --- dev-stack-dependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-stack-dependencies.sh b/dev-stack-dependencies.sh index e2e90f3..e837175 100755 --- a/dev-stack-dependencies.sh +++ b/dev-stack-dependencies.sh @@ -19,4 +19,4 @@ sudo /opt/intel/openvino_2021/install_dependencies/install_NEO_OCL_driver.sh -y # Update ROS sudo rosdep init sudo rosdep fix-permissions -rosdep update --include-eol-distros \ No newline at end of file +rosdep update --rosdistro foxy \ No newline at end of file From 853d632a64532b13eba1f5bc85e7d4900ecaef69 Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Wed, 30 Oct 2024 20:52:26 +0000 Subject: [PATCH 20/22] Create custom device-console package --- dev-stack-package.sh | 21 +++++++ files/login.html | 143 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 164 insertions(+) create mode 100644 files/login.html diff --git a/dev-stack-package.sh b/dev-stack-package.sh index a1be0ad..932058a 100755 --- a/dev-stack-package.sh +++ b/dev-stack-package.sh @@ -81,4 +81,25 @@ do FILE=$(compgen -G aws-deepracer-core*.deb) mv $FILE $(echo $DIR/dist/$FILE | sed -e 's/\+/\-/') fi + + if [ "$pkg" == "aws-deepracer-device-console" ]; + then + echo -e "\n### Building aws-deepracer-device-console $VERSION ###\n" + dpkg-deb -R src/aws-deepracer-device-console_*amd64.deb aws-deepracer-device-console + cd aws-deepracer-device-console + sed -i "s/Version: .*/Version: $VERSION/" DEBIAN/control + sed -i 's/pyclean -p aws-deepracer-device-console/ /' DEBIAN/prerm + sed -i 's/.range-btn-minus button,.range-btn-plus button{background-color:#aab7b8!important;border-radius:4px!important;border:1px solid #879596!important}/.range-btn-minus button,.range-btn-plus button{background-color:#aab7b8!important;border-radius:4px!important;border:1px solid #879596!important;touch-action: manipulation;user-select: none;}/' opt/aws/deepracer/lib/device_console/static/bundle.css + sed -i 's/isVideoPlaying: true/isVideoPlaying: false/' opt/aws/deepracer/lib/device_console/static/bundle.js + sed -i 's/BATTERY_AND_NETWORK_DETAIL_API_CALL_FREQUENCY = 1000;/BATTERY_AND_NETWORK_DETAIL_API_CALL_FREQUENCY = 10000;/' opt/aws/deepracer/lib/device_console/static/bundle.js + cp $DIR/files/login.html opt/aws/deepracer/lib/device_console/templates/ + + echo "/opt/aws/deepracer/nginx/nginx_install_certs.sh" | tee -a DEBIAN/postinst >/dev/null + echo "systemctl restart nginx.service" | tee -a DEBIAN/postinst >/dev/null + cd .. + dpkg-deb --root-owner-group -b aws-deepracer-device-console + dpkg-name -o aws-deepracer-device-console.deb + FILE=$(compgen -G aws-deepracer-device-console*.deb) + mv $FILE $(echo $DIR/dist/$FILE | sed -e 's/\+/\-/') + fi done \ No newline at end of file diff --git a/files/login.html b/files/login.html new file mode 100644 index 0000000..c5bf100 --- /dev/null +++ b/files/login.html @@ -0,0 +1,143 @@ + + + + + + AWS DeepRacer - Login + + + + + + + + + + + +
+
+
+
+
+
+
+ AWS Logo + +

+ The default AWS DeepRacer password can be found printed on the bottom of your vehicle. +

+
+
+
+
+
+
+
+
+
+ +

+ {% with messages = get_flashed_messages() %} + {% if messages %} + {% for message in messages %} + {{ message }} + {% endfor %} + {% endif %} + {% endwith %} +

+
+ + +
+
+ +
+

Forgot password External link icon

+
+
+
+
+
+
+ + + + + + From 869878ddabba803b61b49e2c64673b95be245806 Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Sat, 2 Nov 2024 10:45:33 +0000 Subject: [PATCH 21/22] Patch ctrl-pkg / tune build --- dev-stack-build.sh | 131 +++++++----- files/aws-deepracer-ctrl-pkg.patch | 319 +++++++++++++++++++++++++++++ 2 files changed, 396 insertions(+), 54 deletions(-) create mode 100644 files/aws-deepracer-ctrl-pkg.patch diff --git a/dev-stack-build.sh b/dev-stack-build.sh index fe26f84..198e2fa 100755 --- a/dev-stack-build.sh +++ b/dev-stack-build.sh @@ -7,60 +7,83 @@ source /opt/intel/openvino_2021/bin/setupvars.sh # Change to build directory cd ws -rosws update - -####### -# -# START - Pull request specific changes -# - -# Update packages for PR's -# https://github.com/aws-deepracer/aws-deepracer-inference-pkg/pull/4 -cd aws-deepracer-inference-pkg -git fetch origin pull/5/head:tflite -git checkout tflite -cd .. - -# https://github.com/aws-deepracer/aws-deepracer-camera-pkg/pull/5 -cd aws-deepracer-camera-pkg -git fetch origin pull/5/head:compressed-image -git checkout compressed-image -cd .. - -# https://github.com/aws-deepracer/aws-deepracer-interfaces-pkg/pull/4 -cd aws-deepracer-interfaces-pkg -git fetch origin pull/4/head:compressed-image -git checkout compressed-image -cd .. - -# https://github.com/aws-deepracer/aws-deepracer-sensor-fusion-pkg/pull/4 -cd aws-deepracer-sensor-fusion-pkg -git fetch origin pull/4/head:compressed-image -git checkout compressed-image -cd .. - -# https://github.com/aws-deepracer/aws-deepracer-model-optimizer-pkg/pull/2 -cd aws-deepracer-model-optimizer-pkg -git fetch origin pull/3/head:tflite -git checkout tflite -cd .. - -# Resolve the dependanices -rosdep install -i --from-path . --rosdistro foxy -y - -# -# END - Pull request specific changes -# -####### - -# Remove previous builds (gives clean build) -rm -rf install build log - -# Update deepracer_launcher.py (fix an issue in the file) -cp ../files/launch/deepracer_launcher.py ./aws-deepracer-launcher/deepracer_launcher/launch/deepracer_launcher.py - -# Turn off SW update -sed -i "s/ENABLE_PERIODIC_SOFTWARE_UPDATE = True/ENABLE_PERIODIC_SOFTWARE_UPDATE = False/" aws-deepracer-systems-pkg/deepracer_systems_pkg/deepracer_systems_pkg/software_update_module/software_update_config.py +# Parse command line arguments +CACHE="false" +while getopts "c" opt; do + case ${opt} in + c ) + CACHE="true" + ;; + \? ) + echo "Usage: cmd [-c]" + exit 1 + ;; + esac +done + +if [ "$CACHE" != "true" ]; then + + rosws update + + ####### + # + # START - Pull request specific changes + # + + # Update packages for PR's + # https://github.com/aws-deepracer/aws-deepracer-inference-pkg/pull/4 + cd aws-deepracer-inference-pkg + git fetch origin pull/5/head:tflite + git checkout tflite + cd .. + + # https://github.com/aws-deepracer/aws-deepracer-camera-pkg/pull/5 + cd aws-deepracer-camera-pkg + git fetch origin pull/5/head:compressed-image + git checkout compressed-image + cd .. + + # https://github.com/aws-deepracer/aws-deepracer-interfaces-pkg/pull/4 + cd aws-deepracer-interfaces-pkg + git fetch origin pull/4/head:compressed-image + git checkout compressed-image + cd .. + + # https://github.com/aws-deepracer/aws-deepracer-sensor-fusion-pkg/pull/4 + cd aws-deepracer-sensor-fusion-pkg + git fetch origin pull/4/head:compressed-image + git checkout compressed-image + cd .. + + # https://github.com/aws-deepracer/aws-deepracer-model-optimizer-pkg/pull/2 + cd aws-deepracer-model-optimizer-pkg + git fetch origin pull/3/head:tflite + git checkout tflite + cd .. + + # Patch with aws-deepracer-ctrl-pkg.patch + cd aws-deepracer-ctrl-pkg + git apply ../files/aws-deepracer-ctrl-pkg.patch + cd .. + + # Remove previous builds (gives clean build) + rm -rf install build log + + # Resolve the dependencies + rosdep install -i --from-path . --ignore-src --rosdistro foxy -y + + # + # END - Pull request specific changes + # + ####### + + # Update deepracer_launcher.py (fix an issue in the file) + cp ../files/launch/deepracer_launcher.py ./aws-deepracer-launcher/deepracer_launcher/launch/deepracer_launcher.py + + # Turn off SW update + sed -i "s/ENABLE_PERIODIC_SOFTWARE_UPDATE = True/ENABLE_PERIODIC_SOFTWARE_UPDATE = False/" aws-deepracer-systems-pkg/deepracer_systems_pkg/deepracer_systems_pkg/software_update_module/software_update_config.py + +fi # Build the core colcon build --packages-up-to deepracer_launcher rplidar_ros diff --git a/files/aws-deepracer-ctrl-pkg.patch b/files/aws-deepracer-ctrl-pkg.patch new file mode 100644 index 0000000..5c0d866 --- /dev/null +++ b/files/aws-deepracer-ctrl-pkg.patch @@ -0,0 +1,319 @@ +diff --git a/ctrl_pkg/include/ctrl_pkg/ctrl_state.hpp b/ctrl_pkg/include/ctrl_pkg/ctrl_state.hpp +index b82b35e..eb78cfb 100644 +--- a/ctrl_pkg/include/ctrl_pkg/ctrl_state.hpp ++++ b/ctrl_pkg/include/ctrl_pkg/ctrl_state.hpp +@@ -82,28 +82,28 @@ namespace SysCtrl { + /// ROS publisher object to the publish the servo messages that will handle the actuation. + rclcpp::Publisher::SharedPtr servoPub_; + /// ROS callback group object to be passed to the servoGPIOClient_. +- rclcpp::callback_group::CallbackGroup::SharedPtr servoGPIOClientCbGrp_; ++ rclcpp::CallbackGroup::SharedPtr servoGPIOClientCbGrp_; + /// ROS client that sets the GPIO pin, this is required to be set when user + /// starts servo. + rclcpp::Client::SharedPtr servoGPIOClient_; + /// ROS callback group object to be passed to the modelOptimizerClient_. +- rclcpp::callback_group::CallbackGroup::SharedPtr modelOptimizerClientCbGrp_; ++ rclcpp::CallbackGroup::SharedPtr modelOptimizerClientCbGrp_; + /// ROS client to the model optimizer. + rclcpp::Client::SharedPtr modelOptimizerClient_; + /// ROS callback group object to be passed to the loadModelClient_. +- rclcpp::callback_group::CallbackGroup::SharedPtr loadModelClientCbGrp_; ++ rclcpp::CallbackGroup::SharedPtr loadModelClientCbGrp_; + /// ROS client to the inference engine model loading server. + rclcpp::Client::SharedPtr loadModelClient_; + /// ROS callback group object to be passed to the loadActionSpaceClient_. +- rclcpp::callback_group::CallbackGroup::SharedPtr loadActionSpaceClientCbGrp_; ++ rclcpp::CallbackGroup::SharedPtr loadActionSpaceClientCbGrp_; + // ROS client to the load action space service. + rclcpp::Client::SharedPtr loadActionSpaceClient_; + /// ROS callback group object to be passed to the inferStateClient_. +- rclcpp::callback_group::CallbackGroup::SharedPtr inferStateClientCbGrp_; ++ rclcpp::CallbackGroup::SharedPtr inferStateClientCbGrp_; + /// ROS client to inference engine. + rclcpp::Client::SharedPtr inferStateClient_; + /// ROS callback group object to be passed to the navigationThrottleClient_. +- rclcpp::callback_group::CallbackGroup::SharedPtr navigationThrottleClientCbGrp_; ++ rclcpp::CallbackGroup::SharedPtr navigationThrottleClientCbGrp_; + /// ROS client to the navigation throttle control. + rclcpp::Client::SharedPtr navigationThrottleClient_; + /// State variable that tracks whether or not the state is active. +@@ -145,7 +145,7 @@ namespace SysCtrl { + /// ROS publisher object to the publish the servo messages that will handle the actuation. + rclcpp::Publisher::SharedPtr servoPub_; + /// ROS callback group object to be passed to the servoGPIOClient_. +- rclcpp::callback_group::CallbackGroup::SharedPtr servoGPIOClientCbGrp_; ++ rclcpp::CallbackGroup::SharedPtr servoGPIOClientCbGrp_; + /// ROS client that sets the GPIO pin, this is required to be set when user + /// starts servo. + rclcpp::Client::SharedPtr servoGPIOClient_; +@@ -182,28 +182,28 @@ namespace SysCtrl { + /// client for calibration. + rclcpp::Publisher::SharedPtr calibrationPub_; + /// ROS callback group object to be passed to the servoGPIOClient_. +- rclcpp::callback_group::CallbackGroup::SharedPtr servoGPIOClientCbGrp_; ++ rclcpp::CallbackGroup::SharedPtr servoGPIOClientCbGrp_; + /// ROS client that sets the GPIO pin, this is required to be set when user + /// starts servo. + rclcpp::Client::SharedPtr servoGPIOClient_; + /// ROS callback group object to be passed to the servoGetCalClient_. +- rclcpp::callback_group::CallbackGroup::SharedPtr servoGetCalClientCbGrp_; ++ rclcpp::CallbackGroup::SharedPtr servoGetCalClientCbGrp_; + /// ROS client for setting the calibration. + rclcpp::Client::SharedPtr servoGetCalClient_; + /// ROS callback group object to be passed to the servoSetCalClient_. +- rclcpp::callback_group::CallbackGroup::SharedPtr servoSetCalClientCbGrp_; ++ rclcpp::CallbackGroup::SharedPtr servoSetCalClientCbGrp_; + /// ROS client for getting the calibration. + rclcpp::Client::SharedPtr servoSetCalClient_; + /// ROS callback group object to be passed to the servoGetLedClient_. +- rclcpp::callback_group::CallbackGroup::SharedPtr servoGetLedClientCbGrp_; ++ rclcpp::CallbackGroup::SharedPtr servoGetLedClientCbGrp_; + /// ROS client for getting the LED PWM values. + rclcpp::Client::SharedPtr servoGetLedClient_; + /// ROS callback group object to be passed to the servoSetLedClient_. +- rclcpp::callback_group::CallbackGroup::SharedPtr servoSetLedClientCbGrp_; ++ rclcpp::CallbackGroup::SharedPtr servoSetLedClientCbGrp_; + /// ROS client for setting the LED PWM values. + rclcpp::Client::SharedPtr servoSetLedClient_; + /// State variable that tracks whether or not the state is active. + bool isActive_; + }; + } +-#endif +\ No newline at end of file ++#endif +diff --git a/ctrl_pkg/src/ctrl_node.cpp b/ctrl_pkg/src/ctrl_node.cpp +index 78aabe4..a17dae5 100644 +--- a/ctrl_pkg/src/ctrl_node.cpp ++++ b/ctrl_pkg/src/ctrl_node.cpp +@@ -68,7 +68,7 @@ namespace SysCtrl { + { + RCLCPP_INFO(this->get_logger(), "%s started", nodeName.c_str()); + +- vehicleCtrlModesServiceCbGrp_ = this->create_callback_group(rclcpp::callback_group::CallbackGroupType::Reentrant); ++ vehicleCtrlModesServiceCbGrp_ = this->create_callback_group(rclcpp::CallbackGroupType::Reentrant); + getVehicleCtrlModesService_ = this->create_service(GET_CTRL_MODES_SRV, + std::bind(&SysCtrl::CtrlNodeMgr::getCtrlModesHdl, + this, +@@ -78,7 +78,7 @@ namespace SysCtrl { + ::rmw_qos_profile_default, + vehicleCtrlModesServiceCbGrp_); + +- vehicleModeServiceCbGrp_ = this->create_callback_group(rclcpp::callback_group::CallbackGroupType::Reentrant); ++ vehicleModeServiceCbGrp_ = this->create_callback_group(rclcpp::CallbackGroupType::MutuallyExclusive); + setVehicleModeService_ = this->create_service(VEHICLE_STATE_SRV, + std::bind(&SysCtrl::CtrlNodeMgr::stateHdl, + this, +@@ -87,7 +87,7 @@ namespace SysCtrl { + std::placeholders::_3), + ::rmw_qos_profile_default, + vehicleModeServiceCbGrp_); +- activateVehicleServiceCbGrp_ = this->create_callback_group(rclcpp::callback_group::CallbackGroupType::Reentrant); ++ activateVehicleServiceCbGrp_ = this->create_callback_group(rclcpp::CallbackGroupType::MutuallyExclusive); + activateVehicleService_ = this->create_service(ENABLE_STATE_SRV, + std::bind(&SysCtrl::CtrlNodeMgr::ctrlStateHdl, + this, +@@ -98,7 +98,7 @@ namespace SysCtrl { + activateVehicleServiceCbGrp_); + + +- loadModelCbGrp_ = this->create_callback_group(rclcpp::callback_group::CallbackGroupType::Reentrant); ++ loadModelCbGrp_ = this->create_callback_group(rclcpp::CallbackGroupType::MutuallyExclusive); + loadModelService_ = this->create_service(MODEL_STATE_SRV, + std::bind(&SysCtrl::CtrlNodeMgr::loadModelHdl, + this, +@@ -107,7 +107,7 @@ namespace SysCtrl { + std::placeholders::_3), + ::rmw_qos_profile_default, + loadModelCbGrp_); +- isModelLoadingCbGrp_ = this->create_callback_group(rclcpp::callback_group::CallbackGroupType::Reentrant); ++ isModelLoadingCbGrp_ = this->create_callback_group(rclcpp::CallbackGroupType::Reentrant); + isModelLoadingService_ = this->create_service(IS_MODEL_LOADING_SRV, + std::bind(&SysCtrl::CtrlNodeMgr::isModelLoadingHdl, + this, +@@ -116,7 +116,7 @@ namespace SysCtrl { + std::placeholders::_3), + ::rmw_qos_profile_default, + isModelLoadingCbGrp_); +- vehicleCalibrationCbGrp_ = this->create_callback_group(rclcpp::callback_group::CallbackGroupType::MutuallyExclusive); ++ vehicleCalibrationCbGrp_ = this->create_callback_group(rclcpp::CallbackGroupType::MutuallyExclusive); + getCarCalibrationService_ = this->create_service(GET_CAL_SRV, + std::bind(&SysCtrl::CtrlNodeMgr::getCarCalHdl, + this, +@@ -134,7 +134,7 @@ namespace SysCtrl { + ::rmw_qos_profile_default, + vehicleCalibrationCbGrp_); + +- vehicleLedCbGrp_ = this->create_callback_group(rclcpp::callback_group::CallbackGroupType::MutuallyExclusive); ++ vehicleLedCbGrp_ = this->create_callback_group(rclcpp::CallbackGroupType::MutuallyExclusive); + getCarLedService_ = this->create_service(GET_LED_SRV, + std::bind(&SysCtrl::CtrlNodeMgr::getCarLedHdl, + this, +@@ -152,7 +152,7 @@ namespace SysCtrl { + ::rmw_qos_profile_default, + vehicleLedCbGrp_); + +- autonomousThrottleCbGrp_ = this->create_callback_group(rclcpp::callback_group::CallbackGroupType::Reentrant); ++ autonomousThrottleCbGrp_ = this->create_callback_group(rclcpp::CallbackGroupType::MutuallyExclusive); + setAutonomousThrottleService_ = this->create_service(AUTONOMOUS_THROTTLE_SRV, + std::bind(&SysCtrl::CtrlNodeMgr::autoThrottleHdl, + this, +@@ -205,7 +205,8 @@ namespace SysCtrl { + videoClientCbGrp_); + while (!videoClient_->wait_for_service(std::chrono::seconds(1))) { + if (!rclcpp::ok()) { +- RCLCPP_ERROR(this->get_logger(), "Camera node failed"); ++ RCLCPP_ERROR(this->get_logger(), "Waiting for camera node was interrupted"); ++ return; + } + RCLCPP_INFO(this->get_logger(), "Camera node not available, waiting again..."); + } +@@ -262,7 +263,7 @@ namespace SysCtrl { + void loadModelHdl(const std::shared_ptr request_header, + std::shared_ptr req, + std::shared_ptr res) { +- RCLCPP_INFO(this->get_logger(), "loadModelHdl %d", request_header->sequence_number); ++ RCLCPP_INFO(this->get_logger(), "loadModelHdl %d", (int) request_header->sequence_number); + res->error = 1; + if (activeState_ == stateList_.end()) { + RCLCPP_ERROR(this->get_logger(), "No active state"); +@@ -403,26 +404,26 @@ namespace SysCtrl { + std::unordered_map>::const_iterator activeState_; + + /// ROS callback group object to be passed to the videoClient_. +- rclcpp::callback_group::CallbackGroup::SharedPtr videoClientCbGrp_; ++ rclcpp::CallbackGroup::SharedPtr videoClientCbGrp_; + /// ROS service client to activate the camera node to start publishing images. + rclcpp::Client::SharedPtr videoClient_; +- rclcpp::callback_group::CallbackGroup::SharedPtr vehicleCtrlModesServiceCbGrp_; ++ rclcpp::CallbackGroup::SharedPtr vehicleCtrlModesServiceCbGrp_; + rclcpp::Service::SharedPtr getVehicleCtrlModesService_; +- rclcpp::callback_group::CallbackGroup::SharedPtr vehicleModeServiceCbGrp_; ++ rclcpp::CallbackGroup::SharedPtr vehicleModeServiceCbGrp_; + rclcpp::Service::SharedPtr setVehicleModeService_; +- rclcpp::callback_group::CallbackGroup::SharedPtr activateVehicleServiceCbGrp_; ++ rclcpp::CallbackGroup::SharedPtr activateVehicleServiceCbGrp_; + rclcpp::Service::SharedPtr activateVehicleService_; +- rclcpp::callback_group::CallbackGroup::SharedPtr loadModelCbGrp_; ++ rclcpp::CallbackGroup::SharedPtr loadModelCbGrp_; + rclcpp::Service::SharedPtr loadModelService_; +- rclcpp::callback_group::CallbackGroup::SharedPtr isModelLoadingCbGrp_; ++ rclcpp::CallbackGroup::SharedPtr isModelLoadingCbGrp_; + rclcpp::Service::SharedPtr isModelLoadingService_; +- rclcpp::callback_group::CallbackGroup::SharedPtr vehicleCalibrationCbGrp_; ++ rclcpp::CallbackGroup::SharedPtr vehicleCalibrationCbGrp_; + rclcpp::Service::SharedPtr getCarCalibrationService_; + rclcpp::Service::SharedPtr setCarCalibrationService_; +- rclcpp::callback_group::CallbackGroup::SharedPtr vehicleLedCbGrp_; ++ rclcpp::CallbackGroup::SharedPtr vehicleLedCbGrp_; + rclcpp::Service::SharedPtr getCarLedService_; + rclcpp::Service::SharedPtr setCarLedService_; +- rclcpp::callback_group::CallbackGroup::SharedPtr autonomousThrottleCbGrp_; ++ rclcpp::CallbackGroup::SharedPtr autonomousThrottleCbGrp_; + rclcpp::Service::SharedPtr setAutonomousThrottleService_; + }; + } +diff --git a/ctrl_pkg/src/ctrl_state.cpp b/ctrl_pkg/src/ctrl_state.cpp +index a75a58a..80fc12d 100644 +--- a/ctrl_pkg/src/ctrl_state.cpp ++++ b/ctrl_pkg/src/ctrl_state.cpp +@@ -49,7 +49,8 @@ namespace { + std::shared_ptr ctrlNode) { + while (!client->wait_for_service(std::chrono::seconds(1))) { + if (!rclcpp::ok()) { +- RCLCPP_ERROR(ctrlNode->get_logger(), "%s node failed", client->get_service_name()); ++ RCLCPP_ERROR(ctrlNode->get_logger(), "Waiting for %s node was interrupted", client->get_service_name()); ++ return; + } + RCLCPP_INFO(ctrlNode->get_logger(), "%s not available, waiting again...", client->get_service_name()); + } +@@ -85,37 +86,37 @@ namespace SysCtrl { + rclcpp::SubscriptionOptions(), + servoMsgStrategy); + +- servoGPIOClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::callback_group::CallbackGroupType::Reentrant); ++ servoGPIOClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::CallbackGroupType::Reentrant); + servoGPIOClient_ = ctrlNode->create_client(SERVO_GPIO_SRV, + rmw_qos_profile_services_default, + servoGPIOClientCbGrp_); + waitForService(servoGPIOClient_, ctrlNode); + +- modelOptimizerClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::callback_group::CallbackGroupType::Reentrant); ++ modelOptimizerClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::CallbackGroupType::Reentrant); + modelOptimizerClient_ = ctrlNode->create_client(MODEL_OPT_SRV, + rmw_qos_profile_services_default, + modelOptimizerClientCbGrp_); + waitForService(modelOptimizerClient_, ctrlNode); + +- loadModelClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::callback_group::CallbackGroupType::Reentrant); ++ loadModelClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::CallbackGroupType::Reentrant); + loadModelClient_ = ctrlNode->create_client(MODEL_SRV, + rmw_qos_profile_services_default, + loadModelClientCbGrp_); + waitForService(loadModelClient_, ctrlNode); + +- loadActionSpaceClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::callback_group::CallbackGroupType::Reentrant); ++ loadActionSpaceClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::CallbackGroupType::Reentrant); + loadActionSpaceClient_ = ctrlNode->create_client(NAV_ACTION_SPACE_SRV, + rmw_qos_profile_services_default, + loadActionSpaceClientCbGrp_); + waitForService(loadActionSpaceClient_, ctrlNode); + +- inferStateClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::callback_group::CallbackGroupType::Reentrant); ++ inferStateClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::CallbackGroupType::Reentrant); + inferStateClient_ = ctrlNode->create_client(INFER_SRV, + rmw_qos_profile_services_default, + inferStateClientCbGrp_); + waitForService(inferStateClient_, ctrlNode); + +- navigationThrottleClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::callback_group::CallbackGroupType::Reentrant); ++ navigationThrottleClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::CallbackGroupType::Reentrant); + navigationThrottleClient_ = ctrlNode->create_client(NAV_THROTTLE_SRV, + rmw_qos_profile_services_default, + navigationThrottleClientCbGrp_); +@@ -323,7 +324,7 @@ namespace SysCtrl { + rclcpp::SubscriptionOptions(), + servoMsgStrategy); + +- servoGPIOClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::callback_group::CallbackGroupType::Reentrant); ++ servoGPIOClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::CallbackGroupType::Reentrant); + servoGPIOClient_ = ctrlNode->create_client(SERVO_GPIO_SRV, + rmw_qos_profile_services_default, + servoGPIOClientCbGrp_); +@@ -424,31 +425,31 @@ namespace SysCtrl { + rclcpp::SubscriptionOptions(), + servoMsgStrategy); + +- servoGPIOClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::callback_group::CallbackGroupType::Reentrant); ++ servoGPIOClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::CallbackGroupType::Reentrant); + servoGPIOClient_ = ctrlNode->create_client(SERVO_GPIO_SRV, + rmw_qos_profile_services_default, + servoGPIOClientCbGrp_); + waitForService(servoGPIOClient_, ctrlNode); + +- servoGetCalClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::callback_group::CallbackGroupType::Reentrant); ++ servoGetCalClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::CallbackGroupType::Reentrant); + servoGetCalClient_ = ctrlNode->create_client(GET_SERVO_CAL_SRV, + rmw_qos_profile_services_default, + servoGetCalClientCbGrp_); + waitForService(servoGetCalClient_, ctrlNode); + +- servoSetCalClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::callback_group::CallbackGroupType::Reentrant); ++ servoSetCalClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::CallbackGroupType::Reentrant); + servoSetCalClient_ = ctrlNode->create_client(SET_SERVO_CAL_SRV, + rmw_qos_profile_services_default, + servoSetCalClientCbGrp_); + waitForService(servoSetCalClient_, ctrlNode); + +- servoGetLedClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::callback_group::CallbackGroupType::Reentrant); ++ servoGetLedClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::CallbackGroupType::Reentrant); + servoGetLedClient_ = ctrlNode->create_client(GET_LED_PWM_SRV, + rmw_qos_profile_services_default, + servoGetLedClientCbGrp_); + waitForService(servoGetLedClient_, ctrlNode); + +- servoSetLedClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::callback_group::CallbackGroupType::Reentrant); ++ servoSetLedClientCbGrp_ = ctrlNode->create_callback_group(rclcpp::CallbackGroupType::Reentrant); + servoSetLedClient_ = ctrlNode->create_client(SET_LED_PWM_SRV, + rmw_qos_profile_services_default, + servoSetLedClientCbGrp_); From 1a591b86eed307c7a8c82bc37c0c98683a529c89 Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Sat, 2 Nov 2024 11:02:54 +0000 Subject: [PATCH 22/22] Fixes --- dev-stack-build.sh | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/dev-stack-build.sh b/dev-stack-build.sh index 198e2fa..3721091 100755 --- a/dev-stack-build.sh +++ b/dev-stack-build.sh @@ -1,11 +1,5 @@ #!/usr/bin/env bash set -e -# Set the environment -source /opt/ros/foxy/setup.bash -source /opt/intel/openvino_2021/bin/setupvars.sh - -# Change to build directory -cd ws # Parse command line arguments CACHE="false" @@ -21,8 +15,25 @@ while getopts "c" opt; do esac done +# Set the environment +source /opt/ros/foxy/setup.bash +source /opt/intel/openvino_2021/bin/setupvars.sh + +# Change to build directory +cd ws + if [ "$CACHE" != "true" ]; then - + + # Undo checkouts / patches + for pkg_dir in */; + do + cd $pkg_dir + if [ -d .git ]; then + git reset --hard + fi + cd .. + done + rosws update ####### @@ -63,7 +74,7 @@ if [ "$CACHE" != "true" ]; then # Patch with aws-deepracer-ctrl-pkg.patch cd aws-deepracer-ctrl-pkg - git apply ../files/aws-deepracer-ctrl-pkg.patch + git apply ../../files/aws-deepracer-ctrl-pkg.patch cd .. # Remove previous builds (gives clean build)