Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
taskbrowser
tests
taskbrowser/tests/main.cpp
Go to the documentation of this file.
1
#include "
taskbrowser/TaskBrowser.hpp
"
2
3
#include <
rtt/extras/SlaveActivity.hpp
>
4
#include <
rtt/Activity.hpp
>
5
#include <
rtt/Port.hpp
>
6
#include <
rtt/os/main.h
>
7
8
using namespace
std
;
9
using namespace
Orocos
;
10
using namespace
RTT
;
11
12
class
TestTaskContext
13
:
public
RTT::TaskContext
14
{
15
RTT::Property<string>
hello
;
16
OutputPort<std::vector<double>
> dwport;
17
InputPort<double>
drport;
18
19
public
:
20
TestTaskContext
(std::string name)
21
:
RTT
::
TaskContext
(name),
22
hello(
"Hello"
,
"The hello thing"
,
"World"
),
23
dwport(
"D2Port"
),
24
drport(
"D1Port"
)
25
{
26
this->properties()->addProperty( hello );
27
this->ports()->addPort( drport );
28
this->ports()->addPort( dwport );
29
30
std::vector<double> init(10, 1.0);
31
dwport.
write
(init);
32
}
33
};
34
35
class
TestTaskContext2
36
:
public
RTT::TaskContext
37
{
38
RTT::Property<string>
hello
;
39
OutputPort<double>
dwport;
40
InputPort<std::vector<double>
> drport;
41
42
public
:
43
TestTaskContext2
(std::string name)
44
:
RTT
::
TaskContext
(name),
45
hello(
"Hello"
,
"The hello thing"
,
"World"
),
46
dwport(
"D1Port"
),
47
drport(
"D2Port"
)
48
{
49
this->properties()->addProperty( hello );
50
this->ports()->addPort( drport );
51
this->ports()->addPort( dwport );
52
53
// write initial value.
54
dwport.
write
( 0.0 );
55
}
56
};
57
58
int
ORO_main
(
int
argc,
char
** argv)
59
{
60
// Set log level more verbose than default,
61
// such that we can see output :
62
if
(
RTT::Logger::log
().getLogLevel() <
RTT::Logger::Info
) {
63
RTT::Logger::log
().
setLogLevel
(
RTT::Logger::Info
);
64
log(
Info
) << argv[0] <<
" manually raises LogLevel to 'Info' (5). See also file 'orocos.log'."
<<endlog();
65
}
66
67
TestTaskContext
gtc(
"MyPeer"
);
68
TestTaskContext2
gtc2(
"MyPeer2"
);
69
70
TestTaskContext2
gtc3(
"MySoloPeer"
);
71
72
gtc.
connectPeers
( >c2 );
73
74
TaskBrowser
tb( >c );
75
76
log(
Info
) <<endlog()<<
" This demo demonstrates interaction with Components."
<< endlog();
77
log(
Info
) <<
" Use 'enter' and/or 'leave' to go 'inside' or 'outside' a component. "
<<endlog();
78
log(
Info
) <<
" The inside interface shows the methods and ports of the visited component,"
<<endlog();
79
log(
Info
) <<
" the outside interface show the methods and ports of the TaskBrowser."
<<endlog();
80
81
RTT::Activity
act(10, 1.0, gtc.
engine
());
82
83
tb.
loop
();
84
85
act.stop();
86
87
return
0;
88
}
89
OCL::TaskBrowser::loop
void loop()
Call this method from ORO_main() to process keyboard input and thus startup the TaskBrowser.
Definition:
TaskBrowser.cpp:844
Activity.hpp
OCL::TaskBrowser
This component allows a text client to browse the peers of a peer RTT::TaskContext and execute comman...
Definition:
TaskBrowser.hpp:86
RTT::Logger::Info
Info
std
TestTaskContext2
Definition:
reporting/tests/main.cpp:51
RTT::TaskContext::connectPeers
virtual bool connectPeers(TaskContext *peer)
TaskBrowser.hpp
RTT::InputPort< double >
SlaveActivity.hpp
main.h
Port.hpp
ORO_main
int ORO_main(int argc, char **argv)
Definition:
taskbrowser/tests/main.cpp:58
TestTaskContext::hello
RTT::Property< string > hello
Definition:
taskbrowser/tests/main.cpp:15
TestTaskContext::TestTaskContext
TestTaskContext(std::string name)
Definition:
taskbrowser/tests/main.cpp:20
Orocos
RTT::Property< string >
RTT::OutputPort::write
WriteStatus write(const T &sample)
TestTaskContext2::hello
RTT::Property< string > hello
Definition:
taskbrowser/tests/main.cpp:38
RTT::Activity
Info
Info
RTT::Logger::log
static Logger & log()
RTT::TaskContext
RTT::OutputPort
TestTaskContext
Definition:
reporting/tests/main.cpp:14
RTT
TestTaskContext2::TestTaskContext2
TestTaskContext2(std::string name)
Definition:
taskbrowser/tests/main.cpp:43
RTT::base::TaskCore::engine
const ExecutionEngine * engine() const
RTT::Logger::setLogLevel
void setLogLevel(LogLevel ll)
ocl
Author(s): OCL Development Team
autogenerated on Wed Jun 26 2019 19:26:27