Basic Outline, Arduino tcp/ip & cat5

Anything to do with programing the Arduino Platform.
a_shorething
Posts: 289
Joined: Sep 10th, 2013, 5:26 pm
Location: New Jersey Shore

Re: Basic Outline, Arduino tcp/ip & cat5

Post by a_shorething »

Duncan,

When I refer to a browser I'm just talking about the IP camera. Since that's kind of 'outside' of my control system it's a different communication protocol and kind of separate issue.

My design could have a browser window in the application but the cheap camera I'm using for tests only works in Internet Explorer so I'm keeping it separate. Mine (at least right now) is two different things: 1. A browser window that shows what the IP camera is sending back and 2. An interface that sends signals to the Arduino on a different IP address. The Arduino can also forward instructions to the IP camera for pan and tilt by IP or just control a servo if I go that way with it, I'm still not sure. But however it ends up, I think it will be a webcam for video and a different independent setup for the controls.

I like your plan (because it's the same way I did it. :)) about handling the software first, then working around it with the hardware. I figured once I get a cool UI the rest is a matter of making it work with that, rather than the reverse, right?

That's an interesting plan for the com signals. I would like to check out the code.

I went a different way with mine, thinking I should only send things over the wire if they changed state. I'm determining what a 'button 2' means and what to do about it in the Arduino so the PC-side is really generic.
duncan
Posts: 22
Joined: Nov 6th, 2013, 5:43 am

Re: Basic Outline, Arduino tcp/ip & cat5

Post by duncan »

a_shorething wrote:I went a different way with mine, thinking I should only send things over the wire if they changed state. I'm determining what a 'button 2' means and what to do about it in the Arduino so the PC-side is really generic.
I haven't decided on using just a single string yet really. It makes sense for the thrusters I reckon as they will change a lot. Also if you lose communications and the thrusters are set to full-dive or something, you really don't want that to continue, so I feel like constantly updating the thruster info, even if it's the same, then have the arduino check for a short time out (of 1 or 2 seconds maybe) before zero-ing all thrusters would be a good idea. This would be slightly harder to implement on the arduino if you only updated changes.

That said turning lights on or off/turning on the camera/moving a servo is suited to sending just updates after changes. A different string could be passed that gets parsed differently, fairly simply on the arduino side. With vb.net you can simply have a button handler that sends a single message when clicked too. So I may go for a mixture of both (constantly updating thrusters, separate strings for other devices)

I understand what you mean about the video and have accepted that if the video stream is located differently to the main controls it really shouldnt matter (though wouldnt be as neat!). I did consider setting up my .net project to be very generic so it could be used for many different rov's etc but thats a lot more work and I figured that already exists out there on the interwebs in a fashion better than I could ever manage, so my program will be specific to the one ROV I'm building for now
FJM
Posts: 23
Joined: Nov 6th, 2013, 11:02 am

Re: Basic Outline, Arduino tcp/ip & cat5

Post by FJM »

Hi Duncan,

Your setup sounds a lot like the one I am planning - Arduino on-board hooked to a laptop using UDP. UDP should be fine and is certainly easier. The amount of data is likely to be small and even sending every 0.1 seconds should not have an impact (unless you are using an IP camera; I'm looking at a composite camera).

I am going with messages from the laptop send as events based on user actions, with the Arduino sending regular, timed status messages back. My command structure is short messages for each motor/sensor with parsing done on the laptop or the Arduino as necessary.

Heartbeat messages from each side will allow detection of loss of communications. If no messages are detected from the surface, I'll turn on all the lighting and display a message on a video overlay (which will work even if there are no comms if using a composite camera). If no data is received from the ROV, then I can order it to surface, shutdown, or whatever. In the event the processor itself stops, then the overlay will stop updating and I'll still know.

Fred
duncan
Posts: 22
Joined: Nov 6th, 2013, 5:43 am

Re: Basic Outline, Arduino tcp/ip & cat5

Post by duncan »

FJM wrote:If no messages are detected from the surface, I'll turn on all the lighting and display a message on a video overlay (which will work even if there are no comms if using a composite camera). If no data is received from the ROV, then I can order it to surface, shutdown, or whatever. In the event the processor itself stops, then the overlay will stop updating and I'll still know.
Hi Fred,

That sounds good. It's always helpful to know people are thinking along the same lines!

I also considered what the ROV should do if it loses communication with topside. I haven't made any concrete decisions yet but to be honest I'm thinking to just set it to stay exactly where it is. If recovery is needed I'm thinking my umbilical will be attached to the main body of the rov using a chinese finger (not sure what the real name is for those things?) so I can just pull it back topside manually. Not very technical but I'm not overly concerned with any more complicated system
rossrov
Posts: 383
Joined: Feb 28th, 2013, 5:01 pm
Location: Australia

Re: Basic Outline, Arduino tcp/ip & cat5

Post by rossrov »

a_shorething:Thanks for reply. Yes, I now recall that any "normal" browser cannot do UDP, for security reasons. Makes sense when you think about it. There are ways to do it with a browser, but more complex than my simple JavaScript and HTML

Duncan re browser question: I chose to investigate using the Google browser because it supports HTML5 Canvas that makes doing graphics very easy. Initially checked out VB and other approaches to making an ethernet GUI but they looked too complex/unfamiliar to me at that stage, plus it means another entirely different application running alongside the IP cam window. I would prefer uniformity and relative simplicity if possible, hence the browser-only approach. Still gonna look at your code though :)
duncan
Posts: 22
Joined: Nov 6th, 2013, 5:43 am

Re: Basic Outline, Arduino tcp/ip & cat5

Post by duncan »

I can't think of any reason you couldn't integrate any camera feed into your own application. That said it could be pretty difficult to figure out how to get it implemented, particularly as I suspect each camera would work differently. If you ever replaced the camera theres a pretty good chance you'd have to start again

I havent looked into it but I suspect theres lots of open source code for showing a single browser window in an app (for all languages there are). Could be an option I may look into...
a_shorething
Posts: 289
Joined: Sep 10th, 2013, 5:26 pm
Location: New Jersey Shore

Re: Basic Outline, Arduino tcp/ip & cat5

Post by a_shorething »

duncan wrote:I can't think of any reason you couldn't integrate any camera feed into your own application. That said it could be pretty difficult to figure out how to get it implemented, particularly as I suspect each camera would work differently. If you ever replaced the camera theres a pretty good chance you'd have to start again

I havent looked into it but I suspect theres lots of open source code for showing a single browser window in an app (for all languages there are). Could be an option I may look into...
I agree, there is even an object for a browser window in the Visual Studio languages you can just drop on a form and then call the website you want by triggering events.

The problem is with the actual camera. As I mentioned in my case, the camera was only tested in IE5 or whatever and so you need to not just have a browser window to see it and control it, but a specific browser window. The commands for controlling a camera are usually proprietary, but that could easily be setup in some kind of a config file or set of variables that get stored and can be changed for different cameras.

I think there are two levels of complication here: 1. Viewing: You can often view a video stream from just about any browser window. That part is easy. 2. Controlling: If you have access to any kind of pan/tilt/zoom or resolution/exposure/focus from a browser, then you're into a whole different level of access and the default browser window you can drag and drop on a form may not be enough and so required level of skill changes from hobbyist to html coder.
rossrov
Posts: 383
Joined: Feb 28th, 2013, 5:01 pm
Location: Australia

Re: Basic Outline, Arduino tcp/ip & cat5

Post by rossrov »

Thanks guys - fun times!

CGI commands to camera: If you can get your VB or other GUI to send to camera in this format then you can do much more than the camera's own GUI does. In this case frame rate is being changed.

http://172.16.26.92:80/cgi-bin/encoder?USER=Admin&PWD=123456&VIDEO_FPS_NUM=1

For other commands such as pan, tilt, etc etc etc plug in those commands from your own cam's documentation. Foscam and clones use this format, would think alot of others do too.
a_shorething
Posts: 289
Joined: Sep 10th, 2013, 5:26 pm
Location: New Jersey Shore

Re: Basic Outline, Arduino tcp/ip & cat5

Post by a_shorething »

rossrov wrote:Thanks guys - fun times!

CGI commands to camera: If you can get your VB or other GUI to send to camera in this format then you can do much more than the camera's own GUI does. In this case frame rate is being changed.

http://172.16.26.92:80/cgi-bin/encoder? ... _FPS_NUM=1

For other commands such as pan, tilt, etc etc etc plug in those commands from your own cam's documentation. Foscam and clones use this format, would think alot of others do too.
What's fun is when the camera's own documentation gets them wrong, like my Tenvis. For the pan/tilt on mine the commands they tell you in the documentation were wrong and I couldn't figure out what the heck the camera was doing. In the end I got it mapped out. Hint: there is a 'move' signal and a 'stop' signal for each direction and in some cases (left and up I think in my case) the stop signal was the same code, but in others it was different.

When sending signals like this your interface needs to compare it's current state against the previous state in order to know what to send. If previous signal was 'up' and current is 'no input' then you need to send a 'stop moving up' code for example, but if the previous code was a pan right and the current is no input, the 'stop moving up' code won't do anything and the camera will keep panning right.
rossrov
Posts: 383
Joined: Feb 28th, 2013, 5:01 pm
Location: Australia

Re: Basic Outline, Arduino tcp/ip & cat5

Post by rossrov »

Yep, that sounds very sloppy of the "manufacturer". Maybe they don't bother too much because the vast majority of users wouldn't know or care about anything beyond the standard UI.
The pan and tilt commands you actually got to work (saw your post on other forum) are from memory the same as for my Foscam clone. Have you tried to use the Foscam documentation for any other functions yet?
I found the clone's pan and tilt to be way too slow anyway so if tilt needed would use a servo.
Post Reply