-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample.js
More file actions
35 lines (30 loc) · 870 Bytes
/
example.js
File metadata and controls
35 lines (30 loc) · 870 Bytes
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
const rosnodejs = require('rosnodejs');
const ActionServerInterface = require('rosnodejs/dist/lib/ActionServerInterface');
const ActionClientInterface = require('rosnodejs/dist/lib/ActionClientInterface');
const ActionLib = require('./index.js');
ActionLib.config({
time: rosnodejs.Time,
log: rosnodejs.log.getLogger('actionlibjs'),
messages: {
getMessage(fullName) {
const [pkg, name] = fullName.split('/');
return rosnodejs.require(pkg).msg[name]
},
getMessageConstants(fullName) {
return this.getMessage(fullName).CONSTANTS;
}
},
ActionServerInterface,
ActionClientInterface
});
rosnodejs.initNode('/tmp')
.then(() => {
const as = new ActionLib.ActionServer({
type: 'intera_motion_msgs/MotionCommand',
actionServer: '/motion',
nh: rosnodejs.nh
});
})
.catch((err) => {
console.error(err.stack);
})