Skip to content

Commit 3ebf2c8

Browse files
committed
CI and formatting using pre-commit
1 parent 8e685e1 commit 3ebf2c8

18 files changed

+292
-279
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright (C) 2024 Nobleo Autonomous Solutions B.V.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# This config uses industrial_ci (https://github.com/ros-industrial/industrial_ci.git).
6+
# For troubleshooting, see README (https://github.com/ros-industrial/industrial_ci/blob/master/README.rst)
7+
8+
name: ros-industrial
9+
10+
on:
11+
push:
12+
pull_request:
13+
workflow_dispatch:
14+
15+
jobs:
16+
industrial_ci:
17+
name: ROS ${{ matrix.ROS_DISTRO }} (${{ matrix.ROS_REPO }})
18+
runs-on: ubuntu-latest
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
ROS_DISTRO:
23+
- humble
24+
- jazzy
25+
- kilted
26+
- rolling
27+
ROS_REPO:
28+
- main
29+
env:
30+
CCACHE_DIR: "${{ github.workspace }}/.ccache"
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: actions/cache@v4
34+
with:
35+
path: ${{ env.CCACHE_DIR }}
36+
key: ccache-${{ matrix.ROS_DISTRO }}-${{ matrix.ROS_REPO }}-${{github.run_id}}
37+
restore-keys: |
38+
ccache-${{ matrix.ROS_DISTRO }}-${{ matrix.ROS_REPO }}-
39+
- uses: 'ros-industrial/industrial_ci@master'
40+
env:
41+
ROS_DISTRO: ${{ matrix.ROS_DISTRO }}
42+
ROS_REPO: ${{ matrix.ROS_REPO }}

.github/workflows/pre-commit.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
pre-commit:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v5
12+
- uses: actions/setup-python@v6
13+
- uses: pre-commit/action@v3.0.1
14+
with:
15+
extra_args: --all-files --verbose

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (C) 2025 Nobleo Autonomous Solutions B.V.
2+
3+
repos:
4+
- repo: https://bitbucket.org/nobleo/nobleo-pre-commit
5+
rev: 25.4.0
6+
hooks:
7+
- id: nobleo-hooks
8+
verbose: true

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ set_property(TARGET ${PROJECT_NAME} PROPERTY AUTOMOC ON)
5050

5151

5252
if(BUILD_TESTING)
53-
find_package(ament_lint_auto REQUIRED)
54-
ament_lint_auto_find_test_dependencies()
5553
find_package(ament_cmake_gtest REQUIRED)
5654

5755
ament_add_gtest(test_field test/test_field.cpp)

README.md

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,54 +33,65 @@ Where the tokens `{z}`, `{x}`, `{y}` represent the zoom level, x coordinate, and
3333
These will automatically be substituted by rviz_satellite when making HTTP requests.
3434

3535
Tiles can optionally be loaded from a local filesystem if downloaded beforehand
36-
for cases where robots do not have internet access. For example, the file URI
36+
for cases where robots do not have internet access.
37+
For example, the file URI
3738
`file:///tmp/tile/{z}/{y}/{x}.jpg` can be used to load files from the `/tmp/tile` directory.
3839

3940
rviz_satellite doesn't come with any preconfigured tile URL.
4041
For example, you could use one of the following tile servers:
4142

42-
* OpenStreetMap: https://tile.openstreetmap.org/{z}/{x}/{y}.png
43-
* TomTom: https://api.tomtom.com/map/1/tile/basic/main/{z}/{x}/{y}.png?tileSize=512&key=[TOKEN]
44-
* Mapbox: https://api.mapbox.com/styles/v1/mapbox/satellite-v9/tiles/256/{z}/{x}/{y}?access_token=[TOKEN]
43+
* OpenStreetMap: <https://tile.openstreetmap.org/{z}/{x}/{y}.png>
44+
* TomTom: <https://api.tomtom.com/map/1/tile/basic/main/{z}/{x}/{y}.png?tileSize=512&key=[TOKEN>]
45+
* Mapbox: <https://api.mapbox.com/styles/v1/mapbox/satellite-v9/tiles/256/{z}/{x}/{y}?access_token=[TOKEN>]
4546

4647
For some of these, you have to request an access token first.
4748
Please refer to the respective terms of service and copyrights.
4849

4950
## Options
5051

51-
- `Topic` is the topic of the GPS measurements.
52-
- `Alpha` is simply the display transparency.
53-
- `Draw Behind` will cause the map to be displayed below all other geometry.
54-
- `Zoom` is the zoom level of the map. Recommended values are 16-19, as anything smaller is _very_ low resolution. 22 is the current max.
55-
- `Blocks` number of adjacent tiles in addition to the center tile to load, 8 maximum.
56-
- `Timeout` specifies a timeout since the last received message timestamp, after which the map will be faded out; disable by setting to 0.
52+
* `Topic` is the topic of the GPS measurements.
53+
* `Alpha` is simply the display transparency.
54+
* `Draw Behind` will cause the map to be displayed below all other geometry.
55+
* `Zoom` is the zoom level of the map.
56+
Recommended values are 16-19, as anything smaller is _very_ low resolution. 22 is the current max.
57+
* `Blocks` number of adjacent tiles in addition to the center tile to load, 8 maximum.
58+
* `Timeout` specifies a timeout since the last received message timestamp, after which the map will be faded out; disable by setting to 0.
5759

5860
## Local Maps
5961

60-
If you want to use a tile server which only supports a specific region instead of the whole world you can enable the `Use Local Map` option. This also means that the zoom levels and tile coverage (see [here](https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Zoom_levels)) deviate and need to be defined manually. In particular, the `local origin` is the top-left corner of the local map region.
62+
If you want to use a tile server which only supports a specific region instead of the whole world you can enable the `Use Local Map` option.
63+
This also means that the zoom levels and tile coverage (see [here](https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Zoom_levels)) deviate and need to be defined manually.
64+
In particular, the `local origin` is the top-left corner of the local map region.
6165

6266
The options can be set after unfolding the top-level `Use Local Map` option:
6367

64-
- `Meter per Pixel (Zoom 0)` defines the length of a pixel edge in the image in meter at zoom level 0. Default is 0.0.
65-
- `Origin CRS` is the [epsg code](https://epsg.io/) of the coordinate reference system (CRS) of the local origin (should be a cartesian coordinate system). Default is not set.
66-
- `Origin X` is the X position of the local origin in given CRS system. Default is 0.0.
67-
- `Origin Y` is the Y position of the local origin in given CRS system. Default is 0.0.
68+
* `Meter per Pixel (Zoom 0)` defines the length of a pixel edge in the image in meter at zoom level 0.
69+
Default is 0.0.
70+
* `Origin CRS` is the [epsg code](https://epsg.io/) of the coordinate reference system (CRS) of the local origin (should be a cartesian coordinate system).
71+
Default is not set.
72+
* `Origin X` is the X position of the local origin in given CRS system.
73+
Default is 0.0.
74+
* `Origin Y` is the Y position of the local origin in given CRS system.
75+
Default is 0.0.
6876

6977
### Example Usage
7078

71-
Public orthographic photos are povided by [Geobasis NRW](https://www.bezreg-koeln.nrw.de/geobasis-nrw/webdienste/geodatendienste) and publicly available using the scheme described [here](https://www.wmts.nrw.de/geobasis/wmts_nw_dop/tiles/nw_dop/EPSG_25832_16/1.0.0/WMTSCapabilities.xml). The tiles only cover a smaller part of western Germany but have a very high resolution. The following options can be used and directly derived from the scheme.
79+
Public orthographic photos are povided by [Geobasis NRW](https://www.bezreg-koeln.nrw.de/geobasis-nrw/webdienste/geodatendienste) and publicly available using the scheme described [here](https://www.wmts.nrw.de/geobasis/wmts_nw_dop/tiles/nw_dop/EPSG_25832_16/1.0.0/WMTSCapabilities.xml).
80+
The tiles only cover a smaller part of western Germany but have a very high resolution.
81+
The following options can be used and directly derived from the scheme.
7282

73-
- `Object URI: https://www.wmts.nrw.de/geobasis/wmts_nw_dop/tiles/nw_dop/EPSG_25832_16/{z}/{x}/{y}`
74-
- `Meter per Pixel (Zoom 0): 4891.97`
75-
- `Origin CRS: EPSG:25832`
76-
- `Origin X: -46133.17`
77-
- `Origin Y: 6301219.54`
83+
* `Object URI: https://www.wmts.nrw.de/geobasis/wmts_nw_dop/tiles/nw_dop/EPSG_25832_16/{z}/{x}/{y}`
84+
* `Meter per Pixel (Zoom 0): 4891.97`
85+
* `Origin CRS: EPSG:25832`
86+
* `Origin X: -46133.17`
87+
* `Origin Y: 6301219.54`
7888

7989
## Support and Contributions
8090

8191
In case of questions or problems, do not hesitate to open an issue.
8292

83-
Contributions are welcomed. Please add a summary of your changes to the [changelog](CHANGELOG.rst) under the section Forthcoming.
93+
Contributions are welcomed.
94+
Please add a summary of your changes to the [changelog](CHANGELOG.rst) under the section Forthcoming.
8495

8596
## Icon copyright
8697

demo/publish_demo_data

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22
"""
33
Periodically publish gps positions in a circle around a given origin as NavSatFix messages.
44
"""
5-
import rclpy
5+
66
import math
7-
import numpy as np
87
from argparse import ArgumentParser
9-
from sensor_msgs.msg import NavSatFix, NavSatStatus
108

9+
import numpy as np
10+
import rclpy
11+
from sensor_msgs.msg import NavSatFix, NavSatStatus
1112

1213
CONVERSION_CONSTANT = 1e9
1314

14-
class CircularTranslate():
15+
16+
class CircularTranslate:
1517
"""Translate fix periodically in a circle"""
1618

1719
def update(self, t, fix):
@@ -23,8 +25,9 @@ class CircularTranslate():
2325
fix.longitude += math.sin(phi) * r
2426

2527

26-
class ApplyNoise():
28+
class ApplyNoise:
2729
"""Translate fix position using gaussian noise"""
30+
2831
def __init__(self, stddev):
2932
self.stddev = stddev
3033

@@ -34,8 +37,9 @@ class ApplyNoise():
3437
fix.longitude += noise[1]
3538

3639

37-
class LooseFix():
40+
class LooseFix:
3841
"""Set NavSatFix status to NO_FIX periodically"""
42+
3943
def __init__(self, phase, period):
4044
self.phase = phase
4145
self.period = period
@@ -76,13 +80,14 @@ def main():
7680
fix = NavSatFix()
7781
t = node.get_clock().now()
7882
fix.header.stamp = t.to_msg()
79-
fix.header.frame_id = "gps_sensor"
83+
fix.header.frame_id = 'gps_sensor'
8084
fix.latitude = origin.latitude
8185
fix.longitude = origin.longitude
8286
for u in updaters:
8387
u.update(t, fix)
8488
node.get_logger().info(
85-
f'Publishing NavSatFix at ({fix.latitude:.5f}, {fix.longitude:.5f})')
89+
f'Publishing NavSatFix at ({fix.latitude:.5f}, {fix.longitude:.5f})'
90+
)
8691
publisher.publish(fix)
8792

8893
node.create_timer(0.1, timer_callback)

package.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
<build_depend>qtbase5-dev</build_depend>
2626

2727
<test_depend>ament_cmake_gtest</test_depend>
28-
<test_depend>ament_lint_auto</test_depend>
29-
<test_depend>ament_lint_common</test_depend>
28+
3029
<export>
3130
<rviz plugin="plugin_description.xml"/>
3231
<build_type>ament_cmake</build_type>

plugin_description.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
</description>
66
<message_type>sensor_msgs/msg/NavSatFix</message_type>
77
</class>
8-
</library>
8+
</library>

0 commit comments

Comments
 (0)