diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7c0f524 --- /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-latest + + strategy: + matrix: + ros_distro: [ melodic, noetic ] + 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 }} 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()