I’m running a node app on my pi3 which has raspbarian installed on it. Basically what im trying to do is hit an api endpoint and make the car move forward. I’ve tried using the forward()
method from the Easygopigo3 class as well as setMotorDps()
directly from the Gopigo3 class, but when called they don’t seem to do anything.
Some of the methods still work such as volt()
, which returned a value of 9.508, so I know everything is set up right.
I was also able to get the status from the left motor using getMotorStatus()
. It returned a value of 0,-128,0,0
Is my voltage just not enough to turn the motors? Also I am unclear what the status from the motors actually means. I dug through the code a little bit to see what the values in that array actually represented but didn’t get a clear picture. I’ll leave a snippet below to get an idea of what my code looks like. Thank you in advance for any help.
const express = require('express');
const app = express();
const EasyGopigo3 = require('node-gopigo3').EasyGopigo3;
const ezgpg = new EasyGopigo3();
const sleep = require('sleep');
app.get('/api/move', function(req, res) {
ezgpg.forward()
sleep.sleep(1);
res.send("We moved")
})
app.listen(8080);
Hi @idvidrine,
Before diving into node, can you tell us two things:
-
Can you move forward the robot by using the Python library?
-
Do you see the green power LED on the GoPiGo3?
To make the robot go forward in Python, you need to run this:
from easygopigo3 import EasyGoPiGo3
ezgpg = EasyGoPiGo3()
ezgpg.forward()
If you need to find more details about this Python library, check out this documentation:
http://gopigo3.readthedocs.io/en/master/
Thank you!
Hey @RobertLucianm, thank you for the reply!
I tried running one of the example python scripts and it couldn’t find the gopigo3 module. Turns out I’m a dummy and never grabbed gopigo3 .
I just ran curl -kL dexterindustries.com/update_gopigo3 | sudo bash
and everything seemed to work fine! I did however run into some problems with firmware versioning. I updated to 1.0, and that worked with my python scripts, however to use node I had to revert to 0.3.4.
Following the instructions here solved my problems!
Thank you!
Hi @idvidrine,
I’m not sure how it worked for you since running that command with sudo
won’t work - you need to use user-level permissions in order to be able install the GoPiGo3. For instance here’s what I get when I run it with sudo
:
And here’s how you should run the installer command:
curl -kL dexterindustries.com/update_gopigo3 | bash
Thank you!