Skip to content

Commit

Permalink
Use available clang-format version for Ubuntu 22 (#45)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
Ryanf55 authored Jan 20, 2024
1 parent 22bfe8d commit 7155cb4
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 42 deletions.
19 changes: 8 additions & 11 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,19 @@ jobs:
container: ${{ matrix.config.container }}
steps:
- uses: actions/checkout@v4
- name: Install Dependencies
working-directory:
with:
path: src/grid_map_geo
- name: Install Dependencies with Rosdep
run: |
apt update
apt install -y python3-wstool libgdal-dev
rosdep update
source /opt/ros/${{matrix.config.rosdistro}}/setup.bash
rosdep install --from-paths src --ignore-src -y
shell: bash
- name: Build Test
- name: Colcon Build (Release)
working-directory:
run: |
mkdir -p $HOME/ros2_ws/src;
cd $HOME/ros2_ws/src
ln -s $GITHUB_WORKSPACE
cd $HOME/ros2_ws
source /opt/ros/humble/setup.bash
rosdep update
rosdep install --from-paths src --ignore-src -y --rosdistro ${{matrix.config.rosdistro}}
source /opt/ros/${{matrix.config.rosdistro}}/setup.bash
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --packages-up-to grid_map_geo
shell: bash
# - name: unit_tests
Expand Down
21 changes: 13 additions & 8 deletions .github/workflows/check_style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,21 @@ jobs:
strategy:
fail-fast: false
matrix:
container:
- 'px4io/px4-dev-simulation-focal:2020-09-14'
container: ${{ matrix.container }}
config:
- {rosdistro: 'humble', container: 'osrf/ros:humble-desktop'}
container: ${{ matrix.config.container }}
steps:
- uses: actions/checkout@v4
- name: submodule update
run: git submodule update --init --recursive
- name: Install clang-format
run: apt update && apt install -y clang-format-6.0
with:
path: src/grid_map_geo
- name: Install Dependencies with Rosdep
run: |
apt update
rosdep update
source /opt/ros/${{matrix.config.rosdistro}}/setup.bash
rosdep install --from-paths src --ignore-src -y --dependency-types test
shell: bash
- name: Check Code format
working-directory: Tools
working-directory: src/grid_map_geo/Tools
run: |
./check_code_format.sh ..
4 changes: 2 additions & 2 deletions Tools/fix_code_style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ fi
for arg in "$@"
do
if [ -f $arg ]; then
clang-format-6.0 -i -style='{BasedOnStyle: google, ColumnLimit: 120}' $arg
clang-format -i -style='{BasedOnStyle: google, ColumnLimit: 120}' $arg
elif [ -d $arg ]; then
find $arg -iname '*.h' -o -iname '*.cpp' -o -iname '*.hpp' | xargs clang-format-6.0 -i -style='{BasedOnStyle: google, ColumnLimit: 120}'
find $arg -iname '*.h' -o -iname '*.cpp' -o -iname '*.hpp' | xargs clang-format -i -style='{BasedOnStyle: google, ColumnLimit: 120}'
find $arg -iname '*.h' -o -iname '*.cpp' -o -iname '*.hpp' | xargs chmod 644
fi
done
20 changes: 8 additions & 12 deletions include/grid_map_geo/grid_map_geo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@
#ifndef GRID_MAP_GEO_H
#define GRID_MAP_GEO_H

#include "grid_map_geo/transform.hpp"

#include <grid_map_core/GridMap.hpp>
#include <grid_map_core/iterators/GridMapIterator.hpp>
#include "tf2_ros/transform_broadcaster.h"

#include <iostream>

#include "grid_map_geo/transform.hpp"
#include "tf2_ros/transform_broadcaster.h"
struct Location {
ESPG espg{ESPG::WGS84};
Eigen::Vector3d position{Eigen::Vector3d::Zero()};
Expand Down Expand Up @@ -86,20 +85,17 @@ class GridMapGeo {

/**
* @brief Get the name of the coordinate frame of the dataset
*
* @return std::string
*
* @return std::string
*/
std::string getCoordinateName() { return coordinate_name_; };


/**
* @brief Overloading terrain loading with only elevation
*
*
* @param map_path Path to dsm path (Supported formats are *.tif)
*/
bool Load(const std::string& map_path) {
Load(map_path, "");
}
bool Load(const std::string& map_path) { Load(map_path, ""); }

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

/**
* @brief Initialize grid map from a geotiff file
Expand Down
2 changes: 2 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<exec_depend>ros2launch</exec_depend>
<exec_depend>rviz2</exec_depend>

<test_depend>clang-format</test_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
Expand Down
2 changes: 1 addition & 1 deletion src/grid_map_geo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#include <gdal/ogr_spatialref.h>
#endif

GridMapGeo::GridMapGeo(const std::string& frame_id) { frame_id_ = frame_id; }
GridMapGeo::GridMapGeo(const std::string &frame_id) { frame_id_ = frame_id; }

GridMapGeo::~GridMapGeo() {}

Expand Down
9 changes: 3 additions & 6 deletions src/test_tif_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,19 @@
* @author Jaeyoung Lim <[email protected]>
*/

#include "geometry_msgs/msg/transform_stamped.hpp"
#include "grid_map_geo/grid_map_geo.hpp"

#include "rclcpp/rclcpp.hpp"
#include "std_msgs/msg/string.hpp"

#include "grid_map_msgs/msg/grid_map.h"
#include "grid_map_ros/GridMapRosConverter.hpp"
#include "geometry_msgs/msg/transform_stamped.hpp"
#include "rclcpp/rclcpp.hpp"
#include "std_msgs/msg/string.hpp"
#include "tf2_ros/static_transform_broadcaster.h"

using namespace std::chrono_literals;

class MapPublisher : public rclcpp::Node {
public:
MapPublisher() : Node("map_publisher") {

std::string file_path = this->declare_parameter("tif_path", ".");
std::string color_path = this->declare_parameter("tif_color_path", ".");
std::string frame_id = this->declare_parameter("frame_id", "map");
Expand Down
5 changes: 3 additions & 2 deletions test/test_grid_map_geo.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include "grid_map_geo/transform.hpp"

#include <gtest/gtest.h>

#include <iostream>

#include "grid_map_geo/transform.hpp"

TEST(GridMapTest, geoTransform) {
Eigen::Vector3d berghaus_wgs84(46.7209147, 9.9219592, 488.0);
Eigen::Vector3d berghaus_lv03(789823.96735451114, 177416.47911055354, 440.3752994351089);
Expand Down

0 comments on commit 7155cb4

Please sign in to comment.