Loading [MathJax]/extensions/tex2jax.js
iCub-main
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
z
Functions
a
c
d
e
f
g
i
l
m
n
o
p
q
r
s
t
u
v
w
y
Variables
a
b
c
d
e
h
i
j
l
m
n
p
r
s
t
w
z
Typedefs
Enumerations
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
p
q
r
s
t
u
v
w
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
Enumerations
a
b
c
e
g
i
l
n
p
r
s
t
u
Enumerator
a
b
c
d
e
f
g
i
l
m
p
r
s
t
u
Properties
Related Symbols
a
b
c
g
i
l
o
q
r
s
t
w
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
v
w
x
y
z
Typedefs
Enumerations
Enumerator
_
a
c
d
e
g
j
m
n
p
s
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
icub-main
src
libraries
icubmod
embObjLib
ethSender.cpp
Go to the documentation of this file.
1
// -*- Mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2
3
4
/*
5
* Copyright (C) 2017 iCub Facility - Istituto Italiano di Tecnologia
6
* Author: Alberto Cardellino, Marco Accame
7
* email: alberto.cardellino@iit.it, marco.accame@iit.it
8
* website: www.robotcub.org
9
* Permission is granted to copy, distribute, and/or modify this program
10
* under the terms of the GNU General Public License, version 2 or any
11
* later version published by the Free Software Foundation.
12
*
13
* A copy of the license can be found at
14
* http://www.robotcub.org/icub/license/gpl.txt
15
*
16
* This program is distributed in the hope that it will be useful, but
17
* WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
19
* Public License for more details
20
*/
21
22
23
// --------------------------------------------------------------------------------------------------------------------
24
// - public interface
25
// --------------------------------------------------------------------------------------------------------------------
26
27
#include "
ethSender.h
"
28
29
30
31
// --------------------------------------------------------------------------------------------------------------------
32
// - external dependencies
33
// --------------------------------------------------------------------------------------------------------------------
34
35
36
//#include <yarp/os/SystemClock.h>
37
#include <yarp/os/Log.h>
38
#include <yarp/os/LogStream.h>
39
using
yarp::os::Log;
40
41
#include "
ethManager.h
"
42
43
44
// --------------------------------------------------------------------------------------------------------------------
45
// - pimpl: private implementation (see scott meyers: item 22 of effective modern c++, item 31 of effective c++
46
// --------------------------------------------------------------------------------------------------------------------
47
48
49
50
// --------------------------------------------------------------------------------------------------------------------
51
// - the class
52
// --------------------------------------------------------------------------------------------------------------------
53
54
55
// - class eth::EthSender
56
57
// -- class EthSender
58
// -- here is it code
59
60
using namespace
eth
;
61
62
EthSender::EthSender
(
int
txrate) : PeriodicThread((double)txrate/1000.0)
63
{
64
rateofthread = txrate;
65
yDebug() <<
"EthSender is a PeriodicThread with txrate ="
<< rateofthread <<
"ms"
;
66
yTrace();
67
68
#ifdef NETWORK_PERFORMANCE_BENCHMARK
69
/* We would like to verify if the receiver thread is ticked(running) every 1 millisecond, with a tollerance of 0.05 millisec.
70
The m_perEvtVerifier object after 1 second, prints an istogram with values from 0 to 3 millisec with a step of 0.1 millisec
71
*/
72
73
double
txrate_sec=(double)txrate/1000;
//txrate is in milliseconds
74
m_perEvtVerifier.init(txrate_sec, 5*txrate_sec/100, 0.0, txrate_sec+0.002, 0.0001, 1,
"Sender"
);
75
#endif
76
}
62
EthSender::EthSender
(
int
txrate) : PeriodicThread((double)txrate/1000.0) {
…
}
77
78
EthSender::~EthSender
()
79
{
80
81
}
78
EthSender::~EthSender
() {
…
}
82
83
bool
EthSender::config
(ACE_SOCK_Dgram *pSocket,
TheEthManager
* _ethManager)
84
{
85
yTrace();
86
send_socket = pSocket;
87
ethManager = _ethManager;
88
89
return
true
;
90
}
83
bool
EthSender::config
(ACE_SOCK_Dgram *pSocket,
TheEthManager
* _ethManager) {
…
}
91
92
bool
EthSender::threadInit
()
93
{
94
yTrace() <<
"Do some initialization here if needed"
;
95
96
#if defined(__unix__)
102
struct
sched_param thread_param;
103
thread_param.sched_priority = sched_get_priority_max(SCHED_FIFO)/2 - 1;
// = 48
104
pthread_setschedparam(pthread_self(), SCHED_FIFO, &thread_param);
105
#endif
106
107
return
true
;
108
}
92
bool
EthSender::threadInit
() {
…
}
109
110
111
112
void
EthSender::run()
113
{
114
// by calling this metod of ethManager, we put protection vs concurrency internal to the class.
115
// for tx we must protect the EthResource not being changed. they can be changed by a device such as
116
// embObjMotionControl etc which adds or releases its resources.
117
ethManager->
Transmission
();
118
119
#ifdef NETWORK_PERFORMANCE_BENCHMARK
120
m_perEvtVerifier.tick(yarp::os::Time::now());
121
#endif
122
}
123
124
125
// - end-of-file (leave a blank line after)----------------------------------------------------------------------------
126
127
128
129
130
eth::EthSender::EthSender
EthSender(int txrate)
Definition
ethSender.cpp:62
eth::EthSender::~EthSender
~EthSender()
Definition
ethSender.cpp:78
eth::EthSender::config
bool config(ACE_SOCK_Dgram *pSocket, TheEthManager *_ethManager)
Definition
ethSender.cpp:83
eth::EthSender::threadInit
bool threadInit()
Definition
ethSender.cpp:92
eth::TheEthManager
Definition
ethManager.h:84
eth::TheEthManager::Transmission
bool Transmission(void)
Definition
ethManager.cpp:253
ethManager.h
ethSender.h
eth
Definition
abstractEthResource.h:38
Generated on Wed Apr 9 2025 08:53:51 for iCub-main by
1.9.8