★ wanayoo — archive 1999 https://github.com/RobotWebTools/rclnodejs/pull/9Nouvelle recherche | Portail wanayoo
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically generate message class in JS #9

Merged
merged 9 commits into from Jun 15, 2017

Conversation

@kenny-y
Copy link
Member

kenny-y commented Jun 15, 2017

Use the spec from parser to dynamically generate ROS message class in JS, assemble it with exactly the same memory layout with C++. Now it works with the first message: std_msgs/msg/String.msg

P.S. please use [squash & merge] button when merging...

@kenny-y kenny-y requested a review from minggangw Jun 15, 2017
@kenny-y
Copy link
Member Author

kenny-y commented Jun 15, 2017

With this dynamic-message-generating mechanism, when developers add or modify a message, s/he won't need to re-install (or compile) this rclnodejs module/addon.

Copy link
Member

minggangw left a comment

LGTM, and some small problems, thanks!

'use strict';

const StructType = require('ref-struct');
const ref = require('ref');
const ffi = require('ffi');

This comment has been minimized.

@minggangw

minggangw Jun 15, 2017

Member

these 3 lines above are useless

const requireFromString = require('require-from-string');

const primitiveTypes = require('../rosidl_gen/generator_primitive.js');
const Parser = require('../rosidl_parser/rosidl_parser.js');

This comment has been minimized.

@minggangw

minggangw Jun 15, 2017

Member

not capital here

messageType.pkgName + '/' + messageType.msgSubfolder + '/' + messageType.msgName + '.msg';

return new Promise(function(resolve, reject) {
Parser.parseMessageFile(messageType.pkgName, packagePath).then((spec) => {

This comment has been minimized.

@kenny-y kenny-y merged commit cfe8b3a into RobotWebTools:develop Jun 15, 2017
1 check was pending
1 check was pending
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.