Homebuilt Rov Forum
http://www.homebuiltrovs.com/rovforum/

Help needed before I pull out all of my hair.
http://www.homebuiltrovs.com/rovforum/viewtopic.php?f=39&t=1604
Page 2 of 2

Author:  Moki [ Mar 2nd, 2015, 9:52 am ]
Post subject:  Re: Help needed before I pull out all of my hair.

Welcome to the wonderful world of ROV building... :D

Where nothing is easy, ofcourse.

Let me give you a roadmap i would take to learn the skills needed to get going.
(Ofcourse, this only works if you use the things i am using)

Stop thinking to far ahead... small steps is best (but dreams are ok)

1) nodejs
Start learning javascript. http://www.w3schools.com/js/default.asp

2) learn how to read the your sensors and output from them to the console screen.
If you have no sensors and only a adafruit servo board... start with that.
This will teach you how to use modules in javascript/nodejs and will give fast results.

3) socket.io (javascript module) http://socket.io/
Socket.io is a way to communicate between the server program and the client on the browserside.
Look at it, like a data "bus" one side will put data on the bus... the other side will read from it.

4) Learn HTML5 / Canvas
So you wanted graphics ;) http://www.html5canvastutorials.com/

5) And ofcourse joystick/gamepad input http://www.html5rocks.com/en/tutorials/doodles/gamepad/

Author:  perfo [ Mar 2nd, 2015, 10:22 am ]
Post subject:  Re: Help needed before I pull out all of my hair.

great answer, I'll set aside 5 minutes to get all that sorted then :) only joking of course.... I'll squeeze in a quiet few hours and try to do a gap analysis to see where I am... The desire to learn this is definitely there so maybe...
I have got my senors now ( the 9 axis thing ) so I'll install that this after noon and it'll give me something to display and play with...
Thanks Moki.

Author:  rossrov [ Mar 2nd, 2015, 5:32 pm ]
Post subject:  Re: Help needed before I pull out all of my hair.

I overloaded the servers at w3 schools... That was a main resource. Lots of learning by example, which means copying and pasting and understanding single lines of other's code, then editing that to suit the task at hand. That code I posted looks complex at a glance, and it took many hours to put together. However, it is made up of individually tested "blocks" of code. I kind of cheat and pretend I'm writing a BASIC program (bad habits...). If you take away the curly brackets and semicolons you see what I mean.

The main thing is to know what you need the entire ROV project to do, then learn enough about the capabilities of the various programming languages (VB, HTML/JavaScript, Processing etc etc etc) and choose one that looks like it will work and stick with that.

So looks like you're sold on HTML. I think the simplest and most productive way to go is with RasPi camera, and no separate IP camera. This way I understand you can have the same domain (ip address) for both camera and control/data. Moki??

Author:  Moki [ Mar 2nd, 2015, 7:44 pm ]
Post subject:  Re: Help needed before I pull out all of my hair.

rossrov wrote:
I overloaded the servers at w3 schools... That was a main resource. Lots of learning by example, which means copying and pasting and understanding single lines of other's code, then editing that to suit the task at hand. That code I posted looks complex at a glance, and it took many hours to put together. However, it is made up of individually tested "blocks" of code. I kind of cheat and pretend I'm writing a BASIC program (bad habits...). If you take away the curly brackets and semicolons you see what I mean.

The main thing is to know what you need the entire ROV project to do, then learn enough about the capabilities of the various programming languages (VB, HTML/JavaScript, Processing etc etc etc) and choose one that looks like it will work and stick with that.

So looks like you're sold on HTML. I think the simplest and most productive way to go is with RasPi camera, and no separate IP camera. This way I understand you can have the same domain (ip address) for both camera and control/data. Moki??


Every single ip device, needs its own unique ip address. And every program or videostream should have its own unique port address. So the javascript/nodejs program listens on port 3000, while mjpg-stream 1, using the raspicam listens in port 8080 and mjpg-stream 2, using usb webcam listens on port 8081.

If you try to run 2 programs on the same tcp port, the second should fail with the error "port in use"

On different ip devices, you can use the same port. So if you have 2 ip camera's, both could stream on port 8080.

Author:  perfo [ Mar 2nd, 2015, 8:23 pm ]
Post subject:  Re: Help needed before I pull out all of my hair.

If I go up the html route then IP cams are pretty straight forward.

Its as simple as stick and iframe in with the correct ip address and port etc of the camera you can have as many as you like providing they all have their own IP. My media converter hub in the ROV has four ports on it so I could have three cameras plus the PI.

This bit below shows my cam output in chrome....
Code:
<div>
  <iframe width="640" height="480" src="http://192.168.2.11:27/live.htm" style="-webkit-transform:scale(0.5);-moz-transform-scale(0.5);"></iframe>
</div>


and if I didn't get all cocky and chuck some java and a css in
Code:
<html>
<head>
<script language="JavaScript1.2">
<!--
 top.window.moveTo(0,0);
 if (document.all) {
 top.window.resizeTo(screen.availWidth,screen.availHeight);
 }
 else if (document.layers||document.getElementById) {
 if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
 top.window.outerHeight = screen.availHeight;
 top.window.outerWidth = screen.availWidth;
 }
 }
 //-->
 </script>

<link rel="stylesheet" type="text/css" href="ROVStyleSheet.css">
</head>
<div>
  <iframe width="640" height="480" src="http://192.168.2.11:27/live.htm" style="-webkit-transform:scale(0.5);-moz-transform-scale(0.5);"></iframe>
</div>

</html>

Author:  rossrov [ Mar 3rd, 2015, 6:41 pm ]
Post subject:  Re: Help needed before I pull out all of my hair.

Good call with the iframe, perfo. Moki, I was really thinking cross-domain security issues for the browser re the IP address comment/question. Provided you do not have to parse anything from an iframe then not a concern. Thanks for mentioning ports though. Carry on... :)

Author:  perfo [ Mar 15th, 2015, 6:43 am ]
Post subject:  Re: Help needed before I pull out all of my hair.

I've dumped VBA now... Just because of silly MS rules and them trying to keep other browser technologies out of the picture.. Anyway I did get it working with VBA and it works ok but I wasn't happy with it..
I've taken Moki's and others advice and made good progress learning HTML5, javascript, node.js and socket.io..
So whilst this thread is still open if a VBA guru does happen to come past as I'd still like to know how to do it but it probably wont be used on the ROV now...

Page 2 of 2 All times are UTC - 5 hours [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/