Metawear + ROS in JS?

edited July 6 in JavaScript

Hi I'm trying to write the IMU module in JS since python connection is not very stable. While doing this, I'm stuck on loading the Metawear library in the HTML webpage. Any suggestions on loading the library to the webpage? Do I need to add a line for each file in the folder? Would appreciate any input! Thanks!

HTML page source:
!DOCTYPE html
html
head
meta charset="utf-8" /

!-- Source files --
script type="text/javascript" src="robotwebtools/EventEmitter2/eventemitter2.min.js"></script
script type="text/javascript" src="robotwebtools/roslibjs/roslib.min.js"></script

!-- Main script to be executed --
script type="text/javascript" src="MMRL.js"></script
script type="text/javascript" src="testrospub.js"></script
/head

!-- Webpage source --
body
h1>Simple roslib Example</h1
p>Check your Web Console for output.</p
/body
/html

Relevant part of MMRL.js:
`// LOCAL
var MetaWear = require('./MetaWear-SDK-JavaScript/index.js'); // Error here

// var cbindings = require('./MetaWear-SDK-JavaScript/MetaWear-SDK-Cpp/bindings/javascript/cbindings.js');
var fs = require('fs');
var ref = require('ref');`

Error:
Uncaught ReferenceError: require is not defined
at MMRL.js:2

Sign In or Register to comment.