EtherCAT Control Framework v0.9
Implementation of EtherCAT protocol using IgH EtherCAT library for robot controller.
timing_node.hpp
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * $Id$
4 *
5 * Copyright (C) 2022 Veysi ADIN, UST KIST
6 *
7 * This file is part of the IgH EtherCAT master userspace program in the ROS2 environment.
8 *
9 * The IgH EtherCAT master userspace program in the ROS2 environment is free software; you can
10 * redistribute it and/or modify it under the terms of the GNU General
11 * Public License as published by the Free Software Foundation; version 2
12 * of the License.
13 *
14 * The IgH EtherCAT master userspace program in the ROS2 environment is distributed in the hope that
15 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
16 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with the IgH EtherCAT master userspace program in the ROS environment. If not, see
21 * <http://www.gnu.org/licenses/>.
22 *
23 * ---
24 *
25 * The license mentioned above concerns the source code only. Using the
26 * EtherCAT technology and brand is only permitted in compliance with the
27 * industrial property and similar rights of Beckhoff Automation GmbH.
28 *
29 * Contact information: veysi.adin@kist.re.kr
30 *****************************************************************************/
31/*****************************************************************************
32 * \file timing_node.hpp
33 * \brief Simple timing subscriber to get timing information from EtherCAT node.
34 * And show statistics.
35 *******************************************************************************/
36
37#include "rclcpp/rclcpp.hpp"
38#include "ecat_msgs/msg/data_received.hpp"
39#include "rcutils/logging_macros.h"
40
41namespace Timing{
42
43class TimingNode:public rclcpp::Node{
44 public:
45 TimingNode();
47 private:
48 void HandleReceivedDataCallback(const ecat_msgs::msg::DataReceived::SharedPtr msg);
50 void PrintStatistics();
51 private:
52 rclcpp::Subscription<ecat_msgs::msg::DataReceived>::SharedPtr received_data_sub_;
53 ecat_msgs::msg::DataReceived::SharedPtr received_data_;
54 rclcpp::TimerBase::SharedPtr statistics_timer_;
55 uint32_t period_min_ns_ = 0xffffffff;
56 uint32_t period_max_ns_ = 0;
57 uint32_t exec_min_ns_ = 0xffffffff;
58 uint32_t exec_max_ns_ = 0;
59 int32_t jitter_min_ = 0xfffffff;
60 int32_t jitter_max_ = 0;
61 uint32_t print_begin_= 20;
62};
63
64}//namespace Timing
Definition: timing_node.hpp:43
int32_t jitter_max_
Definition: timing_node.hpp:60
rclcpp::TimerBase::SharedPtr statistics_timer_
Definition: timing_node.hpp:54
~TimingNode()
Definition: timing_node.cpp:16
uint32_t exec_min_ns_
Definition: timing_node.hpp:57
uint32_t period_max_ns_
Definition: timing_node.hpp:56
void CalculateStatistics()
Definition: timing_node.cpp:26
uint32_t print_begin_
Definition: timing_node.hpp:61
void HandleReceivedDataCallback(const ecat_msgs::msg::DataReceived::SharedPtr msg)
Definition: timing_node.cpp:20
int32_t jitter_min_
Definition: timing_node.hpp:59
ecat_msgs::msg::DataReceived::SharedPtr received_data_
Definition: timing_node.hpp:53
TimingNode()
Definition: timing_node.cpp:6
void PrintStatistics()
Definition: timing_node.cpp:54
uint32_t exec_max_ns_
Definition: timing_node.hpp:58
uint32_t period_min_ns_
Definition: timing_node.hpp:55
rclcpp::Subscription< ecat_msgs::msg::DataReceived >::SharedPtr received_data_sub_
Definition: timing_node.hpp:52
Definition: timing_node.hpp:41