From 7d2d46964480b5fa3b1461abbf66491faecc83f9 Mon Sep 17 00:00:00 2001 From: NestorDP Date: Fri, 11 Aug 2023 10:21:23 -0300 Subject: [PATCH] Run cpplint checks --- .../include/littlebot_teleop/teleop.hpp | 45 +++++++++---------- littlebot_teleop/src/teleop.cpp | 18 ++++---- 2 files changed, 30 insertions(+), 33 deletions(-) diff --git a/littlebot_teleop/include/littlebot_teleop/teleop.hpp b/littlebot_teleop/include/littlebot_teleop/teleop.hpp index b98d105..ce37a81 100644 --- a/littlebot_teleop/include/littlebot_teleop/teleop.hpp +++ b/littlebot_teleop/include/littlebot_teleop/teleop.hpp @@ -1,12 +1,11 @@ +// Copyright 2023 Nestor Neto -// Copyright Nestor 2022 - -#ifndef LITTLEBOT_TELEOP_TELEOP_HPP_ -#define LITTLEBOT_TELEOP_TELEOP_HPP_ +#ifndef LITTLEBOT_TELEOP_INCLUDE_LITTLEBOT_TELEOP_TELEOP_HPP_ +#define LITTLEBOT_TELEOP_INCLUDE_LITTLEBOT_TELEOP_TELEOP_HPP_ #include #include -#include +#include // NOLINT #include #include #include @@ -19,24 +18,22 @@ #define LITTLEBOT_TELEOP_CPP_PUBLIC __attribute__ ((visibility("default"))) namespace littlebot_teleop { - class Teleop : public rclcpp::Node { - public: - LITTLEBOT_TELEOP_CPP_PUBLIC - explicit Teleop(const rclcpp::NodeOptions & options); - - protected: - void teleopPublisher(void); - - private: - rclcpp::Subscription::SharedPtr sub_joy_; - rclcpp::Publisher::SharedPtr pub_twist_; - rclcpp::TimerBase::SharedPtr timer_; - - float x_joy_value_; - float z_joy_value_; - - - }; +class Teleop : public rclcpp::Node { + public: + LITTLEBOT_TELEOP_CPP_PUBLIC + explicit Teleop(const rclcpp::NodeOptions & options); + + protected: + void teleopPublisher(void); + + private: + rclcpp::Subscription::SharedPtr sub_joy_; + rclcpp::Publisher::SharedPtr pub_twist_; + rclcpp::TimerBase::SharedPtr timer_; + + float x_joy_value_; + float z_joy_value_; +}; } // namespace littlebot_teleop -#endif // LITTLEBOT_TELEOP_TELEOP_HPP_/ +#endif // LITTLEBOT_TELEOP_INCLUDE_LITTLEBOT_TELEOP_TELEOP_HPP_/ diff --git a/littlebot_teleop/src/teleop.cpp b/littlebot_teleop/src/teleop.cpp index db909fd..024fd94 100644 --- a/littlebot_teleop/src/teleop.cpp +++ b/littlebot_teleop/src/teleop.cpp @@ -1,30 +1,30 @@ -// Copyright Nestor 2022-2023 - +// Copyright 2023 Nestor Neto #include "littlebot_teleop/teleop.hpp" -using namespace std::chrono_literals; +using namespace std::chrono_literals; // NOLINT namespace littlebot_teleop { Teleop::Teleop(const rclcpp::NodeOptions & options) - : Node("littlebot_teleop","", options){ - + : Node("littlebot_teleop" , "", options) { + auto joy_callback = [this](sensor_msgs::msg::Joy::ConstSharedPtr joy) -> void { z_joy_value_ = joy->axes[0]; x_joy_value_ = joy->axes[3]; }; - + sub_joy_ = create_subscription("joy", 10, joy_callback); - pub_twist_ = + pub_twist_ = this->create_publisher( "joy_teleop/cmd_vel", 10); - timer_ = create_wall_timer(100ms, std::bind(&Teleop::teleopPublisher, this)); + timer_ = + create_wall_timer(100ms, std::bind(&Teleop::teleopPublisher, this)); } void Teleop::teleopPublisher() { @@ -36,4 +36,4 @@ namespace littlebot_teleop { } // namespace littlebot_teleop -RCLCPP_COMPONENTS_REGISTER_NODE(littlebot_teleop::Teleop) +RCLCPP_COMPONENTS_REGISTER_NODE(littlebot_teleop::Teleop)