From 03811b476170c231144087891ef4b3abdf68e28e Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Tue, 8 Feb 2022 11:48:16 +0100 Subject: [PATCH 1/5] Fix include paths Signed-off-by: Pablo Garrido --- .../library_generation/library_generation.sh | 15 +++++++++++---- .../library_generation/library_generation.sh | 7 +++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/microros_static_library/library_generation/library_generation.sh b/microros_static_library/library_generation/library_generation.sh index b61999a..e145efd 100755 --- a/microros_static_library/library_generation/library_generation.sh +++ b/microros_static_library/library_generation/library_generation.sh @@ -5,7 +5,7 @@ export BASE_PATH=/project/$MICROROS_LIBRARY_FOLDER ######## Init ######## -apt update +apt update apt install -y gcc-arm-none-eabi cd /uros_ws @@ -64,9 +64,16 @@ ros2 run micro_ros_setup build_firmware.sh $BASE_PATH/library_generation/toolcha find firmware/build/include/ -name "*.c" -delete rm -rf $BASE_PATH/libmicroros mkdir -p $BASE_PATH/libmicroros/microros_include -cp -R firmware/build/include/* $BASE_PATH/libmicroros/microros_include/ +cp -R firmware/build/include/* $BASE_PATH/libmicroros/microros_include/ cp -R firmware/build/libmicroros.a $BASE_PATH/libmicroros/libmicroros.a +######## Fix include paths ######## +INCLUDE_ROS2_PACKAGES=( rmw rcl rcl_action rcl_lifecycle rcl_logging_interface ) +for var in "${INCLUDE_ROS2_PACKAGES[@]}"; do + mv $BASE_PATH/libmicroros/microros_include/${var}/${var}/* $BASE_PATH/libmicroros/microros_include/${var} + rm -rf $BASE_PATH/libmicroros/microros_include/${var}/${var} +done + ######## Generate extra files ######## find firmware/mcu_ws/ros2 \( -name "*.srv" -o -name "*.msg" -o -name "*.action" \) | awk -F"/" '{print $(NF-2)"/"$NF}' > $BASE_PATH/libmicroros/available_ros2_types find firmware/mcu_ws/extra_packages \( -name "*.srv" -o -name "*.msg" -o -name "*.action" \) | awk -F"/" '{print $(NF-2)"/"$NF}' >> $BASE_PATH/libmicroros/available_ros2_types @@ -76,6 +83,6 @@ echo "" > $BASE_PATH/libmicroros/built_packages for f in $(find $(pwd) -name .git -type d); do pushd $f > /dev/null; echo $(git config --get remote.origin.url) $(git rev-parse HEAD) >> $BASE_PATH/libmicroros/built_packages; popd > /dev/null; done; ######## Fix permissions ######## -sudo chmod -R 777 $BASE_PATH/libmicroros/ -sudo chmod -R 777 $BASE_PATH/libmicroros/microros_include/ +sudo chmod -R 777 $BASE_PATH/libmicroros/ +sudo chmod -R 777 $BASE_PATH/libmicroros/microros_include/ sudo chmod -R 777 $BASE_PATH/libmicroros/libmicroros.a diff --git a/microros_static_library_ide/library_generation/library_generation.sh b/microros_static_library_ide/library_generation/library_generation.sh index 864e098..a9d8d8d 100755 --- a/microros_static_library_ide/library_generation/library_generation.sh +++ b/microros_static_library_ide/library_generation/library_generation.sh @@ -74,6 +74,13 @@ mkdir -p $BASE_PATH/libmicroros/include cp -R firmware/build/include/* $BASE_PATH/libmicroros/include/ cp -R firmware/build/libmicroros.a $BASE_PATH/libmicroros/libmicroros.a +######## Fix include paths ######## +INCLUDE_ROS2_PACKAGES=( rmw rcl rcl_action rcl_lifecycle rcl_logging_interface ) +for var in "${INCLUDE_ROS2_PACKAGES[@]}"; do + mv $BASE_PATH/libmicroros/include/${var}/${var}/* $BASE_PATH/libmicroros/include/${var} + rm -rf $BASE_PATH/libmicroros/include/${var}/${var} +done + ######## Generate extra files ######## find firmware/mcu_ws/ros2 \( -name "*.srv" -o -name "*.msg" -o -name "*.action" \) | awk -F"/" '{print $(NF-2)"/"$NF}' > $BASE_PATH/libmicroros/available_ros2_types find firmware/mcu_ws/extra_packages \( -name "*.srv" -o -name "*.msg" -o -name "*.action" \) | awk -F"/" '{print $(NF-2)"/"$NF}' >> $BASE_PATH/libmicroros/available_ros2_types From 20715704f38c1d3739b699d1a18f50a5b8fe3443 Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Fri, 11 Feb 2022 09:28:18 +0100 Subject: [PATCH 2/5] Update Signed-off-by: Pablo Garrido --- .../library_generation/library_generation.sh | 2 +- .../library_generation/library_generation.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/microros_static_library/library_generation/library_generation.sh b/microros_static_library/library_generation/library_generation.sh index e145efd..7488c1b 100755 --- a/microros_static_library/library_generation/library_generation.sh +++ b/microros_static_library/library_generation/library_generation.sh @@ -68,7 +68,7 @@ cp -R firmware/build/include/* $BASE_PATH/libmicroros/microros_include/ cp -R firmware/build/libmicroros.a $BASE_PATH/libmicroros/libmicroros.a ######## Fix include paths ######## -INCLUDE_ROS2_PACKAGES=( rmw rcl rcl_action rcl_lifecycle rcl_logging_interface ) +INCLUDE_ROS2_PACKAGES=( rmw rcl rcl_action rcl_lifecycle rcl_logging_interface rosidl_runtime_c rosidl_typesupport_interface) for var in "${INCLUDE_ROS2_PACKAGES[@]}"; do mv $BASE_PATH/libmicroros/microros_include/${var}/${var}/* $BASE_PATH/libmicroros/microros_include/${var} rm -rf $BASE_PATH/libmicroros/microros_include/${var}/${var} diff --git a/microros_static_library_ide/library_generation/library_generation.sh b/microros_static_library_ide/library_generation/library_generation.sh index a9d8d8d..9a83d23 100755 --- a/microros_static_library_ide/library_generation/library_generation.sh +++ b/microros_static_library_ide/library_generation/library_generation.sh @@ -75,7 +75,7 @@ cp -R firmware/build/include/* $BASE_PATH/libmicroros/include/ cp -R firmware/build/libmicroros.a $BASE_PATH/libmicroros/libmicroros.a ######## Fix include paths ######## -INCLUDE_ROS2_PACKAGES=( rmw rcl rcl_action rcl_lifecycle rcl_logging_interface ) +INCLUDE_ROS2_PACKAGES=( rmw rcl rcl_action rcl_lifecycle rcl_logging_interface rosidl_runtime_c rosidl_typesupport_interface) for var in "${INCLUDE_ROS2_PACKAGES[@]}"; do mv $BASE_PATH/libmicroros/include/${var}/${var}/* $BASE_PATH/libmicroros/include/${var} rm -rf $BASE_PATH/libmicroros/include/${var}/${var} From 2194ce4a01ab66463e01a79abcd2c67e724c095a Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Wed, 30 Mar 2022 10:31:05 +0200 Subject: [PATCH 3/5] Update Signed-off-by: Pablo Garrido --- .../library_generation/library_generation.sh | 10 +++++++--- .../library_generation/library_generation.sh | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/microros_static_library/library_generation/library_generation.sh b/microros_static_library/library_generation/library_generation.sh index 7488c1b..4fa58b9 100755 --- a/microros_static_library/library_generation/library_generation.sh +++ b/microros_static_library/library_generation/library_generation.sh @@ -68,9 +68,13 @@ cp -R firmware/build/include/* $BASE_PATH/libmicroros/microros_include/ cp -R firmware/build/libmicroros.a $BASE_PATH/libmicroros/libmicroros.a ######## Fix include paths ######## -INCLUDE_ROS2_PACKAGES=( rmw rcl rcl_action rcl_lifecycle rcl_logging_interface rosidl_runtime_c rosidl_typesupport_interface) -for var in "${INCLUDE_ROS2_PACKAGES[@]}"; do - mv $BASE_PATH/libmicroros/microros_include/${var}/${var}/* $BASE_PATH/libmicroros/microros_include/${var} +pushd firmware/mcu_ws > /dev/null + INCLUDE_ROS2_PACKAGES=$(colcon list | awk '{print $1}' | awk -v d=" " '{s=(NR==1?s:s d)$0}END{print s}') +popd > /dev/null + +apt -y install rsync +for var in ${INCLUDE_ROS2_PACKAGES}; do + rsync -r $BASE_PATH/libmicroros/microros_include/${var}/${var}/* $BASE_PATH/libmicroros/microros_include/${var}/ rm -rf $BASE_PATH/libmicroros/microros_include/${var}/${var} done diff --git a/microros_static_library_ide/library_generation/library_generation.sh b/microros_static_library_ide/library_generation/library_generation.sh index 9a83d23..c613a01 100755 --- a/microros_static_library_ide/library_generation/library_generation.sh +++ b/microros_static_library_ide/library_generation/library_generation.sh @@ -75,9 +75,13 @@ cp -R firmware/build/include/* $BASE_PATH/libmicroros/include/ cp -R firmware/build/libmicroros.a $BASE_PATH/libmicroros/libmicroros.a ######## Fix include paths ######## -INCLUDE_ROS2_PACKAGES=( rmw rcl rcl_action rcl_lifecycle rcl_logging_interface rosidl_runtime_c rosidl_typesupport_interface) -for var in "${INCLUDE_ROS2_PACKAGES[@]}"; do - mv $BASE_PATH/libmicroros/include/${var}/${var}/* $BASE_PATH/libmicroros/include/${var} +pushd firmware/mcu_ws > /dev/null + INCLUDE_ROS2_PACKAGES=$(colcon list | awk '{print $1}' | awk -v d=" " '{s=(NR==1?s:s d)$0}END{print s}') +popd > /dev/null + +apt -y install rsync +for var in ${INCLUDE_ROS2_PACKAGES}; do + rsync -r $BASE_PATH/libmicroros/include/${var}/${var}/* $BASE_PATH/libmicroros/include/${var} rm -rf $BASE_PATH/libmicroros/include/${var}/${var} done From 6dabfd3718c72188fafd41cb69efa185bc46f78f Mon Sep 17 00:00:00 2001 From: acuadros95 Date: Wed, 30 Mar 2022 12:34:40 +0200 Subject: [PATCH 4/5] Remove apt install --- .../library_generation/library_generation.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/microros_static_library/library_generation/library_generation.sh b/microros_static_library/library_generation/library_generation.sh index 4fa58b9..620d313 100755 --- a/microros_static_library/library_generation/library_generation.sh +++ b/microros_static_library/library_generation/library_generation.sh @@ -72,10 +72,11 @@ pushd firmware/mcu_ws > /dev/null INCLUDE_ROS2_PACKAGES=$(colcon list | awk '{print $1}' | awk -v d=" " '{s=(NR==1?s:s d)$0}END{print s}') popd > /dev/null -apt -y install rsync for var in ${INCLUDE_ROS2_PACKAGES}; do - rsync -r $BASE_PATH/libmicroros/microros_include/${var}/${var}/* $BASE_PATH/libmicroros/microros_include/${var}/ - rm -rf $BASE_PATH/libmicroros/microros_include/${var}/${var} + if [ -d "$BASE_PATH/libmicroros/microros_include/${var}/${var}" ]; then + rsync -r $BASE_PATH/libmicroros/microros_include/${var}/${var}/* $BASE_PATH/libmicroros/microros_include/${var} + rm -rf $BASE_PATH/libmicroros/microros_include/${var}/${var} + fi done ######## Generate extra files ######## From 1506593c86d651b3b5d5cdb9b1d487e86cf87aaf Mon Sep 17 00:00:00 2001 From: acuadros95 Date: Wed, 30 Mar 2022 12:38:18 +0200 Subject: [PATCH 5/5] Add directory check on cubeide --- .../library_generation/library_generation.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/microros_static_library_ide/library_generation/library_generation.sh b/microros_static_library_ide/library_generation/library_generation.sh index c613a01..5d4efc8 100755 --- a/microros_static_library_ide/library_generation/library_generation.sh +++ b/microros_static_library_ide/library_generation/library_generation.sh @@ -79,10 +79,11 @@ pushd firmware/mcu_ws > /dev/null INCLUDE_ROS2_PACKAGES=$(colcon list | awk '{print $1}' | awk -v d=" " '{s=(NR==1?s:s d)$0}END{print s}') popd > /dev/null -apt -y install rsync for var in ${INCLUDE_ROS2_PACKAGES}; do - rsync -r $BASE_PATH/libmicroros/include/${var}/${var}/* $BASE_PATH/libmicroros/include/${var} - rm -rf $BASE_PATH/libmicroros/include/${var}/${var} + if [ -d "$BASE_PATH/libmicroros/include/${var}/${var}" ]; then + rsync -r $BASE_PATH/libmicroros/include/${var}/${var}/* $BASE_PATH/libmicroros/include/${var} + rm -rf $BASE_PATH/libmicroros/include/${var}/${var} + fi done ######## Generate extra files ########