Help needed before I pull out all of my hair. (Visual Basic)

A spot for any other misc. programing languages not covered above.
User avatar
Moki
Posts: 119
Joined: Oct 21st, 2014, 2:19 am
Location: The Netherlands

Re: Help needed before I pull out all of my hair.

Post by Moki »

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/
perfo
Posts: 151
Joined: Jan 27th, 2015, 12:05 am

Re: Help needed before I pull out all of my hair.

Post by perfo »

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.
rossrov
Posts: 383
Joined: Feb 28th, 2013, 5:01 pm
Location: Australia

Re: Help needed before I pull out all of my hair.

Post by rossrov »

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??
User avatar
Moki
Posts: 119
Joined: Oct 21st, 2014, 2:19 am
Location: The Netherlands

Re: Help needed before I pull out all of my hair.

Post by Moki »

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.
perfo
Posts: 151
Joined: Jan 27th, 2015, 12:05 am

Re: Help needed before I pull out all of my hair.

Post by perfo »

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: Select all

<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: Select all

<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>
rossrov
Posts: 383
Joined: Feb 28th, 2013, 5:01 pm
Location: Australia

Re: Help needed before I pull out all of my hair.

Post by rossrov »

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... :)
perfo
Posts: 151
Joined: Jan 27th, 2015, 12:05 am

Re: Help needed before I pull out all of my hair.

Post by perfo »

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...
Post Reply