Skip to content

Commit 7155cb4

Browse files
authored
Use available clang-format version for Ubuntu 22 (#45)
* Clean up build/test workflow with ROS workspace * Use rosdep for all deps * Name things better * Stop hard-coding the ros distro Signed-off-by: Ryan Friedman <[email protected]> * Update style check to work on Ubuntu 22 * And add missing dependency on clang-format Signed-off-by: Ryan Friedman <[email protected]> * Run formatter * This commit should be hidden in git blame Signed-off-by: Ryan Friedman <[email protected]> --------- Signed-off-by: Ryan Friedman <[email protected]>
1 parent 22bfe8d commit 7155cb4

File tree

8 files changed

+40
-42
lines changed

8 files changed

+40
-42
lines changed

.github/workflows/build_test.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,19 @@ jobs:
1818
container: ${{ matrix.config.container }}
1919
steps:
2020
- uses: actions/checkout@v4
21-
- name: Install Dependencies
22-
working-directory:
21+
with:
22+
path: src/grid_map_geo
23+
- name: Install Dependencies with Rosdep
2324
run: |
2425
apt update
25-
apt install -y python3-wstool libgdal-dev
26+
rosdep update
27+
source /opt/ros/${{matrix.config.rosdistro}}/setup.bash
28+
rosdep install --from-paths src --ignore-src -y
2629
shell: bash
27-
- name: Build Test
30+
- name: Colcon Build (Release)
2831
working-directory:
2932
run: |
30-
mkdir -p $HOME/ros2_ws/src;
31-
cd $HOME/ros2_ws/src
32-
ln -s $GITHUB_WORKSPACE
33-
cd $HOME/ros2_ws
34-
source /opt/ros/humble/setup.bash
35-
rosdep update
36-
rosdep install --from-paths src --ignore-src -y --rosdistro ${{matrix.config.rosdistro}}
33+
source /opt/ros/${{matrix.config.rosdistro}}/setup.bash
3734
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --packages-up-to grid_map_geo
3835
shell: bash
3936
# - name: unit_tests

.github/workflows/check_style.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,21 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
container:
18-
- 'px4io/px4-dev-simulation-focal:2020-09-14'
19-
container: ${{ matrix.container }}
17+
config:
18+
- {rosdistro: 'humble', container: 'osrf/ros:humble-desktop'}
19+
container: ${{ matrix.config.container }}
2020
steps:
2121
- uses: actions/checkout@v4
22-
- name: submodule update
23-
run: git submodule update --init --recursive
24-
- name: Install clang-format
25-
run: apt update && apt install -y clang-format-6.0
22+
with:
23+
path: src/grid_map_geo
24+
- name: Install Dependencies with Rosdep
25+
run: |
26+
apt update
27+
rosdep update
28+
source /opt/ros/${{matrix.config.rosdistro}}/setup.bash
29+
rosdep install --from-paths src --ignore-src -y --dependency-types test
30+
shell: bash
2631
- name: Check Code format
27-
working-directory: Tools
32+
working-directory: src/grid_map_geo/Tools
2833
run: |
2934
./check_code_format.sh ..

Tools/fix_code_style.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ fi
1313
for arg in "$@"
1414
do
1515
if [ -f $arg ]; then
16-
clang-format-6.0 -i -style='{BasedOnStyle: google, ColumnLimit: 120}' $arg
16+
clang-format -i -style='{BasedOnStyle: google, ColumnLimit: 120}' $arg
1717
elif [ -d $arg ]; then
18-
find $arg -iname '*.h' -o -iname '*.cpp' -o -iname '*.hpp' | xargs clang-format-6.0 -i -style='{BasedOnStyle: google, ColumnLimit: 120}'
18+
find $arg -iname '*.h' -o -iname '*.cpp' -o -iname '*.hpp' | xargs clang-format -i -style='{BasedOnStyle: google, ColumnLimit: 120}'
1919
find $arg -iname '*.h' -o -iname '*.cpp' -o -iname '*.hpp' | xargs chmod 644
2020
fi
2121
done

include/grid_map_geo/grid_map_geo.hpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,12 @@
3434
#ifndef GRID_MAP_GEO_H
3535
#define GRID_MAP_GEO_H
3636

37-
#include "grid_map_geo/transform.hpp"
38-
3937
#include <grid_map_core/GridMap.hpp>
4038
#include <grid_map_core/iterators/GridMapIterator.hpp>
41-
#include "tf2_ros/transform_broadcaster.h"
42-
4339
#include <iostream>
40+
41+
#include "grid_map_geo/transform.hpp"
42+
#include "tf2_ros/transform_broadcaster.h"
4443
struct Location {
4544
ESPG espg{ESPG::WGS84};
4645
Eigen::Vector3d position{Eigen::Vector3d::Zero()};
@@ -86,20 +85,17 @@ class GridMapGeo {
8685

8786
/**
8887
* @brief Get the name of the coordinate frame of the dataset
89-
*
90-
* @return std::string
88+
*
89+
* @return std::string
9190
*/
9291
std::string getCoordinateName() { return coordinate_name_; };
9392

94-
9593
/**
9694
* @brief Overloading terrain loading with only elevation
97-
*
95+
*
9896
* @param map_path Path to dsm path (Supported formats are *.tif)
9997
*/
100-
bool Load(const std::string& map_path) {
101-
Load(map_path, "");
102-
}
98+
bool Load(const std::string& map_path) { Load(map_path, ""); }
10399

104100
/**
105101
* @brief Helper function for loading terrain from path
@@ -109,7 +105,7 @@ class GridMapGeo {
109105
* @return true Successfully loaded terrain
110106
* @return false Failed to load terrain
111107
*/
112-
bool Load(const std::string& map_path, const std::string &color_map_path);
108+
bool Load(const std::string& map_path, const std::string& color_map_path);
113109

114110
/**
115111
* @brief Initialize grid map from a geotiff file

package.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
<exec_depend>ros2launch</exec_depend>
2626
<exec_depend>rviz2</exec_depend>
2727

28+
<test_depend>clang-format</test_depend>
29+
2830
<export>
2931
<build_type>ament_cmake</build_type>
3032
</export>

src/grid_map_geo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
#include <gdal/ogr_spatialref.h>
5959
#endif
6060

61-
GridMapGeo::GridMapGeo(const std::string& frame_id) { frame_id_ = frame_id; }
61+
GridMapGeo::GridMapGeo(const std::string &frame_id) { frame_id_ = frame_id; }
6262

6363
GridMapGeo::~GridMapGeo() {}
6464

src/test_tif_loader.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,19 @@
3737
* @author Jaeyoung Lim <[email protected]>
3838
*/
3939

40+
#include "geometry_msgs/msg/transform_stamped.hpp"
4041
#include "grid_map_geo/grid_map_geo.hpp"
41-
42-
#include "rclcpp/rclcpp.hpp"
43-
#include "std_msgs/msg/string.hpp"
44-
4542
#include "grid_map_msgs/msg/grid_map.h"
4643
#include "grid_map_ros/GridMapRosConverter.hpp"
47-
#include "geometry_msgs/msg/transform_stamped.hpp"
44+
#include "rclcpp/rclcpp.hpp"
45+
#include "std_msgs/msg/string.hpp"
4846
#include "tf2_ros/static_transform_broadcaster.h"
4947

5048
using namespace std::chrono_literals;
5149

5250
class MapPublisher : public rclcpp::Node {
5351
public:
5452
MapPublisher() : Node("map_publisher") {
55-
5653
std::string file_path = this->declare_parameter("tif_path", ".");
5754
std::string color_path = this->declare_parameter("tif_color_path", ".");
5855
std::string frame_id = this->declare_parameter("frame_id", "map");

test/test_grid_map_geo.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
#include "grid_map_geo/transform.hpp"
2-
31
#include <gtest/gtest.h>
2+
43
#include <iostream>
54

5+
#include "grid_map_geo/transform.hpp"
6+
67
TEST(GridMapTest, geoTransform) {
78
Eigen::Vector3d berghaus_wgs84(46.7209147, 9.9219592, 488.0);
89
Eigen::Vector3d berghaus_lv03(789823.96735451114, 177416.47911055354, 440.3752994351089);

0 commit comments

Comments
 (0)