-
Notifications
You must be signed in to change notification settings - Fork 5
/
iodrivers_base.orogen
123 lines (106 loc) · 4.61 KB
/
iodrivers_base.orogen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# frozen_string_literal: true
name "iodrivers_base"
# Optionally declare the version number
# version "0.1"
using_library "iodrivers_base", typekit_link: false
using_library "base-logging", typekit_link: false
import_types_from "base"
import_types_from "iodrivers_base/Status.hpp"
import_types_from "RawPacket.hpp"
# Base task for integration of device drivers based on iodrivers_base::Driver.
# It is not meant to be used directly, but as a base class for driver tasks."
#
# See http://rock-robotics.org/stable/documentation/device_drivers/index.html
# for more information
task_context "Task" do
abstract
# The device address. It can either be serial://PATH[:baudrate],
# udp://IP_OR_HOSTNAME[:PORT] or tcp://IP_OR_HOSTNAME[:PORT]. Leave empty if
# you mean to use the io_raw_in and io_raw_out ports.
property "io_port", "/std/string"
# The timeout waiting for new I/O
#
# The component will transition to the IO_TIMEOUT exception if no data at
# all is received for this long. The default is zero, which disables the
# feature.
#
# Note that the ability to time out this way depends on the type of activity
# used. The period of a periodic activity would essentially define the
# resolution of the actual timeout. If the component is deployed on a
# FileDescriptorActivity, it will be configured to timeout for 1/10 of this
# time, to give sufficient resolution.
property "io_wait_timeout", "/base/Time"
# The timeout on write. Defaults to one second. Used only in direct I/O mode
property "io_write_timeout", "/base/Time"
# The timeout on read. Defaults to one second
property "io_read_timeout", "/base/Time"
# The interval at which the status port should be written. Defaults to one
# second
property "io_status_interval", "/base/Time"
# Whether iodrivers_base's TimeoutError exception should automatically be
# caught and interpreted as a IO_TIMEOUT exception when thrown from
# processIO
#
# This is false for historical reasons. We recommend setting it to true
property "handle_iodrivers_base_timeout", "/bool", false
# If connected, data will be received through this port instead of using a
# file descriptor
input_port("io_raw_in", "iodrivers_base/RawPacket")
.needs_reliable_connection
# If connected, data will be sent through this port either instead of or in
# addition to using a file descriptor
output_port "io_raw_out", "iodrivers_base/RawPacket"
# Echoes all data that has been received by the driver
output_port "io_read_listener", "iodrivers_base/RawPacket"
# Echoes all data that has been sent by the driver
output_port "io_write_listener", "iodrivers_base/RawPacket"
# Statistics and status about the I/O channel
output_port "io_status", "iodrivers_base/Status"
exception_states :IO_TIMEOUT, :IO_ERROR
port_driven "io_raw_in"
fd_driven
end
# Simple task that allows to mirror the I/O from a port supported by
# iodrivers_base::Driver onto the io_read_listener and io_write_listener ports
task_context "Proxy", subclasses: "Task" do
property "internal_buffer_size", "int", 1_024
# Data that should be sent to io_port
input_port("tx", "iodrivers_base/RawPacket")
.needs_reliable_connection
# Data received on io_port
output_port "rx", "iodrivers_base/RawPacket"
port_driven
fd_driven
end
# Test task used to verify the behavior of iodrivers_base::Task in a FDA
# setting
#
# It will fail during execution if iodrivers_base::Task's implementation does
# call processIO without any data on input
task_context "test::FDTask", subclasses: "Task" do
output_port "rx", "/iodrivers_base/RawPacket"
fd_driven
end
# Test task used to check a corner case behavior related to UDP error handling
#
# See the commit message and the test in iodrivers_base_test.rb for explanations
task_context "test::UDPErrorHandlingTask", subclasses: "iodrivers_base::test::FDTask" do
input_port "tx", "/iodrivers_base/RawPacket"
port_driven
fd_driven
end
# Test task used to verify the behavior of iodrivers_base::Task in a periodic
# setting
#
# It will fail during execution if iodrivers_base::Task's implementation does
# call processIO without any data on input
task_context "test::PeriodicTask", subclasses: "Task" do
output_port "rx", "/iodrivers_base/RawPacket"
periodic 0.1
end
# Test task that transitions to exception() from within processIO
#
# It is used to verify that this does not lead to an infinite loop if the
# I/O is left in the driver
task_context "test::ExceptionInProcessIOTask", subclasses: "iodrivers_base::test::PeriodicTask" do
end