Fix linting errors
This commit is contained in:
parent
6cce113f04
commit
33f227b772
27 changed files with 668 additions and 563 deletions
|
@ -1,47 +1,48 @@
|
|||
#include <memory>
|
||||
#include <chrono>
|
||||
|
||||
#include "rclcpp/rclcpp.hpp"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
|
||||
class TimerNode : public rclcpp::Node
|
||||
{
|
||||
public:
|
||||
TimerNode(rclcpp::NodeOptions options) : Node("timer_node", options)
|
||||
{
|
||||
is_done_ = false;
|
||||
timer_ = this->create_wall_timer(
|
||||
1ms,
|
||||
std::bind(&TimerNode::timer_callback, this));
|
||||
}
|
||||
explicit TimerNode(rclcpp::NodeOptions options)
|
||||
: Node("timer_node", options)
|
||||
{
|
||||
is_done_ = false;
|
||||
timer_ = this->create_wall_timer(
|
||||
1ms,
|
||||
std::bind(&TimerNode::timer_callback, this));
|
||||
}
|
||||
|
||||
private:
|
||||
void timer_callback()
|
||||
{
|
||||
if (is_done_) {
|
||||
rclcpp::shutdown();
|
||||
} else {
|
||||
is_done_ = true;
|
||||
}
|
||||
void timer_callback()
|
||||
{
|
||||
if (is_done_) {
|
||||
rclcpp::shutdown();
|
||||
} else {
|
||||
is_done_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
rclcpp::TimerBase::SharedPtr timer_;
|
||||
bool is_done_;
|
||||
rclcpp::TimerBase::SharedPtr timer_;
|
||||
bool is_done_;
|
||||
};
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
rclcpp::init(argc, argv);
|
||||
rclcpp::init(argc, argv);
|
||||
|
||||
rclcpp::executors::SingleThreadedExecutor exec;
|
||||
auto timer_node = std::make_shared<TimerNode>(rclcpp::NodeOptions());
|
||||
exec.add_node(timer_node);
|
||||
rclcpp::executors::SingleThreadedExecutor exec;
|
||||
auto timer_node = std::make_shared<TimerNode>(rclcpp::NodeOptions());
|
||||
exec.add_node(timer_node);
|
||||
|
||||
printf("spinning\n");
|
||||
exec.spin();
|
||||
printf("spinning\n");
|
||||
exec.spin();
|
||||
|
||||
// Will actually be called inside the timer's callback
|
||||
rclcpp::shutdown();
|
||||
return 0;
|
||||
// Will actually be called inside the timer's callback
|
||||
rclcpp::shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue