diff --git a/src/io/io_packageparser.js b/src/io/io_packageparser.js index 8dd8eb0..578aa92 100644 --- a/src/io/io_packageparser.js +++ b/src/io/io_packageparser.js @@ -12,11 +12,10 @@ IO.PackageParser = new (function() { var add_behaviors = []; ROS.getPackageList((pkg_list) => { - pkg_cache.forEach(entry => { pkg_list.remove(entry); }); + pkg_list = pkg_list.filter(entry => pkg_cache.findElement(cached => cached['name'] == entry['name']) == undefined); var pkg_count = pkg_list.length; if (pkg_count > 0) { - //T.logInfo("Checking "+pkg_count+" newly detected ROS packages for states and behaviors..."); - T.logInfo("Checking "+pkg_count+" ROS packages for states and behaviors..."); + T.logInfo("Checking "+pkg_count+" ROS packages for states and behaviors ("+pkg_cache.length+" in cache)..."); } else { T.logInfo("No new ROS packages detected ("+pkg_cache.length+" in cache)."); } diff --git a/src/ros/ros.js b/src/ros/ros.js index 02a6de7..e79bfe5 100644 --- a/src/ros/ros.js +++ b/src/ros/ros.js @@ -99,35 +99,35 @@ rospy.spin() break; } } - }); - if (python_path !== undefined) { - process.nextTick(() => { - callback(python_path); - }); - } else { - var proc = spawn('python', ['-c', `import importlib; print(importlib.import_module('` + package_name + `').__path__[-1])`]); - var path_data = ''; - proc.stdout.on('data', data => { - path_data += data; - }); - proc.stderr.on('data', data => { - console.log(package_name+" failed to import: "+data); - }); - proc.on('close', (code) => { - if (path_data != "") { - python_path = path_data.replace(/\n/g, ''); - for (var i=0; i { + callback(python_path); + }); + } else { + var proc = spawn('python', ['-c', `import importlib; print(importlib.import_module('` + package_name + `').__path__[-1])`]); + var path_data = ''; + proc.stdout.on('data', data => { + path_data += data; + }); + proc.stderr.on('data', data => { + console.log(package_name+" failed to import: "+data); + }); + proc.on('close', (code) => { + if (path_data != "") { + python_path = path_data.replace(/\n/g, ''); + for (var i=0; i