From d019cc6820ffdc3b4592ec6d7e1a1751e295e53a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tuy=E1=BA=BFt?= Date: Sun, 4 Jun 2023 16:59:29 -0500 Subject: [PATCH 1/4] added velodyne lidar package --- .vscode/settings.json | 12 ++ .../share/buoy_detection/package.sh | 2 +- .../share/colcon-core/packages/buoy_detection | 2 +- install/local_setup.sh | 2 +- install/setup.sh | 2 +- .../velodyne-lidar/hook/ament_prefix_path.dsv | 1 + .../velodyne-lidar/hook/ament_prefix_path.ps1 | 3 + .../velodyne-lidar/hook/ament_prefix_path.sh | 3 + .../resource_index/packages/velodyne_lidar | 0 .../share/colcon-core/packages/velodyne_lidar | 1 + .../velodyne_lidar/hook/ament_prefix_path.dsv | 1 + .../velodyne_lidar/hook/ament_prefix_path.ps1 | 3 + .../velodyne_lidar/hook/ament_prefix_path.sh | 3 + .../share/velodyne_lidar/hook/pythonpath.dsv | 1 + .../share/velodyne_lidar/hook/pythonpath.ps1 | 3 + .../share/velodyne_lidar/hook/pythonpath.sh | 3 + .../share/velodyne_lidar/package.bash | 31 +++++ .../share/velodyne_lidar/package.dsv | 6 + .../share/velodyne_lidar/package.ps1 | 116 ++++++++++++++++++ .../share/velodyne_lidar/package.sh | 87 +++++++++++++ .../share/velodyne_lidar/package.xml | 21 ++++ .../share/velodyne_lidar/package.zsh | 42 +++++++ src/velodyne_lidar/package.xml | 21 ++++ src/velodyne_lidar/resource/velodyne_lidar | 0 src/velodyne_lidar/setup.cfg | 4 + src/velodyne_lidar/setup.py | 26 ++++ src/velodyne_lidar/test/test_copyright.py | 25 ++++ src/velodyne_lidar/test/test_flake8.py | 25 ++++ src/velodyne_lidar/test/test_pep257.py | 23 ++++ src/velodyne_lidar/velodyne_lidar/__init__.py | 0 .../velodyne_lidar/subscriber.py | 29 +++++ 31 files changed, 494 insertions(+), 4 deletions(-) create mode 100644 install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.dsv create mode 100644 install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.ps1 create mode 100644 install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.sh create mode 100644 install/velodyne_lidar/share/ament_index/resource_index/packages/velodyne_lidar create mode 100644 install/velodyne_lidar/share/colcon-core/packages/velodyne_lidar create mode 100644 install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.dsv create mode 100644 install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.ps1 create mode 100644 install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.sh create mode 100644 install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.dsv create mode 100644 install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.ps1 create mode 100644 install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.sh create mode 100644 install/velodyne_lidar/share/velodyne_lidar/package.bash create mode 100644 install/velodyne_lidar/share/velodyne_lidar/package.dsv create mode 100644 install/velodyne_lidar/share/velodyne_lidar/package.ps1 create mode 100644 install/velodyne_lidar/share/velodyne_lidar/package.sh create mode 100644 install/velodyne_lidar/share/velodyne_lidar/package.xml create mode 100644 install/velodyne_lidar/share/velodyne_lidar/package.zsh create mode 100644 src/velodyne_lidar/package.xml create mode 100644 src/velodyne_lidar/resource/velodyne_lidar create mode 100644 src/velodyne_lidar/setup.cfg create mode 100644 src/velodyne_lidar/setup.py create mode 100644 src/velodyne_lidar/test/test_copyright.py create mode 100644 src/velodyne_lidar/test/test_flake8.py create mode 100644 src/velodyne_lidar/test/test_pep257.py create mode 100644 src/velodyne_lidar/velodyne_lidar/__init__.py create mode 100755 src/velodyne_lidar/velodyne_lidar/subscriber.py diff --git a/.vscode/settings.json b/.vscode/settings.json index 8f97d1a..57e3c3a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,5 +9,17 @@ "njpwerner", "pylance", "wslg" + ], + "python.autoComplete.extraPaths": [ + "/home/fusha153/Documents/ROS2-Docker-Development/install/velodyne_lidar/lib/python3.10/site-packages", + "/home/fusha153/Documents/ROS2-Docker-Development/install/buoy_detection/lib/python3.10/site-packages", + "/opt/ros/humble/lib/python3.10/site-packages", + "/opt/ros/humble/local/lib/python3.10/dist-packages" + ], + "python.analysis.extraPaths": [ + "/home/fusha153/Documents/ROS2-Docker-Development/install/velodyne_lidar/lib/python3.10/site-packages", + "/home/fusha153/Documents/ROS2-Docker-Development/install/buoy_detection/lib/python3.10/site-packages", + "/opt/ros/humble/lib/python3.10/site-packages", + "/opt/ros/humble/local/lib/python3.10/dist-packages" ] } \ No newline at end of file diff --git a/install/buoy_detection/share/buoy_detection/package.sh b/install/buoy_detection/share/buoy_detection/package.sh index e555e28..1251cdc 100644 --- a/install/buoy_detection/share/buoy_detection/package.sh +++ b/install/buoy_detection/share/buoy_detection/package.sh @@ -52,7 +52,7 @@ _colcon_prepend_unique_value() { # since a plain shell script can't determine its own path when being sourced # either use the provided COLCON_CURRENT_PREFIX # or fall back to the build time prefix (if it exists) -_colcon_package_sh_COLCON_CURRENT_PREFIX="/root/colcon_workspace/install/buoy_detection" +_colcon_package_sh_COLCON_CURRENT_PREFIX="/home/fusha153/Documents/ROS2-Docker-Development/install/buoy_detection" if [ -z "$COLCON_CURRENT_PREFIX" ]; then if [ ! -d "$_colcon_package_sh_COLCON_CURRENT_PREFIX" ]; then echo "The build time path \"$_colcon_package_sh_COLCON_CURRENT_PREFIX\" doesn't exist. Either source a script for a different shell or set the environment variable \"COLCON_CURRENT_PREFIX\" explicitly." 1>&2 diff --git a/install/buoy_detection/share/colcon-core/packages/buoy_detection b/install/buoy_detection/share/colcon-core/packages/buoy_detection index a1136f2..29f19e7 100644 --- a/install/buoy_detection/share/colcon-core/packages/buoy_detection +++ b/install/buoy_detection/share/colcon-core/packages/buoy_detection @@ -1 +1 @@ -python3-torch:python3-torchvision:python3-ultralytics \ No newline at end of file +python-pytorch-pip \ No newline at end of file diff --git a/install/local_setup.sh b/install/local_setup.sh index cd1b1c8..df28cb3 100644 --- a/install/local_setup.sh +++ b/install/local_setup.sh @@ -6,7 +6,7 @@ # since a plain shell script can't determine its own path when being sourced # either use the provided COLCON_CURRENT_PREFIX # or fall back to the build time prefix (if it exists) -_colcon_prefix_sh_COLCON_CURRENT_PREFIX="/root/colcon_workspace/install" +_colcon_prefix_sh_COLCON_CURRENT_PREFIX="/home/fusha153/Documents/ROS2-Docker-Development/install" if [ -z "$COLCON_CURRENT_PREFIX" ]; then if [ ! -d "$_colcon_prefix_sh_COLCON_CURRENT_PREFIX" ]; then echo "The build time path \"$_colcon_prefix_sh_COLCON_CURRENT_PREFIX\" doesn't exist. Either source a script for a different shell or set the environment variable \"COLCON_CURRENT_PREFIX\" explicitly." 1>&2 diff --git a/install/setup.sh b/install/setup.sh index 5c67361..aadf21d 100644 --- a/install/setup.sh +++ b/install/setup.sh @@ -7,7 +7,7 @@ # since a plain shell script can't determine its own path when being sourced # either use the provided COLCON_CURRENT_PREFIX # or fall back to the build time prefix (if it exists) -_colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX=/root/colcon_workspace/install +_colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX=/home/fusha153/Documents/ROS2-Docker-Development/install if [ ! -z "$COLCON_CURRENT_PREFIX" ]; then _colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX" elif [ ! -d "$_colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX" ]; then diff --git a/install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.dsv b/install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.dsv new file mode 100644 index 0000000..79d4c95 --- /dev/null +++ b/install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.dsv @@ -0,0 +1 @@ +prepend-non-duplicate;AMENT_PREFIX_PATH; diff --git a/install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.ps1 b/install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.ps1 new file mode 100644 index 0000000..26b9997 --- /dev/null +++ b/install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.ps1 @@ -0,0 +1,3 @@ +# generated from colcon_powershell/shell/template/hook_prepend_value.ps1.em + +colcon_prepend_unique_value AMENT_PREFIX_PATH "$env:COLCON_CURRENT_PREFIX" diff --git a/install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.sh b/install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.sh new file mode 100644 index 0000000..f3041f6 --- /dev/null +++ b/install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.sh @@ -0,0 +1,3 @@ +# generated from colcon_core/shell/template/hook_prepend_value.sh.em + +_colcon_prepend_unique_value AMENT_PREFIX_PATH "$COLCON_CURRENT_PREFIX" diff --git a/install/velodyne_lidar/share/ament_index/resource_index/packages/velodyne_lidar b/install/velodyne_lidar/share/ament_index/resource_index/packages/velodyne_lidar new file mode 100644 index 0000000..e69de29 diff --git a/install/velodyne_lidar/share/colcon-core/packages/velodyne_lidar b/install/velodyne_lidar/share/colcon-core/packages/velodyne_lidar new file mode 100644 index 0000000..4bc9f3d --- /dev/null +++ b/install/velodyne_lidar/share/colcon-core/packages/velodyne_lidar @@ -0,0 +1 @@ +rclpy:sensor_msgs \ No newline at end of file diff --git a/install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.dsv b/install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.dsv new file mode 100644 index 0000000..79d4c95 --- /dev/null +++ b/install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.dsv @@ -0,0 +1 @@ +prepend-non-duplicate;AMENT_PREFIX_PATH; diff --git a/install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.ps1 b/install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.ps1 new file mode 100644 index 0000000..26b9997 --- /dev/null +++ b/install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.ps1 @@ -0,0 +1,3 @@ +# generated from colcon_powershell/shell/template/hook_prepend_value.ps1.em + +colcon_prepend_unique_value AMENT_PREFIX_PATH "$env:COLCON_CURRENT_PREFIX" diff --git a/install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.sh b/install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.sh new file mode 100644 index 0000000..f3041f6 --- /dev/null +++ b/install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.sh @@ -0,0 +1,3 @@ +# generated from colcon_core/shell/template/hook_prepend_value.sh.em + +_colcon_prepend_unique_value AMENT_PREFIX_PATH "$COLCON_CURRENT_PREFIX" diff --git a/install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.dsv b/install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.dsv new file mode 100644 index 0000000..257067d --- /dev/null +++ b/install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.dsv @@ -0,0 +1 @@ +prepend-non-duplicate;PYTHONPATH;lib/python3.10/site-packages diff --git a/install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.ps1 b/install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.ps1 new file mode 100644 index 0000000..caffe83 --- /dev/null +++ b/install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.ps1 @@ -0,0 +1,3 @@ +# generated from colcon_powershell/shell/template/hook_prepend_value.ps1.em + +colcon_prepend_unique_value PYTHONPATH "$env:COLCON_CURRENT_PREFIX\lib/python3.10/site-packages" diff --git a/install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.sh b/install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.sh new file mode 100644 index 0000000..660c348 --- /dev/null +++ b/install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.sh @@ -0,0 +1,3 @@ +# generated from colcon_core/shell/template/hook_prepend_value.sh.em + +_colcon_prepend_unique_value PYTHONPATH "$COLCON_CURRENT_PREFIX/lib/python3.10/site-packages" diff --git a/install/velodyne_lidar/share/velodyne_lidar/package.bash b/install/velodyne_lidar/share/velodyne_lidar/package.bash new file mode 100644 index 0000000..5eeb61d --- /dev/null +++ b/install/velodyne_lidar/share/velodyne_lidar/package.bash @@ -0,0 +1,31 @@ +# generated from colcon_bash/shell/template/package.bash.em + +# This script extends the environment for this package. + +# a bash script is able to determine its own path if necessary +if [ -z "$COLCON_CURRENT_PREFIX" ]; then + # the prefix is two levels up from the package specific share directory + _colcon_package_bash_COLCON_CURRENT_PREFIX="$(builtin cd "`dirname "${BASH_SOURCE[0]}"`/../.." > /dev/null && pwd)" +else + _colcon_package_bash_COLCON_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX" +fi + +# function to source another script with conditional trace output +# first argument: the path of the script +# additional arguments: arguments to the script +_colcon_package_bash_source_script() { + if [ -f "$1" ]; then + if [ -n "$COLCON_TRACE" ]; then + echo ". \"$1\"" + fi + . "$@" + else + echo "not found: \"$1\"" 1>&2 + fi +} + +# source sh script of this package +_colcon_package_bash_source_script "$_colcon_package_bash_COLCON_CURRENT_PREFIX/share/velodyne_lidar/package.sh" + +unset _colcon_package_bash_source_script +unset _colcon_package_bash_COLCON_CURRENT_PREFIX diff --git a/install/velodyne_lidar/share/velodyne_lidar/package.dsv b/install/velodyne_lidar/share/velodyne_lidar/package.dsv new file mode 100644 index 0000000..d83fa83 --- /dev/null +++ b/install/velodyne_lidar/share/velodyne_lidar/package.dsv @@ -0,0 +1,6 @@ +source;share/velodyne_lidar/hook/pythonpath.ps1 +source;share/velodyne_lidar/hook/pythonpath.dsv +source;share/velodyne_lidar/hook/pythonpath.sh +source;share/velodyne_lidar/hook/ament_prefix_path.ps1 +source;share/velodyne_lidar/hook/ament_prefix_path.dsv +source;share/velodyne_lidar/hook/ament_prefix_path.sh diff --git a/install/velodyne_lidar/share/velodyne_lidar/package.ps1 b/install/velodyne_lidar/share/velodyne_lidar/package.ps1 new file mode 100644 index 0000000..0b2ff5a --- /dev/null +++ b/install/velodyne_lidar/share/velodyne_lidar/package.ps1 @@ -0,0 +1,116 @@ +# generated from colcon_powershell/shell/template/package.ps1.em + +# function to append a value to a variable +# which uses colons as separators +# duplicates as well as leading separators are avoided +# first argument: the name of the result variable +# second argument: the value to be prepended +function colcon_append_unique_value { + param ( + $_listname, + $_value + ) + + # get values from variable + if (Test-Path Env:$_listname) { + $_values=(Get-Item env:$_listname).Value + } else { + $_values="" + } + $_duplicate="" + # start with no values + $_all_values="" + # iterate over existing values in the variable + if ($_values) { + $_values.Split(";") | ForEach { + # not an empty string + if ($_) { + # not a duplicate of _value + if ($_ -eq $_value) { + $_duplicate="1" + } + if ($_all_values) { + $_all_values="${_all_values};$_" + } else { + $_all_values="$_" + } + } + } + } + # append only non-duplicates + if (!$_duplicate) { + # avoid leading separator + if ($_all_values) { + $_all_values="${_all_values};${_value}" + } else { + $_all_values="${_value}" + } + } + + # export the updated variable + Set-Item env:\$_listname -Value "$_all_values" +} + +# function to prepend a value to a variable +# which uses colons as separators +# duplicates as well as trailing separators are avoided +# first argument: the name of the result variable +# second argument: the value to be prepended +function colcon_prepend_unique_value { + param ( + $_listname, + $_value + ) + + # get values from variable + if (Test-Path Env:$_listname) { + $_values=(Get-Item env:$_listname).Value + } else { + $_values="" + } + # start with the new value + $_all_values="$_value" + # iterate over existing values in the variable + if ($_values) { + $_values.Split(";") | ForEach { + # not an empty string + if ($_) { + # not a duplicate of _value + if ($_ -ne $_value) { + # keep non-duplicate values + $_all_values="${_all_values};$_" + } + } + } + } + # export the updated variable + Set-Item env:\$_listname -Value "$_all_values" +} + +# function to source another script with conditional trace output +# first argument: the path of the script +# additional arguments: arguments to the script +function colcon_package_source_powershell_script { + param ( + $_colcon_package_source_powershell_script + ) + # source script with conditional trace output + if (Test-Path $_colcon_package_source_powershell_script) { + if ($env:COLCON_TRACE) { + echo ". '$_colcon_package_source_powershell_script'" + } + . "$_colcon_package_source_powershell_script" + } else { + Write-Error "not found: '$_colcon_package_source_powershell_script'" + } +} + + +# a powershell script is able to determine its own path +# the prefix is two levels up from the package specific share directory +$env:COLCON_CURRENT_PREFIX=(Get-Item $PSCommandPath).Directory.Parent.Parent.FullName + +colcon_package_source_powershell_script "$env:COLCON_CURRENT_PREFIX\share/velodyne_lidar/hook/pythonpath.ps1" +colcon_package_source_powershell_script "$env:COLCON_CURRENT_PREFIX\share/velodyne_lidar/hook/ament_prefix_path.ps1" + +Remove-Item Env:\COLCON_CURRENT_PREFIX diff --git a/install/velodyne_lidar/share/velodyne_lidar/package.sh b/install/velodyne_lidar/share/velodyne_lidar/package.sh new file mode 100644 index 0000000..c4d8adc --- /dev/null +++ b/install/velodyne_lidar/share/velodyne_lidar/package.sh @@ -0,0 +1,87 @@ +# generated from colcon_core/shell/template/package.sh.em + +# This script extends the environment for this package. + +# function to prepend a value to a variable +# which uses colons as separators +# duplicates as well as trailing separators are avoided +# first argument: the name of the result variable +# second argument: the value to be prepended +_colcon_prepend_unique_value() { + # arguments + _listname="$1" + _value="$2" + + # get values from variable + eval _values=\"\$$_listname\" + # backup the field separator + _colcon_prepend_unique_value_IFS=$IFS + IFS=":" + # start with the new value + _all_values="$_value" + # workaround SH_WORD_SPLIT not being set in zsh + if [ "$(command -v colcon_zsh_convert_to_array)" ]; then + colcon_zsh_convert_to_array _values + fi + # iterate over existing values in the variable + for _item in $_values; do + # ignore empty strings + if [ -z "$_item" ]; then + continue + fi + # ignore duplicates of _value + if [ "$_item" = "$_value" ]; then + continue + fi + # keep non-duplicate values + _all_values="$_all_values:$_item" + done + unset _item + # restore the field separator + IFS=$_colcon_prepend_unique_value_IFS + unset _colcon_prepend_unique_value_IFS + # export the updated variable + eval export $_listname=\"$_all_values\" + unset _all_values + unset _values + + unset _value + unset _listname +} + +# since a plain shell script can't determine its own path when being sourced +# either use the provided COLCON_CURRENT_PREFIX +# or fall back to the build time prefix (if it exists) +_colcon_package_sh_COLCON_CURRENT_PREFIX="/home/fusha153/Documents/ROS2-Docker-Development/install/velodyne_lidar" +if [ -z "$COLCON_CURRENT_PREFIX" ]; then + if [ ! -d "$_colcon_package_sh_COLCON_CURRENT_PREFIX" ]; then + echo "The build time path \"$_colcon_package_sh_COLCON_CURRENT_PREFIX\" doesn't exist. Either source a script for a different shell or set the environment variable \"COLCON_CURRENT_PREFIX\" explicitly." 1>&2 + unset _colcon_package_sh_COLCON_CURRENT_PREFIX + return 1 + fi + COLCON_CURRENT_PREFIX="$_colcon_package_sh_COLCON_CURRENT_PREFIX" +fi +unset _colcon_package_sh_COLCON_CURRENT_PREFIX + +# function to source another script with conditional trace output +# first argument: the path of the script +# additional arguments: arguments to the script +_colcon_package_sh_source_script() { + if [ -f "$1" ]; then + if [ -n "$COLCON_TRACE" ]; then + echo "# . \"$1\"" + fi + . "$@" + else + echo "not found: \"$1\"" 1>&2 + fi +} + +# source sh hooks +_colcon_package_sh_source_script "$COLCON_CURRENT_PREFIX/share/velodyne_lidar/hook/pythonpath.sh" +_colcon_package_sh_source_script "$COLCON_CURRENT_PREFIX/share/velodyne_lidar/hook/ament_prefix_path.sh" + +unset _colcon_package_sh_source_script +unset COLCON_CURRENT_PREFIX + +# do not unset _colcon_prepend_unique_value since it might be used by non-primary shell hooks diff --git a/install/velodyne_lidar/share/velodyne_lidar/package.xml b/install/velodyne_lidar/share/velodyne_lidar/package.xml new file mode 100644 index 0000000..544169f --- /dev/null +++ b/install/velodyne_lidar/share/velodyne_lidar/package.xml @@ -0,0 +1,21 @@ + + + + velodyne_lidar + 0.0.0 + ROS2 package that subscribes to the Velodynes PointCloud topic. + fusha153 + TODO: License declaration + + rclpy + sensor_msgs + + ament_copyright + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/install/velodyne_lidar/share/velodyne_lidar/package.zsh b/install/velodyne_lidar/share/velodyne_lidar/package.zsh new file mode 100644 index 0000000..76c2586 --- /dev/null +++ b/install/velodyne_lidar/share/velodyne_lidar/package.zsh @@ -0,0 +1,42 @@ +# generated from colcon_zsh/shell/template/package.zsh.em + +# This script extends the environment for this package. + +# a zsh script is able to determine its own path if necessary +if [ -z "$COLCON_CURRENT_PREFIX" ]; then + # the prefix is two levels up from the package specific share directory + _colcon_package_zsh_COLCON_CURRENT_PREFIX="$(builtin cd -q "`dirname "${(%):-%N}"`/../.." > /dev/null && pwd)" +else + _colcon_package_zsh_COLCON_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX" +fi + +# function to source another script with conditional trace output +# first argument: the path of the script +# additional arguments: arguments to the script +_colcon_package_zsh_source_script() { + if [ -f "$1" ]; then + if [ -n "$COLCON_TRACE" ]; then + echo ". \"$1\"" + fi + . "$@" + else + echo "not found: \"$1\"" 1>&2 + fi +} + +# function to convert array-like strings into arrays +# to workaround SH_WORD_SPLIT not being set +colcon_zsh_convert_to_array() { + local _listname=$1 + local _dollar="$" + local _split="{=" + local _to_array="(\"$_dollar$_split$_listname}\")" + eval $_listname=$_to_array +} + +# source sh script of this package +_colcon_package_zsh_source_script "$_colcon_package_zsh_COLCON_CURRENT_PREFIX/share/velodyne_lidar/package.sh" +unset convert_zsh_to_array + +unset _colcon_package_zsh_source_script +unset _colcon_package_zsh_COLCON_CURRENT_PREFIX diff --git a/src/velodyne_lidar/package.xml b/src/velodyne_lidar/package.xml new file mode 100644 index 0000000..544169f --- /dev/null +++ b/src/velodyne_lidar/package.xml @@ -0,0 +1,21 @@ + + + + velodyne_lidar + 0.0.0 + ROS2 package that subscribes to the Velodynes PointCloud topic. + fusha153 + TODO: License declaration + + rclpy + sensor_msgs + + ament_copyright + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/src/velodyne_lidar/resource/velodyne_lidar b/src/velodyne_lidar/resource/velodyne_lidar new file mode 100644 index 0000000..e69de29 diff --git a/src/velodyne_lidar/setup.cfg b/src/velodyne_lidar/setup.cfg new file mode 100644 index 0000000..8ea39f6 --- /dev/null +++ b/src/velodyne_lidar/setup.cfg @@ -0,0 +1,4 @@ +[develop] +script_dir=$base/lib/velodyne_lidar +[install] +install_scripts=$base/lib/velodyne_lidar diff --git a/src/velodyne_lidar/setup.py b/src/velodyne_lidar/setup.py new file mode 100644 index 0000000..be58f07 --- /dev/null +++ b/src/velodyne_lidar/setup.py @@ -0,0 +1,26 @@ +from setuptools import setup + +package_name = 'velodyne_lidar' + +setup( + name=package_name, + version='0.0.0', + packages=[package_name], + data_files=[ + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ('share/' + package_name, ['package.xml']), + ], + install_requires=['setuptools'], + zip_safe=True, + maintainer='fusha153', + maintainer_email='pipandw@gmail.com', + description='ROS2 package that subscribes to the Velodynes PointCloud topic.', + license='TODO: License declaration', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + 'subscriber = velodyne_lidar.subscriber:main' + ], + }, +) diff --git a/src/velodyne_lidar/test/test_copyright.py b/src/velodyne_lidar/test/test_copyright.py new file mode 100644 index 0000000..97a3919 --- /dev/null +++ b/src/velodyne_lidar/test/test_copyright.py @@ -0,0 +1,25 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# 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. + +from ament_copyright.main import main +import pytest + + +# Remove the `skip` decorator once the source file(s) have a copyright header +@pytest.mark.skip(reason='No copyright header has been placed in the generated source file.') +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found errors' diff --git a/src/velodyne_lidar/test/test_flake8.py b/src/velodyne_lidar/test/test_flake8.py new file mode 100644 index 0000000..27ee107 --- /dev/null +++ b/src/velodyne_lidar/test/test_flake8.py @@ -0,0 +1,25 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# 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. + +from ament_flake8.main import main_with_errors +import pytest + + +@pytest.mark.flake8 +@pytest.mark.linter +def test_flake8(): + rc, errors = main_with_errors(argv=[]) + assert rc == 0, \ + 'Found %d code style errors / warnings:\n' % len(errors) + \ + '\n'.join(errors) diff --git a/src/velodyne_lidar/test/test_pep257.py b/src/velodyne_lidar/test/test_pep257.py new file mode 100644 index 0000000..b234a38 --- /dev/null +++ b/src/velodyne_lidar/test/test_pep257.py @@ -0,0 +1,23 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# 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. + +from ament_pep257.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.pep257 +def test_pep257(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found code style errors / warnings' diff --git a/src/velodyne_lidar/velodyne_lidar/__init__.py b/src/velodyne_lidar/velodyne_lidar/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/velodyne_lidar/velodyne_lidar/subscriber.py b/src/velodyne_lidar/velodyne_lidar/subscriber.py new file mode 100755 index 0000000..7c9a847 --- /dev/null +++ b/src/velodyne_lidar/velodyne_lidar/subscriber.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 + +import rclpy +from rclpy.node import Node + +from sensor_msgs.msg import PointCloud2 + +class mynode(Node): + + def __init__(self): + super().__init__('subscriber') + self.pose_subscriber_ = self.create_subscription( + PointCloud2, + 'velodyne_points', + self.callback, + 10) + def callback(self, msg: PointCloud2): + self.get_logger().info(str(msg)) + + +def main(args=None): + rclpy.init(args=args) + node = mynode() + rclpy.spin(node) + rclpy.shutdown() + + +if __name__ == '__main__': + main() From f02643b1b2b5f0d3e9c4f90fbc867fbf2149ed22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tuy=E1=BA=BFt?= Date: Wed, 14 Jun 2023 14:01:11 -0500 Subject: [PATCH 2/4] added package setup files --- install/buoy_detection/share/buoy_detection/package.sh | 2 +- install/local_setup.sh | 2 +- install/setup.sh | 2 +- install/velodyne_lidar/share/velodyne_lidar/package.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/install/buoy_detection/share/buoy_detection/package.sh b/install/buoy_detection/share/buoy_detection/package.sh index 1251cdc..50adb9f 100644 --- a/install/buoy_detection/share/buoy_detection/package.sh +++ b/install/buoy_detection/share/buoy_detection/package.sh @@ -52,7 +52,7 @@ _colcon_prepend_unique_value() { # since a plain shell script can't determine its own path when being sourced # either use the provided COLCON_CURRENT_PREFIX # or fall back to the build time prefix (if it exists) -_colcon_package_sh_COLCON_CURRENT_PREFIX="/home/fusha153/Documents/ROS2-Docker-Development/install/buoy_detection" +_colcon_package_sh_COLCON_CURRENT_PREFIX="/home/fusha153/Documents/Roboboat/ROS2-Docker-Development/install/buoy_detection" if [ -z "$COLCON_CURRENT_PREFIX" ]; then if [ ! -d "$_colcon_package_sh_COLCON_CURRENT_PREFIX" ]; then echo "The build time path \"$_colcon_package_sh_COLCON_CURRENT_PREFIX\" doesn't exist. Either source a script for a different shell or set the environment variable \"COLCON_CURRENT_PREFIX\" explicitly." 1>&2 diff --git a/install/local_setup.sh b/install/local_setup.sh index df28cb3..5d9bf15 100644 --- a/install/local_setup.sh +++ b/install/local_setup.sh @@ -6,7 +6,7 @@ # since a plain shell script can't determine its own path when being sourced # either use the provided COLCON_CURRENT_PREFIX # or fall back to the build time prefix (if it exists) -_colcon_prefix_sh_COLCON_CURRENT_PREFIX="/home/fusha153/Documents/ROS2-Docker-Development/install" +_colcon_prefix_sh_COLCON_CURRENT_PREFIX="/home/fusha153/Documents/Roboboat/ROS2-Docker-Development/install" if [ -z "$COLCON_CURRENT_PREFIX" ]; then if [ ! -d "$_colcon_prefix_sh_COLCON_CURRENT_PREFIX" ]; then echo "The build time path \"$_colcon_prefix_sh_COLCON_CURRENT_PREFIX\" doesn't exist. Either source a script for a different shell or set the environment variable \"COLCON_CURRENT_PREFIX\" explicitly." 1>&2 diff --git a/install/setup.sh b/install/setup.sh index aadf21d..0eaac58 100644 --- a/install/setup.sh +++ b/install/setup.sh @@ -7,7 +7,7 @@ # since a plain shell script can't determine its own path when being sourced # either use the provided COLCON_CURRENT_PREFIX # or fall back to the build time prefix (if it exists) -_colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX=/home/fusha153/Documents/ROS2-Docker-Development/install +_colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX=/home/fusha153/Documents/Roboboat/ROS2-Docker-Development/install if [ ! -z "$COLCON_CURRENT_PREFIX" ]; then _colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX" elif [ ! -d "$_colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX" ]; then diff --git a/install/velodyne_lidar/share/velodyne_lidar/package.sh b/install/velodyne_lidar/share/velodyne_lidar/package.sh index c4d8adc..f5093d6 100644 --- a/install/velodyne_lidar/share/velodyne_lidar/package.sh +++ b/install/velodyne_lidar/share/velodyne_lidar/package.sh @@ -52,7 +52,7 @@ _colcon_prepend_unique_value() { # since a plain shell script can't determine its own path when being sourced # either use the provided COLCON_CURRENT_PREFIX # or fall back to the build time prefix (if it exists) -_colcon_package_sh_COLCON_CURRENT_PREFIX="/home/fusha153/Documents/ROS2-Docker-Development/install/velodyne_lidar" +_colcon_package_sh_COLCON_CURRENT_PREFIX="/home/fusha153/Documents/Roboboat/ROS2-Docker-Development/install/velodyne_lidar" if [ -z "$COLCON_CURRENT_PREFIX" ]; then if [ ! -d "$_colcon_package_sh_COLCON_CURRENT_PREFIX" ]; then echo "The build time path \"$_colcon_package_sh_COLCON_CURRENT_PREFIX\" doesn't exist. Either source a script for a different shell or set the environment variable \"COLCON_CURRENT_PREFIX\" explicitly." 1>&2 From 457ba29cee3ac68aae7f995ebab39315701cb162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tuy=E1=BA=BFt?= Date: Wed, 14 Jun 2023 14:52:02 -0500 Subject: [PATCH 3/4] fixed velodyne package node --- src/velodyne_lidar/velodyne_lidar/subscriber.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/velodyne_lidar/velodyne_lidar/subscriber.py b/src/velodyne_lidar/velodyne_lidar/subscriber.py index 7c9a847..babd7e3 100755 --- a/src/velodyne_lidar/velodyne_lidar/subscriber.py +++ b/src/velodyne_lidar/velodyne_lidar/subscriber.py @@ -11,7 +11,7 @@ def __init__(self): super().__init__('subscriber') self.pose_subscriber_ = self.create_subscription( PointCloud2, - 'velodyne_points', + "/velodyne_points", self.callback, 10) def callback(self, msg: PointCloud2): From ba566e2f2c3f5ac21969f55decf3b7b8f41ea5ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tuy=E1=BA=BFt?= Date: Thu, 22 Jun 2023 12:28:41 -0500 Subject: [PATCH 4/4] deleted install dir and changed some files --- .vscode/settings.json | 14 +-- .../velodyne-lidar/hook/ament_prefix_path.dsv | 1 - .../velodyne-lidar/hook/ament_prefix_path.ps1 | 3 - .../velodyne-lidar/hook/ament_prefix_path.sh | 3 - .../resource_index/packages/velodyne_lidar | 0 .../share/colcon-core/packages/velodyne_lidar | 1 - .../velodyne_lidar/hook/ament_prefix_path.dsv | 1 - .../velodyne_lidar/hook/ament_prefix_path.ps1 | 3 - .../velodyne_lidar/hook/ament_prefix_path.sh | 3 - .../share/velodyne_lidar/hook/pythonpath.dsv | 1 - .../share/velodyne_lidar/hook/pythonpath.ps1 | 3 - .../share/velodyne_lidar/hook/pythonpath.sh | 3 - .../share/velodyne_lidar/package.bash | 31 ----- .../share/velodyne_lidar/package.dsv | 6 - .../share/velodyne_lidar/package.ps1 | 116 ------------------ .../share/velodyne_lidar/package.sh | 87 ------------- .../share/velodyne_lidar/package.xml | 21 ---- .../share/velodyne_lidar/package.zsh | 42 ------- src/velodyne_lidar/package.xml | 2 +- src/velodyne_lidar/setup.py | 2 +- 20 files changed, 3 insertions(+), 340 deletions(-) delete mode 100644 install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.dsv delete mode 100644 install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.ps1 delete mode 100644 install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.sh delete mode 100644 install/velodyne_lidar/share/ament_index/resource_index/packages/velodyne_lidar delete mode 100644 install/velodyne_lidar/share/colcon-core/packages/velodyne_lidar delete mode 100644 install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.dsv delete mode 100644 install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.ps1 delete mode 100644 install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.sh delete mode 100644 install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.dsv delete mode 100644 install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.ps1 delete mode 100644 install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.sh delete mode 100644 install/velodyne_lidar/share/velodyne_lidar/package.bash delete mode 100644 install/velodyne_lidar/share/velodyne_lidar/package.dsv delete mode 100644 install/velodyne_lidar/share/velodyne_lidar/package.ps1 delete mode 100644 install/velodyne_lidar/share/velodyne_lidar/package.sh delete mode 100644 install/velodyne_lidar/share/velodyne_lidar/package.xml delete mode 100644 install/velodyne_lidar/share/velodyne_lidar/package.zsh diff --git a/.vscode/settings.json b/.vscode/settings.json index c5ae8ca..324d961 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,17 +13,5 @@ "njpwerner", "pylance", "wslg" - ], - "python.autoComplete.extraPaths": [ - "/home/fusha153/Documents/ROS2-Docker-Development/install/velodyne_lidar/lib/python3.10/site-packages", - "/home/fusha153/Documents/ROS2-Docker-Development/install/buoy_detection/lib/python3.10/site-packages", - "/opt/ros/humble/lib/python3.10/site-packages", - "/opt/ros/humble/local/lib/python3.10/dist-packages" - ], - "python.analysis.extraPaths": [ - "/home/fusha153/Documents/ROS2-Docker-Development/install/velodyne_lidar/lib/python3.10/site-packages", - "/home/fusha153/Documents/ROS2-Docker-Development/install/buoy_detection/lib/python3.10/site-packages", - "/opt/ros/humble/lib/python3.10/site-packages", - "/opt/ros/humble/local/lib/python3.10/dist-packages" ] -} \ No newline at end of file +} diff --git a/install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.dsv b/install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.dsv deleted file mode 100644 index 79d4c95..0000000 --- a/install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.dsv +++ /dev/null @@ -1 +0,0 @@ -prepend-non-duplicate;AMENT_PREFIX_PATH; diff --git a/install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.ps1 b/install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.ps1 deleted file mode 100644 index 26b9997..0000000 --- a/install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.ps1 +++ /dev/null @@ -1,3 +0,0 @@ -# generated from colcon_powershell/shell/template/hook_prepend_value.ps1.em - -colcon_prepend_unique_value AMENT_PREFIX_PATH "$env:COLCON_CURRENT_PREFIX" diff --git a/install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.sh b/install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.sh deleted file mode 100644 index f3041f6..0000000 --- a/install/velodyne-lidar/share/velodyne-lidar/hook/ament_prefix_path.sh +++ /dev/null @@ -1,3 +0,0 @@ -# generated from colcon_core/shell/template/hook_prepend_value.sh.em - -_colcon_prepend_unique_value AMENT_PREFIX_PATH "$COLCON_CURRENT_PREFIX" diff --git a/install/velodyne_lidar/share/ament_index/resource_index/packages/velodyne_lidar b/install/velodyne_lidar/share/ament_index/resource_index/packages/velodyne_lidar deleted file mode 100644 index e69de29..0000000 diff --git a/install/velodyne_lidar/share/colcon-core/packages/velodyne_lidar b/install/velodyne_lidar/share/colcon-core/packages/velodyne_lidar deleted file mode 100644 index 4bc9f3d..0000000 --- a/install/velodyne_lidar/share/colcon-core/packages/velodyne_lidar +++ /dev/null @@ -1 +0,0 @@ -rclpy:sensor_msgs \ No newline at end of file diff --git a/install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.dsv b/install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.dsv deleted file mode 100644 index 79d4c95..0000000 --- a/install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.dsv +++ /dev/null @@ -1 +0,0 @@ -prepend-non-duplicate;AMENT_PREFIX_PATH; diff --git a/install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.ps1 b/install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.ps1 deleted file mode 100644 index 26b9997..0000000 --- a/install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.ps1 +++ /dev/null @@ -1,3 +0,0 @@ -# generated from colcon_powershell/shell/template/hook_prepend_value.ps1.em - -colcon_prepend_unique_value AMENT_PREFIX_PATH "$env:COLCON_CURRENT_PREFIX" diff --git a/install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.sh b/install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.sh deleted file mode 100644 index f3041f6..0000000 --- a/install/velodyne_lidar/share/velodyne_lidar/hook/ament_prefix_path.sh +++ /dev/null @@ -1,3 +0,0 @@ -# generated from colcon_core/shell/template/hook_prepend_value.sh.em - -_colcon_prepend_unique_value AMENT_PREFIX_PATH "$COLCON_CURRENT_PREFIX" diff --git a/install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.dsv b/install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.dsv deleted file mode 100644 index 257067d..0000000 --- a/install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.dsv +++ /dev/null @@ -1 +0,0 @@ -prepend-non-duplicate;PYTHONPATH;lib/python3.10/site-packages diff --git a/install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.ps1 b/install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.ps1 deleted file mode 100644 index caffe83..0000000 --- a/install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.ps1 +++ /dev/null @@ -1,3 +0,0 @@ -# generated from colcon_powershell/shell/template/hook_prepend_value.ps1.em - -colcon_prepend_unique_value PYTHONPATH "$env:COLCON_CURRENT_PREFIX\lib/python3.10/site-packages" diff --git a/install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.sh b/install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.sh deleted file mode 100644 index 660c348..0000000 --- a/install/velodyne_lidar/share/velodyne_lidar/hook/pythonpath.sh +++ /dev/null @@ -1,3 +0,0 @@ -# generated from colcon_core/shell/template/hook_prepend_value.sh.em - -_colcon_prepend_unique_value PYTHONPATH "$COLCON_CURRENT_PREFIX/lib/python3.10/site-packages" diff --git a/install/velodyne_lidar/share/velodyne_lidar/package.bash b/install/velodyne_lidar/share/velodyne_lidar/package.bash deleted file mode 100644 index 5eeb61d..0000000 --- a/install/velodyne_lidar/share/velodyne_lidar/package.bash +++ /dev/null @@ -1,31 +0,0 @@ -# generated from colcon_bash/shell/template/package.bash.em - -# This script extends the environment for this package. - -# a bash script is able to determine its own path if necessary -if [ -z "$COLCON_CURRENT_PREFIX" ]; then - # the prefix is two levels up from the package specific share directory - _colcon_package_bash_COLCON_CURRENT_PREFIX="$(builtin cd "`dirname "${BASH_SOURCE[0]}"`/../.." > /dev/null && pwd)" -else - _colcon_package_bash_COLCON_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX" -fi - -# function to source another script with conditional trace output -# first argument: the path of the script -# additional arguments: arguments to the script -_colcon_package_bash_source_script() { - if [ -f "$1" ]; then - if [ -n "$COLCON_TRACE" ]; then - echo ". \"$1\"" - fi - . "$@" - else - echo "not found: \"$1\"" 1>&2 - fi -} - -# source sh script of this package -_colcon_package_bash_source_script "$_colcon_package_bash_COLCON_CURRENT_PREFIX/share/velodyne_lidar/package.sh" - -unset _colcon_package_bash_source_script -unset _colcon_package_bash_COLCON_CURRENT_PREFIX diff --git a/install/velodyne_lidar/share/velodyne_lidar/package.dsv b/install/velodyne_lidar/share/velodyne_lidar/package.dsv deleted file mode 100644 index d83fa83..0000000 --- a/install/velodyne_lidar/share/velodyne_lidar/package.dsv +++ /dev/null @@ -1,6 +0,0 @@ -source;share/velodyne_lidar/hook/pythonpath.ps1 -source;share/velodyne_lidar/hook/pythonpath.dsv -source;share/velodyne_lidar/hook/pythonpath.sh -source;share/velodyne_lidar/hook/ament_prefix_path.ps1 -source;share/velodyne_lidar/hook/ament_prefix_path.dsv -source;share/velodyne_lidar/hook/ament_prefix_path.sh diff --git a/install/velodyne_lidar/share/velodyne_lidar/package.ps1 b/install/velodyne_lidar/share/velodyne_lidar/package.ps1 deleted file mode 100644 index 0b2ff5a..0000000 --- a/install/velodyne_lidar/share/velodyne_lidar/package.ps1 +++ /dev/null @@ -1,116 +0,0 @@ -# generated from colcon_powershell/shell/template/package.ps1.em - -# function to append a value to a variable -# which uses colons as separators -# duplicates as well as leading separators are avoided -# first argument: the name of the result variable -# second argument: the value to be prepended -function colcon_append_unique_value { - param ( - $_listname, - $_value - ) - - # get values from variable - if (Test-Path Env:$_listname) { - $_values=(Get-Item env:$_listname).Value - } else { - $_values="" - } - $_duplicate="" - # start with no values - $_all_values="" - # iterate over existing values in the variable - if ($_values) { - $_values.Split(";") | ForEach { - # not an empty string - if ($_) { - # not a duplicate of _value - if ($_ -eq $_value) { - $_duplicate="1" - } - if ($_all_values) { - $_all_values="${_all_values};$_" - } else { - $_all_values="$_" - } - } - } - } - # append only non-duplicates - if (!$_duplicate) { - # avoid leading separator - if ($_all_values) { - $_all_values="${_all_values};${_value}" - } else { - $_all_values="${_value}" - } - } - - # export the updated variable - Set-Item env:\$_listname -Value "$_all_values" -} - -# function to prepend a value to a variable -# which uses colons as separators -# duplicates as well as trailing separators are avoided -# first argument: the name of the result variable -# second argument: the value to be prepended -function colcon_prepend_unique_value { - param ( - $_listname, - $_value - ) - - # get values from variable - if (Test-Path Env:$_listname) { - $_values=(Get-Item env:$_listname).Value - } else { - $_values="" - } - # start with the new value - $_all_values="$_value" - # iterate over existing values in the variable - if ($_values) { - $_values.Split(";") | ForEach { - # not an empty string - if ($_) { - # not a duplicate of _value - if ($_ -ne $_value) { - # keep non-duplicate values - $_all_values="${_all_values};$_" - } - } - } - } - # export the updated variable - Set-Item env:\$_listname -Value "$_all_values" -} - -# function to source another script with conditional trace output -# first argument: the path of the script -# additional arguments: arguments to the script -function colcon_package_source_powershell_script { - param ( - $_colcon_package_source_powershell_script - ) - # source script with conditional trace output - if (Test-Path $_colcon_package_source_powershell_script) { - if ($env:COLCON_TRACE) { - echo ". '$_colcon_package_source_powershell_script'" - } - . "$_colcon_package_source_powershell_script" - } else { - Write-Error "not found: '$_colcon_package_source_powershell_script'" - } -} - - -# a powershell script is able to determine its own path -# the prefix is two levels up from the package specific share directory -$env:COLCON_CURRENT_PREFIX=(Get-Item $PSCommandPath).Directory.Parent.Parent.FullName - -colcon_package_source_powershell_script "$env:COLCON_CURRENT_PREFIX\share/velodyne_lidar/hook/pythonpath.ps1" -colcon_package_source_powershell_script "$env:COLCON_CURRENT_PREFIX\share/velodyne_lidar/hook/ament_prefix_path.ps1" - -Remove-Item Env:\COLCON_CURRENT_PREFIX diff --git a/install/velodyne_lidar/share/velodyne_lidar/package.sh b/install/velodyne_lidar/share/velodyne_lidar/package.sh deleted file mode 100644 index f5093d6..0000000 --- a/install/velodyne_lidar/share/velodyne_lidar/package.sh +++ /dev/null @@ -1,87 +0,0 @@ -# generated from colcon_core/shell/template/package.sh.em - -# This script extends the environment for this package. - -# function to prepend a value to a variable -# which uses colons as separators -# duplicates as well as trailing separators are avoided -# first argument: the name of the result variable -# second argument: the value to be prepended -_colcon_prepend_unique_value() { - # arguments - _listname="$1" - _value="$2" - - # get values from variable - eval _values=\"\$$_listname\" - # backup the field separator - _colcon_prepend_unique_value_IFS=$IFS - IFS=":" - # start with the new value - _all_values="$_value" - # workaround SH_WORD_SPLIT not being set in zsh - if [ "$(command -v colcon_zsh_convert_to_array)" ]; then - colcon_zsh_convert_to_array _values - fi - # iterate over existing values in the variable - for _item in $_values; do - # ignore empty strings - if [ -z "$_item" ]; then - continue - fi - # ignore duplicates of _value - if [ "$_item" = "$_value" ]; then - continue - fi - # keep non-duplicate values - _all_values="$_all_values:$_item" - done - unset _item - # restore the field separator - IFS=$_colcon_prepend_unique_value_IFS - unset _colcon_prepend_unique_value_IFS - # export the updated variable - eval export $_listname=\"$_all_values\" - unset _all_values - unset _values - - unset _value - unset _listname -} - -# since a plain shell script can't determine its own path when being sourced -# either use the provided COLCON_CURRENT_PREFIX -# or fall back to the build time prefix (if it exists) -_colcon_package_sh_COLCON_CURRENT_PREFIX="/home/fusha153/Documents/Roboboat/ROS2-Docker-Development/install/velodyne_lidar" -if [ -z "$COLCON_CURRENT_PREFIX" ]; then - if [ ! -d "$_colcon_package_sh_COLCON_CURRENT_PREFIX" ]; then - echo "The build time path \"$_colcon_package_sh_COLCON_CURRENT_PREFIX\" doesn't exist. Either source a script for a different shell or set the environment variable \"COLCON_CURRENT_PREFIX\" explicitly." 1>&2 - unset _colcon_package_sh_COLCON_CURRENT_PREFIX - return 1 - fi - COLCON_CURRENT_PREFIX="$_colcon_package_sh_COLCON_CURRENT_PREFIX" -fi -unset _colcon_package_sh_COLCON_CURRENT_PREFIX - -# function to source another script with conditional trace output -# first argument: the path of the script -# additional arguments: arguments to the script -_colcon_package_sh_source_script() { - if [ -f "$1" ]; then - if [ -n "$COLCON_TRACE" ]; then - echo "# . \"$1\"" - fi - . "$@" - else - echo "not found: \"$1\"" 1>&2 - fi -} - -# source sh hooks -_colcon_package_sh_source_script "$COLCON_CURRENT_PREFIX/share/velodyne_lidar/hook/pythonpath.sh" -_colcon_package_sh_source_script "$COLCON_CURRENT_PREFIX/share/velodyne_lidar/hook/ament_prefix_path.sh" - -unset _colcon_package_sh_source_script -unset COLCON_CURRENT_PREFIX - -# do not unset _colcon_prepend_unique_value since it might be used by non-primary shell hooks diff --git a/install/velodyne_lidar/share/velodyne_lidar/package.xml b/install/velodyne_lidar/share/velodyne_lidar/package.xml deleted file mode 100644 index 544169f..0000000 --- a/install/velodyne_lidar/share/velodyne_lidar/package.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - velodyne_lidar - 0.0.0 - ROS2 package that subscribes to the Velodynes PointCloud topic. - fusha153 - TODO: License declaration - - rclpy - sensor_msgs - - ament_copyright - ament_flake8 - ament_pep257 - python3-pytest - - - ament_python - - diff --git a/install/velodyne_lidar/share/velodyne_lidar/package.zsh b/install/velodyne_lidar/share/velodyne_lidar/package.zsh deleted file mode 100644 index 76c2586..0000000 --- a/install/velodyne_lidar/share/velodyne_lidar/package.zsh +++ /dev/null @@ -1,42 +0,0 @@ -# generated from colcon_zsh/shell/template/package.zsh.em - -# This script extends the environment for this package. - -# a zsh script is able to determine its own path if necessary -if [ -z "$COLCON_CURRENT_PREFIX" ]; then - # the prefix is two levels up from the package specific share directory - _colcon_package_zsh_COLCON_CURRENT_PREFIX="$(builtin cd -q "`dirname "${(%):-%N}"`/../.." > /dev/null && pwd)" -else - _colcon_package_zsh_COLCON_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX" -fi - -# function to source another script with conditional trace output -# first argument: the path of the script -# additional arguments: arguments to the script -_colcon_package_zsh_source_script() { - if [ -f "$1" ]; then - if [ -n "$COLCON_TRACE" ]; then - echo ". \"$1\"" - fi - . "$@" - else - echo "not found: \"$1\"" 1>&2 - fi -} - -# function to convert array-like strings into arrays -# to workaround SH_WORD_SPLIT not being set -colcon_zsh_convert_to_array() { - local _listname=$1 - local _dollar="$" - local _split="{=" - local _to_array="(\"$_dollar$_split$_listname}\")" - eval $_listname=$_to_array -} - -# source sh script of this package -_colcon_package_zsh_source_script "$_colcon_package_zsh_COLCON_CURRENT_PREFIX/share/velodyne_lidar/package.sh" -unset convert_zsh_to_array - -unset _colcon_package_zsh_source_script -unset _colcon_package_zsh_COLCON_CURRENT_PREFIX diff --git a/src/velodyne_lidar/package.xml b/src/velodyne_lidar/package.xml index 544169f..01119b8 100644 --- a/src/velodyne_lidar/package.xml +++ b/src/velodyne_lidar/package.xml @@ -5,7 +5,7 @@ 0.0.0 ROS2 package that subscribes to the Velodynes PointCloud topic. fusha153 - TODO: License declaration + MIT rclpy sensor_msgs diff --git a/src/velodyne_lidar/setup.py b/src/velodyne_lidar/setup.py index be58f07..2b00c46 100644 --- a/src/velodyne_lidar/setup.py +++ b/src/velodyne_lidar/setup.py @@ -16,7 +16,7 @@ maintainer='fusha153', maintainer_email='pipandw@gmail.com', description='ROS2 package that subscribes to the Velodynes PointCloud topic.', - license='TODO: License declaration', + license='MIT', tests_require=['pytest'], entry_points={ 'console_scripts': [