lmclupr / brickpi-nodejs

BrickPi Nodejs API module
19 stars 9 forks source link

brickpi-raspberry install fails due to outdated serialport dependency #3

Open RickBullotta opened 7 years ago

RickBullotta commented 7 years ago

It seems to be based on an ancient version of serialport. Can we get it updated ASAP?

npmoutput.txt

RickBullotta commented 7 years ago

I tested with serialport 4.0.6 and async 2.1.4, and updated a number of the source files to address a major bug with sensor setup and to add some additional capabilities (new events on sensors, a couple other minor tweaks). Should I create a pull request?

codeofsumit commented 7 years ago

@RickBullotta do you mind helping me out on this? I'm having the same issue. The first errors appearing during install are these:

node-pre-gyp ERR! Tried to download(404): https://node-serialport.s3.amazonaws.com/serialport/v1.6.3/Release/node-v51-linux-arm.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for serialport@1.6.3 and node@7.5.0 (node-v51 ABI) (falling back to source compile with node-gyp)
RickBullotta commented 7 years ago

I'll get back to you early next week when I can pull some code off my laptop. Cheers.

On Mar 12, 2017, at 10:13 AM, Sumit Kumar notifications@github.com wrote:

@RickBullotta do you mind helping me out on this? I'm having the same issue. The first errors appearing during install are these:

node-pre-gyp ERR! Tried to download(404): https://node-serialport.s3.amazonaws.com/serialport/v1.6.3/Release/node-v51-linux-arm.tar.gz node-pre-gyp ERR! Pre-built binaries not found for serialport@1.6.3 and node@7.5.0 (node-v51 ABI) (falling back to source compile with node-gyp)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

RickBullotta commented 7 years ago

Also, check out the Dexter git repo for some updates.

On Mar 12, 2017, at 10:13 AM, Sumit Kumar notifications@github.com wrote:

@RickBullotta do you mind helping me out on this? I'm having the same issue. The first errors appearing during install are these:

node-pre-gyp ERR! Tried to download(404): https://node-serialport.s3.amazonaws.com/serialport/v1.6.3/Release/node-v51-linux-arm.tar.gz node-pre-gyp ERR! Pre-built binaries not found for serialport@1.6.3 and node@7.5.0 (node-v51 ABI) (falling back to source compile with node-gyp)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

codeofsumit commented 7 years ago

@RickBullotta thank you! FYI: I installed serialport and node-gyp manually, now I was able to install the library with an updated serialport version (forked it and changed the package.json). Install works but I was not yet able to move any motor. The setup() function errors in a timeout.

Have you eventually been able to control lego motors via nodeJS using this library?

ppinto commented 7 years ago

@codeofsumit - I was able to get the motors to move with the updated version you created and pulled from your repository to get around the node-gyp and serialport errors. I have been testing as a function inside a node red flow. I get these errors after the robot moves ones in one direction. timed out rx Timeout checksum failed...

here is the main function that I am calling var brickpi = global.get('BrickPi'); var robot = new brickpi.BrickPi();

var newMsg = { payload: msg.payload.trim() }; var myMsg=newMsg.payload.split(",");

var motorB = new brickpi.Motor({port: brickpi.PORTS.MB, name: 'motorB'}); var motorC = new brickpi.Motor({port: brickpi.PORTS.MC, name: 'motorC'});

robot.addMotor(motorB).addMotor(motorC).setup();

robot.on('ready', function() { motorB.resetPosition(); motorC.resetPosition(); robot.run(); });

if (myMsg[0] == "move") { switch (myMsg[1]) { case "fwd": robot.on('ready', function() { motorB.resetPosition(); motorC.resetPosition(); robot.run();

                motorB.start(150).moveTo(1000, function(err) {
                 // called when motorA has reached 5000 ticks (2500 degrees in rotation).
                 });

                motorC.start(150).moveTo(1000, function(err) {

                 // called when motorA has reached 5000 ticks (2500 degrees in rotation).
                });
                });
                break;         
        case "bkwd":
                robot.on('ready', function() {
                motorB.resetPosition();
                motorC.resetPosition();
                robot.run();

                motorB.start(150).moveTo(-1000, function(err) {
                 // called when motorA has reached 5000 ticks (2500 degrees in rotation).
                 });
                motorC.start(150).moveTo(-1000, function(err) {

                 // called when motorA has reached 5000 ticks (2500 degrees in rotation).
                });
                });
                break;         
        case "left":
                robot.on('ready', function() {
                motorB.resetPosition();
                motorC.resetPosition();
                robot.run();
                motorB.start(150).moveTo(1000, function(err) {
                 // called when motorA has reached 5000 ticks (2500 degrees in rotation).
                 });
                motorC.start(150).moveTo(-1000, function(err) {

                 // called when motorA has reached 5000 ticks (2500 degrees in rotation).
                });
                });
                break;         
        case "right":
                robot.on('ready', function() {
                motorB.resetPosition();
                motorC.resetPosition();
                robot.run();
                motorB.start(150).moveTo(-1000, function(err) {
                 // called when motorA has reached 5000 ticks (2500 degrees in rotation).
                 });
                motorC.start(150).moveTo(1000, function(err) {

                 // called when motorA has reached 5000 ticks (2500 degrees in rotation).
                });
                });
                break;         

    }

}

console.log('Motor '+ mymsg[0]+' '+myMsg[1] );

setTimeout(function() { robot.stop(); }, 10000);

return msg;

Thanks -Phil