Slide 17
Slide 17 text
3/25/2019 title
localhost:54721/?print-pdf-now#/ 17/21
proactiveGreetingsApp.js
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
import xs from 'xstream';
...
function main(sources) {
var actionGoals$ = sources.ROSTopic['/leg_tracker_measurements']
.map(function(data) { ... }) // transform data to distance
.filter(function(dist) { ... }) // discard out-of-range
.map(function(filteredDist) {
if (filteredDist < 0.5) {
return {
id: Date.now(),
say: 'How can I help you?',
shimmy: true,
}
} else {
return {
id: Date.now(),
say: 'Hi',
shimmy: false,
}
}
});
var notifyGoal$ = xs.combine( // i.e., wait for two action results
sources.ROSTopic['/say/result'],
sources.ROSTopic['/shimmy/result'],
).filter(function([sayResult, shimmyResult]) {
// true if action ids are matching, i.e., both actions are done
})
Edit on StackBlitz
ros-seattle-meetup-20190328 Editor Preview Both
13
Reactive Programming for Robot Applications - Michael Jae-Yoon Chung