File size: 4,752 Bytes
f5dbfe6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# API Definition

For this document, a parameter represents some value on the controller.
It may be read-only, writable in different states, continuously-updating etc.
It may represent a configuration item, a file on disk, a sensor reading, a control input etc.

## Custom types

### Kinematics

```yaml
joint_state:
    position:
        type: float64
        unit: m (linear joints) or rad (angular joints)
    velocity:
        type: float64
        unit: m/s (linear joints) or rad/s (angular joints)
    effort:
        type: float64
        unit: N (linear joints) or Nm (angular joints)
```

### State

```yaml
controller_state:
    mode:
        type: enum
        enum_options:
            - offline
            - configure
            - e-stop
            - manual-control
            - active-pause
            - active-run
```

### ...

Other types will be required...

## Generic API

### Parameters

Interact with a parameter at a single point in time.

```yaml
parameter_list:
    request:
        namespace:
            type: string
            description: Fetch all parameters underneath this namespace
        recursive:
            type: bool
            default: False
            description: If true, fetch nested parameters as well
    response:
        parameters:
            type: string[]
            description: List of all parameters in this namespace
```

```yaml
parameter_info:
    request:
        name:
            type: string
            description: Full name of parameter including namespace (eg /joint/1/state)
    response:
        type:
            type: string
            description: Name of parameter type
        description:
            type: string
            description: Human-readable description of the parameter's purpose
        read_only:
            type: bool
            description: Is the parameter read-only?
        permission_level:
            type: int32
            description: Client permission level required to change this value
        states:
            type: controller_state[]
            description: States in which this value may be changed
```

```yaml
parameter_fetch:
    request:
        name:
            type: string
            description: Name of parameter to fetch, including namespace
    response:
        data:
            type: Any
            description: Current parameter value, type as specified by a parameter_info call
```

```yaml
parameter_set:
    request:
        name:
            type: string
        value:
            type: Any
            description: New parameter value, type as specified by a parameter_info call
    response:
        ok:
            type: bool
            description: True if the update succeeded
```

### Streaming

Request that the controller pushes a stream of messages whenever a given parameter changes.

```yaml
subscribe:
    request:
        name:
            type: string
            description: Full name of parameter including namespace to subscribe to
        rate_limit:
            type: int32
            description: Maximum number of values to send per minute.  Depending on the parameter, excess will be dropped silently or an average will be created.
    response:
        null
```

```yaml
list_subscriptions:
    request:
        null
    response:
        subscriptions:
            type: string[]
            description: List of parameters currently subscribed to
```

```yaml
unsubscribe:
    request:
        name:
            type: string
    response:
        null
```

### Control streams

Indicate to the controller that you would like to push a stream of set-value messages to it.

```yaml
init_control_stream:
    request:
        name:
            type: string
            description: Full name of parameter including namespace to open a control stream for
    response:
        ok:
            type: bool
```

```yaml
list_control_streams:
    request:
        null
    response:
        subscriptions:
            type: string[]
            description: List of parameters with active control streams
```

```yaml
cancel_control_stream:
    request:
        name:
            type: string
    response:
        null
```

## Parameters

Some example parameters.

```yaml
/joint/state:
    description: State of all joints on the controller
    type: joint_state[]
    read_only: true
/joint/*/controller/current:
    description: Joint PID current controller proportional value
    type: pid_value
/joint/${joint_index}/jog:
    description: Jog input for the given joint.
    type: joint_control
    permission_level: 3
    states: manual-control
/filesystem/download-file/${file_path}:
    description: Get the contents of a given filee
    type: string
    permission_level: 1
```