EtherCAT Control Framework v0.9
Implementation of EtherCAT protocol using IgH EtherCAT library for robot controller.
ecat_globals.hpp
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * $Id$
4 *
5 * Copyright (C) 2021 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 ecat_globals.hpp
33 * \brief Header file for all include statements and global variables for EtherCAT
34 * communication.
35 *
36 * This header file contains required include statements for IgH EtherCAT library,
37 * global variables (e.g. ethercat master,master_state, domain,domain_state),
38 * structs for PDO offset and recieved data from slaves,
39 * Communication period and number of slaves can be specified in here.
40 *******************************************************************************/
41#pragma once
42#include "ecat_definitions.hpp"
43
44/****************************************************************************/
47const uint32_t g_kNumberOfServoDrivers = 1 ;
50#define NUM_OF_SLAVES 1
53#define CUSTOM_SLAVE 0
54#define FREQUENCY 1000
55#define MEASURE_TIMING 1
56#define DISTRIBUTED_CLOCK 0
57/*****************************************************************************/
58#define GEAR_RATIO 49
59#define ENCODER_RESOLUTION 1000
60#define INC_PER_ROTATION GEAR_RATIO*ENCODER_RESOLUTION*4
61#define FIVE_DEGREE_CCW int(INC_PER_ROTATION/72)
62#define THIRTY_DEGREE_CCW int(INC_PER_ROTATION/12)
63#define PERIOD_NS (g_kNsPerSec/FREQUENCY)
64#define PERIOD_US (PERIOD_NS / 1000)
65#define PERIOD_MS (PERIOD_US / 1000)
66#if CUSTOM_SLAVE
67 #define FINAL_SLAVE (NUM_OF_SLAVES-1)
68#endif
69const struct timespec g_cycle_time = {0, PERIOD_NS} ; // cycletime settings in ns.
70
71const struct timespec g_half_cycle_time = {0, PERIOD_NS/2} ; // cycletime settings in ns.
Writes desired operational mode, to slave in specified index via SDO.
@ kProfileVelocity
Definition: ecat_definitions.hpp:147
const struct timespec g_cycle_time
Definition: ecat_globals.hpp:69
const struct timespec g_half_cycle_time
Definition: ecat_globals.hpp:71
static int8_t g_kOperationMode
Select operation mode for motors, default: Profile Velocity.
Definition: ecat_globals.hpp:49
const uint32_t g_kNumberOfServoDrivers
Number of connected servo drives.
Definition: ecat_globals.hpp:47
#define PERIOD_NS
Definition: ecat_globals.hpp:63