Skip to content

Commit 5c54a50

Browse files
authored
Update README.md
Better documentation of message generation options RE #85
1 parent f708e55 commit 5c54a50

1 file changed

Lines changed: 27 additions & 1 deletion

File tree

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,33 @@ nh.getParam('val')
4242
// do stuff
4343
});
4444
```
45-
## Messages
45+
## Generating Messages
46+
47+
Messages can be generated in a number of ways depending on the versions of ROS and Node.js you're using.
48+
- catkin - works in ROS Kinetic and later for Node.js v6+.
49+
```
50+
$ catkin_make
51+
OR
52+
$ catkin build
53+
```
54+
- `loadAllMessages()` - One-time "build" call available through `rosnodejs` for versions of ROS before Kinetic and Node.js v6+. Should be called separately and in advance of processes attempting to use messages.
55+
```
56+
const rosnodejs = require('rosnodejs');
57+
rosnodejs.loadAllPackages();
58+
```
59+
- On the fly - all versions of ROS and Node.js 4.5+. When generating on the fly, messages can not be required until the node has initialized.
60+
```
61+
const rosnodejs = require('rosnodejs');
62+
await rosnodejs.initNode('my_node', { onTheFly: true })
63+
const stdMsgs = rosnodejs.require('std_msgs');
64+
```
65+
66+
| |Pre-Kinetic|Kinetic & Later|
67+
|:---:|:---:|:---:|
68+
|Node.js >= v6|`loadAllMessages()`, on the fly|catkin, `loadAllMessages()`, on the fly|
69+
|Node.js < v6|on the fly|on the fly|
70+
71+
## Using Messages
4672
```
4773
const sensorMsgs = rosnodejs.require('sensor_msgs');
4874

0 commit comments

Comments
 (0)