From 6fd37fcafc95ea1d69abdbba1f048e0474891459 Mon Sep 17 00:00:00 2001 From: HannesBachter Date: Thu, 29 Jul 2021 18:16:08 +0200 Subject: [PATCH 1/3] fix some typos and make python-ready --- bag_tools/scripts/bag_add_time_offset.py | 8 ++++---- bag_tools/scripts/check_delay.py | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/bag_tools/scripts/bag_add_time_offset.py b/bag_tools/scripts/bag_add_time_offset.py index 7612342..b744b62 100755 --- a/bag_tools/scripts/bag_add_time_offset.py +++ b/bag_tools/scripts/bag_add_time_offset.py @@ -62,7 +62,7 @@ def fix_bagfile(inbag, outbag, topics, offset): rospy.loginfo('Closing output bagfile.') outbag.close() rospy.loginfo('Changed the following:') - for k, v in count.iteritems(): + for k, v in count.items(): rospy.loginfo( '%s:%s messages.',k,v) if __name__ == "__main__": @@ -70,12 +70,12 @@ def fix_bagfile(inbag, outbag, topics, offset): parser = argparse.ArgumentParser( description='Shift the publishing time of given topics in input bagfile.') parser.add_argument('-o', metavar='OUTPUT_BAGFILE', required=True, help='output bagfile') - parser.add_argument('-i', metavar='INPUT_BAGFILE', required=True, help='input bagfile(s)', nargs='+') + parser.add_argument('-i', metavar='INPUT_BAGFILE', required=True, help='input bagfile(s)') parser.add_argument('-of', metavar='OFFSET', required=True, type=float, help='time offset to add in seconds') parser.add_argument('-t', metavar='TOPIC', required=True, help='topic(s) to change', nargs='+') args = parser.parse_args() try: - fix_bagfile(args.i, args.o, arg.t, args.of) - except Exception, e: + fix_bagfile(args.i, args.o, args.t, args.of) + except Exception as e: import traceback traceback.print_exc() diff --git a/bag_tools/scripts/check_delay.py b/bag_tools/scripts/check_delay.py index 93704c3..8093efc 100755 --- a/bag_tools/scripts/check_delay.py +++ b/bag_tools/scripts/check_delay.py @@ -38,6 +38,7 @@ import os import sys import argparse +import statistics def check_delay(inbags): delays = {} @@ -59,12 +60,12 @@ def check_delay(inbags): delays[key].append(delay) max_len = max(len(topic) for topic in delays.keys()) topics = delays.keys() - topics.sort() + list(topics).sort() for topic in topics: delay_list = delays[topic] delay_list.sort() dmin, dmax, dmean = min(delay_list), max(delay_list), sum(delay_list)/len(delay_list) - dmedian = delay_list[len(delay_list)/2] + dmedian = statistics.median(delay_list) rospy.loginfo('%s : mean = %s, min = %s, max = %s, median = %s', topic.ljust(max_len + 2), dmean, dmin, dmax, dmedian) if __name__ == "__main__": @@ -77,6 +78,6 @@ def check_delay(inbags): args = parser.parse_args() try: check_delay(args.inbag) - except Exception, e: + except Exception as e: import traceback traceback.print_exc() From 87416a39245c8b1885505b1337e14511aa3d6a1e Mon Sep 17 00:00:00 2001 From: "Isaac I.Y. Saito" <130s@2000.jukuin.keio.ac.jp> Date: Fri, 11 Feb 2022 13:32:00 -0500 Subject: [PATCH 2/3] [capability] Add GitHub CI config --- .github/workflows/ci.yml | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..39f715f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,44 @@ +name: CI + +on: + # direct pushes to protected branches are not supported + pull_request: + push: + workflow_dispatch: + +jobs: + i_ci: + name: ubuntu_bionic (${{ matrix.ros_repo }}) + runs-on: ubuntu-18.04 + + strategy: + matrix: + ros_distro: [ melodic ] + ros_repo: [ main, testing ] + + env: + CCACHE_DIR: "${{ github.workspace }}/.ccache" + CATKIN_LINT: "true" + CATKIN_LINT_ARGS: --ignore launch_depend + + steps: + - name: Fetch repository + uses: actions/checkout@v2 + + - name: ccache cache + uses: actions/cache@v2 + with: + path: ${{ env.CCACHE_DIR }} + # we always want the ccache cache to be persisted, as we cannot easily + # determine whether dependencies have changed, and ccache will manage + # updating the cache for us. Adding 'run_id' to the key will force an + # upload at the end of the job. + key: ccache-${{ matrix.ros_distro }}-${{ matrix.ros_repo }}-${{github.run_id}} + restore-keys: | + ccache-${{ matrix.ros_distro }}-${{ matrix.ros_repo }} + + - name: Run industrial_ci + uses: ros-industrial/industrial_ci@master + env: + ROS_DISTRO: ${{ matrix.ros_distro }} + ROS_REPO: ${{ matrix.ros_repo }} From 33eec472f1f1e48c6130c1b91ad4466d36f7953a Mon Sep 17 00:00:00 2001 From: "Isaac I.Y. Saito" <130s@2000.jukuin.keio.ac.jp> Date: Fri, 11 Feb 2022 13:56:36 -0500 Subject: [PATCH 3/3] [CI] Add Ubuntu 1804 and 2004 version of ROS support --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 39f715f..7c0f524 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,11 +9,11 @@ on: jobs: i_ci: name: ubuntu_bionic (${{ matrix.ros_repo }}) - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest strategy: matrix: - ros_distro: [ melodic ] + ros_distro: [ melodic, noetic ] ros_repo: [ main, testing ] env: