From 8bd991a00ff6dd1c59b81cf51d9b7583bc71e59f Mon Sep 17 00:00:00 2001 From: Jakub Delicat Date: Thu, 19 Oct 2023 03:30:47 +0200 Subject: [PATCH] Added recommendations Signed-off-by: Jakub Delicat --- .github/workflows/ros-docker-image.yaml | 14 ++++++-------- .github/workflows/vulcanexus-docker-image.yaml | 14 ++++++-------- .gitignore | 2 +- .vscode/extensions.json | 6 ++++++ .vscode/settings.json | 6 ++++++ Dockerfile.simulation | 2 +- README.md | 2 +- demo/README.md | 2 +- demo/compose.simulation.yaml | 13 +++++-------- demo/compose.yaml | 7 ++----- demo/net.env | 2 +- flash-firmware.py | 2 +- print-serial-number.py | 15 +++++---------- read_cpu_id/platformio.ini | 4 ++-- read_cpu_id/src/main.cpp | 2 -- sync_with_rosbot.sh | 2 +- 16 files changed, 45 insertions(+), 50 deletions(-) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json diff --git a/.github/workflows/ros-docker-image.yaml b/.github/workflows/ros-docker-image.yaml index d458d1f..7b824d3 100644 --- a/.github/workflows/ros-docker-image.yaml +++ b/.github/workflows/ros-docker-image.yaml @@ -4,23 +4,23 @@ on: workflow_dispatch: inputs: build_type: - description: "Is it a \"development\" or a \"stable\" release?" + description: 'Is it a "development" or a "stable" release?' required: true - default: 'development' + default: "development" type: choice options: - development - stable target_distro: - description: "In case of \"stable\" release specify the ROS distro of the existing docker image (eg. humble)" + description: 'In case of "stable" release specify the ROS distro of the existing docker image (eg. humble)' type: string default: "ardent" target_release: - description: "In case of \"stable\" release specify the version of the existing docker image (eg. 1.0.12)" + description: 'In case of "stable" release specify the version of the existing docker image (eg. 1.0.12)' type: string default: "0.0.0" target_date: - description: "In case of \"stable\" release specify the date of the existing docker image in format YYYYMMDD (eg. 20220124)" + description: 'In case of "stable" release specify the date of the existing docker image in format YYYYMMDD (eg. 20220124)' type: string default: "20131206" repository_dispatch: @@ -36,7 +36,6 @@ jobs: strategy: fail-fast: false matrix: - include: - dockerfile: Dockerfile.hardware repo_name: "" @@ -56,7 +55,6 @@ jobs: ros_distro: "iron" steps: - - name: Checkout uses: actions/checkout@v2 @@ -64,7 +62,7 @@ jobs: uses: husarion-ci/ros-docker-img-action@v0.4 with: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} - dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} + dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} main_branch_name: ros2 dockerfile: ${{ matrix.dockerfile }} repo_name: ${{ matrix.repo_name }} diff --git a/.github/workflows/vulcanexus-docker-image.yaml b/.github/workflows/vulcanexus-docker-image.yaml index f9fb718..1265b92 100644 --- a/.github/workflows/vulcanexus-docker-image.yaml +++ b/.github/workflows/vulcanexus-docker-image.yaml @@ -4,23 +4,23 @@ on: workflow_dispatch: inputs: build_type: - description: "Is it a \"development\" or a \"stable\" release?" + description: 'Is it a "development" or a "stable" release?' required: true - default: 'development' + default: "development" type: choice options: - development - stable target_distro: - description: "In case of \"stable\" release specify the ROS distro of the existing docker image (eg. humble)" + description: 'In case of "stable" release specify the ROS distro of the existing docker image (eg. humble)' type: string default: "ardent" target_release: - description: "In case of \"stable\" release specify the version of the existing docker image (eg. 1.0.12)" + description: 'In case of "stable" release specify the version of the existing docker image (eg. 1.0.12)' type: string default: "0.0.0" target_date: - description: "In case of \"stable\" release specify the date of the existing docker image in format YYYYMMDD (eg. 20220124)" + description: 'In case of "stable" release specify the date of the existing docker image in format YYYYMMDD (eg. 20220124)' type: string default: "20131206" repository_dispatch: @@ -36,7 +36,6 @@ jobs: strategy: fail-fast: false matrix: - include: - dockerfile: Dockerfile.hardware repo_name: "" @@ -48,7 +47,6 @@ jobs: ros_distro: "humble" steps: - - name: Checkout uses: actions/checkout@v2 @@ -56,7 +54,7 @@ jobs: uses: husarion-ci/ros-docker-img-action@v0.4 with: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} - dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} + dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} main_branch_name: ros2 dockerfile: ${{ matrix.dockerfile }} repo_name: ${{ matrix.repo_name }} diff --git a/.gitignore b/.gitignore index 042bcb4..fce4737 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -rosbot_ros/ \ No newline at end of file +rosbot_ros/ diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..d6ee520 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,6 @@ +{ + "recommendations": [ + "redhat.vscode-yaml", + "shardulm94.trailing-spaces" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..f1ae2d6 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "files.insertFinalNewline": true, + "files.associations": { + "*.yaml": "yaml" + } +} diff --git a/Dockerfile.simulation b/Dockerfile.simulation index ec0391e..ccd6017 100644 --- a/Dockerfile.simulation +++ b/Dockerfile.simulation @@ -49,4 +49,4 @@ RUN MYDISTRO=${PREFIX:-ros}; MYDISTRO=${MYDISTRO//-/} && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* -RUN echo $(cat /ros2_ws/src/rosbot_gazebo/package.xml | grep '' | sed -r 's/.*([0-9]+.[0-9]+.[0-9]+)<\/version>/\1/g') > /version.txt \ No newline at end of file +RUN echo $(cat /ros2_ws/src/rosbot_gazebo/package.xml | grep '' | sed -r 's/.*([0-9]+.[0-9]+.[0-9]+)<\/version>/\1/g') > /version.txt diff --git a/README.md b/README.md index 175df01..366cbf2 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ In *docker-compose.yaml* you have to change `device` passed to docker. For more docker run \ --rm -it --privileged \ husarion/rosbot:humble \ -print-serial-number.py +print-serial-number.py ``` ## ROS node diff --git a/demo/README.md b/demo/README.md index 64a0a3b..5666aa9 100644 --- a/demo/README.md +++ b/demo/README.md @@ -43,4 +43,4 @@ and run inside `teleop_twist_keyboard` to drive the ROSbot ros2 run teleop_twist_keyboard teleop_twist_keyboard ``` -With keys `i`, `j`, `l`, `,` you can drive forward, counter clockwise, clockwise and backwards. If you are using macanum wheels (see `demo/.env` file) hold `Shift` key that way the ROSbot goes left and right with `j` and `l` keys instead rotates. \ No newline at end of file +With keys `i`, `j`, `l`, `,` you can drive forward, counter clockwise, clockwise and backwards. If you are using macanum wheels (see `demo/.env` file) hold `Shift` key that way the ROSbot goes left and right with `j` and `l` keys instead rotates. diff --git a/demo/compose.simulation.yaml b/demo/compose.simulation.yaml index f2218b4..1d97cc8 100644 --- a/demo/compose.simulation.yaml +++ b/demo/compose.simulation.yaml @@ -1,19 +1,16 @@ -x-net-config: - &net-config +x-net-config: &net-config network_mode: host ipc: host env_file: net.env -x-gpu-config: - &gpu-config +x-gpu-config: &gpu-config runtime: nvidia environment: - DISPLAY=${DISPLAY:?err} - NVIDIA_VISIBLE_DEVICES=all - NVIDIA_DRIVER_CAPABILITIES=all -x-cpu-config: - &cpu-config +x-cpu-config: &cpu-config environment: - DISPLAY=${DISPLAY:?err} - LIBGL_ALWAYS_SOFTWARE=1 @@ -21,8 +18,8 @@ x-cpu-config: services: rosbot: image: husarion/rosbot-gazebo:humble - <<: [ *net-config, *gpu-config] + <<: [*net-config, *gpu-config] volumes: - /tmp/.X11-unix:/tmp/.X11-unix:rw - /dev:/dev - command: ros2 launch rosbot_gazebo simulation.launch.py mecanum:=${MECANUM:-False} \ No newline at end of file + command: ros2 launch rosbot_gazebo simulation.launch.py mecanum:=${MECANUM:-False} diff --git a/demo/compose.yaml b/demo/compose.yaml index 0226cba..ff57e9d 100644 --- a/demo/compose.yaml +++ b/demo/compose.yaml @@ -1,11 +1,9 @@ -x-net-config: - &net-config +x-net-config: &net-config network_mode: host ipc: host env_file: net.env services: - rosbot: image: husarion/rosbot:humble <<: *net-config @@ -13,13 +11,12 @@ services: - ROS_DOMAIN_ID command: ros2 launch rosbot_bringup bringup.launch.py mecanum:=${MECANUM:-False} - micro-xrce-agent: image: husarion/micro-xrce-agent:v2.4.1 <<: *net-config devices: - ${SERIAL_PORT:?err} environment: - - XRCE_DOMAIN_ID_OVERRIDE=${ROS_DOMAIN_ID} # *** + - XRCE_DOMAIN_ID_OVERRIDE=${ROS_DOMAIN_ID} # *** - SERIAL_PORT command: MicroXRCEAgent serial -D $SERIAL_PORT serial -b 576000 # -v6 diff --git a/demo/net.env b/demo/net.env index 6c18d8e..029bdbe 100644 --- a/demo/net.env +++ b/demo/net.env @@ -14,4 +14,4 @@ RMW_IMPLEMENTATION=rmw_cyclonedds_cpp # 4. Cyclone DDS + VPN # RMW_IMPLEMENTATION=rmw_cyclonedds_cpp -# CYCLONEDDS_URI=file:///husarnet-cyclonedds.xml \ No newline at end of file +# CYCLONEDDS_URI=file:///husarnet-cyclonedds.xml diff --git a/flash-firmware.py b/flash-firmware.py index 970a8c5..175100a 100755 --- a/flash-firmware.py +++ b/flash-firmware.py @@ -120,4 +120,4 @@ def main(): if __name__ == "__main__": - main() \ No newline at end of file + main() diff --git a/print-serial-number.py b/print-serial-number.py index cbe0941..e341c80 100755 --- a/print-serial-number.py +++ b/print-serial-number.py @@ -48,19 +48,19 @@ def hex_to_num(self, hex_str): # Check if the hex string is valid if not all(c in string.hexdigits for c in hex_str): raise ValueError("Invalid hex string") - + # Convert the hex string to bytes try: hex_bytes = bytes.fromhex(hex_str) except ValueError: raise ValueError("Invalid hex string") - + # Compute the SHA-256 hash of the hex bytes hash = hashlib.sha256(hex_bytes).hexdigest() - + # Truncate the hash to 6 characters hash = hash[:6] - + # Return the hash as an ASCII string return hash @@ -103,7 +103,7 @@ def generate(self): print() # Close the serial port - ser.close() + ser.close() return result @@ -129,8 +129,3 @@ def main(): if __name__ == "__main__": main() - - - - - diff --git a/read_cpu_id/platformio.ini b/read_cpu_id/platformio.ini index 6dc8173..d9a534b 100644 --- a/read_cpu_id/platformio.ini +++ b/read_cpu_id/platformio.ini @@ -20,8 +20,8 @@ upload_protocol = stlink monitor_speed = 460800 -build_flags = +build_flags = -D SERIAL_UART_INSTANCE=1 -D TARGET_STM32F4 -debug_tool = stlink \ No newline at end of file +debug_tool = stlink diff --git a/read_cpu_id/src/main.cpp b/read_cpu_id/src/main.cpp index 74636ec..43693fb 100644 --- a/read_cpu_id/src/main.cpp +++ b/read_cpu_id/src/main.cpp @@ -27,5 +27,3 @@ void loop() // Wait for a second before printing again delay(1000); } - - diff --git a/sync_with_rosbot.sh b/sync_with_rosbot.sh index 35ba424..2dbd9c5 100755 --- a/sync_with_rosbot.sh +++ b/sync_with_rosbot.sh @@ -7,4 +7,4 @@ sshpass -p "husarion" rsync -vRr ./ husarion@$1:/home/husarion/${PWD##*/} while inotifywait -r -e modify,create,delete,move ./ ; do sshpass -p "husarion" rsync -vRr ./ husarion@$1:/home/husarion/${PWD##*/} -done \ No newline at end of file +done