Branched code with node.js v0.8.2 and different capturing solution


#1

Hi there,

Over the last 2 days could spend some time on the software.

I used the Angström distribution that comes with the BeagleBone directly as I like its sleekness.

I found a less hacky solution to build node.js 0.8.x on the ARM platform thanks to a a Rapspberry PI user that had the same issues: https://github.com/gflarity/node_pi

It seems that express (the node library used to host the static part of the site) changed recently to version 3.0 (i got beta2) and that broke the current code. After some fights with node.js (I'm totally new here too) I manged to fix that.

Meanwhile I found a way to stream video without using node.js as a gateway. Even though I can see why you choose to use your own capture app using OpenCV for potential future development, I think right now it makes sense to keep it simple. Therefore I used a tool called MJPG-Streamer (http://sourceforge.net/projects/mjpg-streamer/). It takes the video from the webcam and streams it via http as a MJPG (a continuous stream of JPEG images, a little like you did manually). I think this will take away some load from the node.js process and simplify that part of the software greatly.

I haven't yet come around to setup my own blog, but in the meanwhile, I put my branch on github for generall consumption.

https://github.com/codewithpassion/openrov-software/tree/mjpg-streamer

I plan to do a little work on the UI and the software until I get my electronics and find a place to get the bodyworks done.

Hope its of help for anyone.

Cheers

Dominik


#2

Hi Dominik,

I was trying your less-hacky solution for node.js but the command

git apply --stat ~/node_pi/v0.8.2-release-raspberrypi.patch

returns '0 files changed'

Make runs for a long time but errors out with this:

/usr/include/arm-linux-gnueabihf/bits/stdio.h: In function ‘int getchar()’:
/usr/include/arm-linux-gnueabihf/bits/stdio.h:45:14: sorry, unimplemented: Thumb-1 hard-float VFP ABI
make[1]: *** [/home/rov/.nvm/src/node-v0.8.2/out/Release/obj.target/v8_base/deps/v8/src/accessors.o] Error 1
make[1]: Leaving directory `/home/rov/.nvm/src/node-v0.8.2/out'
make: *** [node] Error 2

Any ideas? BTW, I'm hanging around in the #openrov IRC channel if you want to chat. It's pretty quiet over there.


#3

Hi sliptronic

Sorry for the late answer.

Have you been in the home directory of your user when you did the

git clone https://github.com/gflarity/node_pi.git

command? If not you have the use the correct path. As well check that you are in the node source directory /home/rov/.nvm/src/node-v0.8.2 (from what I see in your post)

Beside that, I have to admit that I used the source code package from the node.js website instead the nvm download. But it should not really matter.

I haven't tested the patch with the newest version 0.8.4 of node, so if you wan't to test again with the node source distribution here it is: http://nodejs.org/dist/v0.8.2/node-v0.8.2.tar.gz

Cheers

Dominik


#4

Thanks for the reply. I got the patch to apply, but it's erroring out at the same place. Interesting that it's related to the hard-float which is the section the hacky solution recommended be commented out starting at line 1230 in linux-platform.cc

I'm going to try rebuilding using angstrom instead of ubuntu. I'll post here again.


#5

Have you set the environment variables accordingly?


#6

Yes, I have. I've also tried a number of different variations on them.

I don't understand all of it but this seems to relate directly to the error: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=33&t=8758

The part at the bottom about the ubuntu static libraries not being suitable for the raspi is interesting. Not sure how closely the raspi and the beaglebone are or whether the beaglebone ubuntu image has 'suitable' static libraries.

I think, at a minimum, building node for the beaglebone ubuntu image is going to need some different compiler flags.


#7

So close. I think I got node.js to build in ubuntu. It requires the -marm flag. I'll write up directions after I get it all working. Everything else seemed to install fine. But when I try it I get this:

rov@openrov:~/openrov-software/src$ NODE_ENV=production node app.js

module.js:340
throw err;
^
Error: Cannot find module 'express'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (/home/rov/openrov-software/src/app.js:19:15)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)


#8

Hi Sliptronic,

You need to do

npm install express socket.io serialport

to install the node modules needed (express is one of them).


#9

Hmmm. Very strange. I checked the scrollback and I had done that. Everything had installed without error. I repeated it and got a warning that the node path wasn't found but otherwise it went fine again.

Now with start it, it doesn't crash. Browse to the IP gives a 'it works' page.

Here's a pastebin with the output including the last bit of my history.

Do I have to go somewhere other than the IP address to get to the output?


#10

Do you use the official OpenROV codebase or my branch?

As I outline it in by build log, there is an issue with the current OpenROV code and the new node express version.

You might want to diff the app.js from my mjpg-streamer branch (https://github.com/codewithpassion/openrov-software/tree/mjpg-streamer) and the development branch from OpenROV.


#11

I guess the forum has a maximum reply depth, so sorry for the out-of-order reply. I'd missed your build log. Looks good. Thanks for all the help, btw.

I think we're close. I've switched to your fork and rebuilt the development branch. Interestingly, I had to re-do the express install (again) after compiling. app.js launches now. This is shown in the console:

rov@openrov:~/openrov-software/src$ NODE_ENV=production node app.js
info - socket.io started
config { debug: true,
sample_freq: 20,
dead_zone: 10,
video_frame_rate: 15,
production: 'production',
port: 8080 }
Initializing serial port
ROV controller initialized
Start listening on port: 8080
There was an error setting the TX on UART1: Error: EACCES, open '/sys/kernel/debug/omap_mux/uart1_txd'

From the browser, I see a warning about gamepad not connected and a blank image pane with the word OpenROV.


#12

Trying this

https://github.com/codewithpassion/openrov-software/tree/mjpg-streamer

I keep getting stuck at step 4/5 .... nvm is not a recognized command despite step 4 seeming to work?


#13

Hum, check your PATH variable. Seems like the nvm script isn’t in the PATH.


#14

Ah, one possible reason: log off and back on (ctrl-d) as the path gets set via the .bashrc at login!


#15

ok that worked.. now with the last part of step 6 ... what dir should i be in when i run

export GYP_DEFINES="armv7=0"
export CCFLAGS='-march=armv6'
export CXXFLAGS='-march=armv6'`

? mine seems to hang?


#16

That doesn’t matter. The export command only sets environment variables. But there seems to be an additional character at the end of the last line, that could put the shell in a state where it waits for more text.


#17

that was it right there - didnt catch it

Now it is hanging with the same hard float that was mentioned earlier in the thread

/usr/include/arm-linux-gnueabihf/bits/stdio.h: In function ‘int getchar()’:
/usr/include/arm-linux-gnueabihf/bits/stdio.h:45:14: sorry, unimplemented: Thumb
-1 hard-float VFP ABI
make[1]: *** [/home/ubuntu/.nvm/src/node-v0.8.2/out/Release/obj.target/v8_base/d
eps/v8/src/accessors.o] Error 1
make[1]: Leaving directory `/home/ubuntu/.nvm/src/node-v0.8.2/out'
make: *** [node] Error 2


#18

Bugger… So there is a difference in some library or the compiler between Ubuntu and Angström.
As I don’t have an sd with Ubuntu right now, I can’t give much help, sorry!


#19

Check out step 6 here: http://wiki.openrov.com/index.php/Installing_The_Software

It uses different compiler flags. I think the -marm flag is the one that did it.

You have to add it in step 7 as well so the install works.


#20

i added the -marm code for the install under both the CCFLAGS and the CXXFLAGS, no luck?

ACTION _home_ubuntu__nvm_src_node_v0_8_2_deps_v8_tools_gyp_v8_gyp_v8_snapshot_
target_run_mksnapshot /home/ubuntu/.nvm/src/node-v0.8.2/out/Release/obj.target/v
8_snapshot/geni/snapshot.cc
ERROR: Binary compiled with -mfloat-abi=hard but without -DUSE_EABI_HARDFLOAT
make[1]: *** [/home/ubuntu/.nvm/src/node-v0.8.2/out/Release/obj.target/v8_snapsh
ot/geni/snapshot.cc] Error 1
make[1]: Leaving directory `/home/ubuntu/.nvm/src/node-v0.8.2/out'
make: *** [node] Error 2
ubuntu@omap:~/.nvm/src/node-v0.8.2$