Skip to content

Commit

Permalink
ROS2 Linting: gnss_poser (autowarefoundation#166)
Browse files Browse the repository at this point in the history
* Add linting and fix litner errors

* Address PR comment:
 - Use author name instead of user
 - Remove ROS2 maintainer (remnants of older porting)
  • Loading branch information
jilaada authored Dec 14, 2020
1 parent ec406c3 commit 0422848
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 19 deletions.
13 changes: 10 additions & 3 deletions sensing/preprocessor/gnss/gnss_poser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ project(gnss_poser)
### Compile options
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wno-unused-parameter -Wall -Wextra -Wpedantic)
Expand All @@ -16,18 +18,23 @@ set(GNSS_POSER_HEADERS
include/gnss_poser/convert.hpp
include/gnss_poser/gnss_poser_core.hpp
include/gnss_poser/gnss_stat.hpp
)
)

ament_auto_add_library(gnss_poser_node SHARED
src/gnss_poser_core.cpp
${GNSS_POSER_HEADERS}
src/gnss_poser_core.cpp
${GNSS_POSER_HEADERS}
)

rclcpp_components_register_node(gnss_poser_node
PLUGIN "GNSSPoser"
EXECUTABLE gnss_poser
)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()

ament_auto_package(INSTALL_TO_SHARE
launch
)
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GNSS_POSER_CONVERT_HPP_
#define GNSS_POSER_CONVERT_HPP_
#ifndef GNSS_POSER__CONVERT_HPP_
#define GNSS_POSER__CONVERT_HPP_

#include <string>

#include "gnss_poser/gnss_stat.hpp"
#include "geo_pos_conv/geo_pos_conv.hpp"
Expand Down Expand Up @@ -99,7 +101,7 @@ GNSSStat UTM2MGRS(
std::pow(
10, static_cast<int>(MGRSPrecision::_1_METER) -
static_cast<int>(precision)); // set unit as [m]
mgrs.z = utm.z; // TODO
mgrs.z = utm.z; // TODO(ryo.watanabe)
} catch (const GeographicLib::GeographicErr & err) {
RCLCPP_ERROR_STREAM(logger, "Failed to convert from UTM to MGRS" << err.what());
}
Expand Down Expand Up @@ -131,4 +133,4 @@ GNSSStat NavSatFix2PLANE(
}
} // namespace GNSSPoser

#endif
#endif // GNSS_POSER__CONVERT_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GNSS_POSER_GNSS_POSER_CORE_HPP_
#define GNSS_POSER_GNSS_POSER_CORE_HPP_
#ifndef GNSS_POSER__GNSS_POSER_CORE_HPP_
#define GNSS_POSER__GNSS_POSER_CORE_HPP_

#include <string>

#include "gnss_poser/convert.hpp"
#include "gnss_poser/gnss_stat.hpp"
Expand Down Expand Up @@ -89,4 +91,4 @@ class GNSSPoser : public rclcpp::Node
};
} // namespace GNSSPoser

#endif
#endif // GNSS_POSER__GNSS_POSER_CORE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GNSS_POSER_GNSS_STAT_HPP_
#define GNSS_POSER_GNSS_STAT_HPP_
#ifndef GNSS_POSER__GNSS_STAT_HPP_
#define GNSS_POSER__GNSS_STAT_HPP_

namespace GNSSPoser
{
Expand Down Expand Up @@ -50,4 +50,4 @@ struct GNSSStat
};
} // namespace GNSSPoser

#endif
#endif // GNSS_POSER__GNSS_STAT_HPP_
5 changes: 3 additions & 2 deletions sensing/preprocessor/gnss/gnss_poser/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
<version>1.0.0</version>
<description>The ROS2 gnss_poser package</description>
<maintainer email="ryo.watanabe@tier4.jp">Ryo Watanabe</maintainer>
<!-- ROS2 -->
<maintainer email="jilada.eccleston@tier4.jp">Jilada ECCLESTON</maintainer>
<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake_auto</buildtool_depend>
Expand All @@ -24,6 +22,9 @@
<exec_depend>rclcpp</exec_depend>
<exec_depend>rclcpp_components</exec_depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
Expand Down
11 changes: 7 additions & 4 deletions sensing/preprocessor/gnss/gnss_poser/src/gnss_poser_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "gnss_poser/gnss_poser_core.hpp"
#include "rclcpp_components/register_node_macro.hpp"

#include <algorithm>
#include <memory>
#include <string>
#include <vector>

#include "gnss_poser/gnss_poser_core.hpp"

namespace GNSSPoser
{
Expand Down Expand Up @@ -105,7 +107,7 @@ void GNSSPoser::callbackNavSatFix(

// transform pose from gnss_antenna to base_link
geometry_msgs::msg::PoseStamped gnss_base_pose_msg;
//remove rotation
// remove rotation
tf_base_to_gnss_ptr->transform.rotation.x = 0.0;
tf_base_to_gnss_ptr->transform.rotation.y = 0.0;
tf_base_to_gnss_ptr->transform.rotation.z = 0.0;
Expand Down Expand Up @@ -343,6 +345,7 @@ void GNSSPoser::publishTF(
tf2_broadcaster_.sendTransform(transform_stamped);
}

RCLCPP_COMPONENTS_REGISTER_NODE(GNSSPoser)
#include "rclcpp_components/register_node_macro.hpp"

RCLCPP_COMPONENTS_REGISTER_NODE(GNSSPoser)
} // namespace GNSSPoser

0 comments on commit 0422848

Please sign in to comment.