I have ventured into the HTTP Servers, both regular and custom and was really impressed. Pretty cool stuff !
First question I have is that I was able to successfully connect to the regular server page with my Android Phone and as my project is fairly large, I couldn't scroll through the whole screen of the project. Would I be correct in assuming that this is a limitation of the Samsung Galaxy S4 Screen Size?
I noticed in the web server control that there are two IP Addresses the show in the control. The first one is the regular IP Address and the other one is the remote port for accessing server outside of my network. Then I noticed when I was connected that I have clicked on the connection button that there was yet another IP Address. The IP Address in the control screen along with the remote address is an IP Address that is already used on my network. The IP Address I get when I connect on connection button shows an IP Address that is not used on my network and this makes sense. Not sure how these IP Addresses are all related. We have two different IP Addresses and a remote address.
Also, which IP Address is the one I should be forwarding? Is it the address in the drop down box when I click on connection or the one of two that shows up in the main control box? Also, would I be correct in assuming that I can change the port number to one that is currently not used on my router? Also, what are some common IP Addresses that I could use that aren't currently used and would be safe to use.
I can view the web server page on my Android phone on my local network but can't access yet outside of my network. Tried port forwarding both IP addresses, with a different port number than 80 and no luck. This is where I think I might be using port numbers that are already used?
With regards to the custom web server, I looked at the example in the scripts folder and got it to work somewhat. The reason not everything worked is because I am using the Adventure Bot for my project and I am sure the author of the example custom web server used a different robot, etc. I was wondering if anyone has the example HTML code for a basic HTTP Custom Server? Example code is always great for learning purposes. I did check out the question mark for the custom web server but there was no examples. Any help on creating a custom web server would be great to help me understand what is going on with it. TheTechGuru is gracious enough to volunteer to help me out when he gets back from vacation as he wants to do some similar things with his robots that I want to do. Thought I would learn as much as I can before he gets back so I know what he is talking about somewhat?
Thanks for all the help and what a great community !
Upgrade to ARC Pro
Experience early access to the latest features and updates. You'll have everything that is needed to unleash your robot's potential.
Any thoughts or comments on the previous post regarding HTTP Server and Customer Server Controls would be much appreciated. Thanks Again, Rick
You'll need your public IP address, and have your router port forward from your public to private address to the port running your EZ-B web server (80 by default) and of course you'll need the web service active in your project.
You will find the whole walkthru for dummies in this threat!
Thanks a lot for helping me on this one Alen!
I presume this:
is the example you mentioned. Why does not work with your adventure robot ?
I'm exploring the concept ... so far it seems simple to customize, i'll add a pan & tilt to control the camera, what you have in your mind ?
Yes this is the example. The hello world button works fine. When pressing the button it speaks the appropriate phrase. I have a hunch the reason the motors don't work, is this example was not created around the adventure bot robot and the servos I use are probably on different ports. I haven't tried getting the foscam working with it as I wanted to get the ez-robot camera to work first. Using the camera selection called out in the app I was able to get the camera view in the window, but only a static image and no streaming.
My idea was to use the custom server page to do what we can't do in the mobile app in that the mobile app only supports the ez-Robot camera. I want to be able to control the foscam camera that you and Alan helped me to get working and also have the Movement Panel for the adventure bot robot and soon the I-Robot Create2 Robot Platform (not both at same time). Also need a pan/tilt control for foscam camera and one or two buttons to turn on IR LED-s on camera. I already have been able to control the IR led-s again thanks to you and Alan. Also on the wish list would be maybe 4 buttons that I could use for other control purposes.
The one issue I am concerned about is if ARC will be a limitation to the streaming speed. Alan mentioned something about putting the streaming image in an IFrame. Not sure if Alan might be talking about a completely custom web page away from ARC. I had mentioned if the cost isn't prohibitive and the streaming speed was maximized to run on android phone I would be willing to pay someone to create the page for me.
I am hoping that the ARC custom server control could do all this with decent performance as I am sure there are more people out there that are interested in security/telepresense robot applications in our community.
For me to learn it helps to have code examples and that is why I was hoping to get the code for the web server page for the example. I did find some files but no code (HTML or otherwise).
Thanks much ptp again for your continued help !
Let's first clear the "FUD".
The example page works with all movement panels. Basically when you press the html arrows the actions are translated to Forward, Reverse, Left, Right.
I believe the Adventure Robot uses the Continuous servo Movement Panel:
1) Configure the Continuous servo Movement Panel: servo Ports, Correct the middle/stop position (Calibration 90 Position).
2) Test the Movement Panel, Press Forward, Back, Left, Right, Stop.
3) Test the HTTP Custom Server html page
Can you confirm, if all are working ?
The Movement Panel works fine in ARC and also with mobile app. Does not work with HTTP Server. I noticed with the server, when I activate buttons on server port I can see the buttons turn red on ARC running on laptop but no movement of Adventure Robot.
When you say configure the Movement Panel do you mean in the code for the server page or in ARC itself? It has been configured in ARC itself and controls the robot fine but doesn't work with custom server?
How do you view the code for custom server page?
Your continued help is appreciated ! Rick
I haven't tried it from my Android phone, but the HTTP Server (custom) does work with Adventurebot, and any other bot with a movement panel.
Were you trying from your phone or PC. If your PC, what browser were you using?
I am getting home sometime tomorrow, so this weekend I'll try it from my phone and make sure there is not an issue using it in that environment.
I was using google chrome on Android phone. The custom web page does show up but the only thing that really works is the hello world button that says a message when depressed. I'll have to check again but I believe the message was played over the pc speaker and not the android speaker. As I mentioned above, the Movement Panel buttons on android phone would cause buttons in Movement Panel in ARC to turn red (activate) but no movement of the Adventure Bot Robot. Also ez-robot cam displays image in custom server image frame, but no streaming video.
Also would like to look at code for custom web server page? Thanks for your help Alan and have a safe trip home ! Rick
I created a new post (specific details) let's wait for DJ.
This is from memory, so may not be exact, but in the custom HTTP control, there is a button to press to see the path to the html file. Open the file in a text editor (i recommend notepad++) to see the code.
No bug (Dj's feedback)
Can you test the project using the Auto Position movment + http server.
Can you start a clean project (open the adventure bot) add the http custom server control and test.
Do you mean open the adventure bot Example Project that DJ has in the examples folder and add server or create brand new project and add Movement Panel and camera and server controls and test on Android phone. I have added server control to my adventure Bot project and tested on android phone and Movement Panel doesn't work nor does the ez-robot camera stream video. Just need clarification on exactly what you need me to do? Thanks again for all your great help ! Rick
@PTP was telling you to start with a new copy of the Adventurebot project demo, rather than one that you may have edited (just to eliminate any strange bugs). then add and start the HTTP Server (Custom) control.
Make sure ARC on the PC is connected to your Adventurebot and you can control it and see the video from the PC before trying from a web browser.
so, back to my previous statement:
Make sure ARC on the PC is connected to your Adventurebot and you can control it and see the video from the PC before trying from a web browser.
@Rick, You asked where you can see the code. Click the gear icon in the HTTP Server (custom) control and it will show the path the the HTML file. Click the "Open" button and it will open Windows Explorer to that directory. The code is in the default.html file in the "\EZ-builder\Http Server Root" directory in your documents folder.
Sorry for the delay getting back to you all ! I did the testing that you suggested.
The Movement Panel works, the button works and the ez-robot camera streams. The camera stream seems quite slow and sometimes intermittent. This could be due to slow internet speed at times. Excited about getting foscam displayed in the custom server webpage and be able to control it. I assume this will be our next step.
I was also able to view webpage. Yeah !
I had one question regarding the movement panel. Why does the basic adventure bot example not use the continuous rotation Movement Panel ? Also I do need to calibrate my servos using DJ'S procedures. Should we be using the continuous rotation Movement Panel with the adventure bot robot or the one that is currently used or does it really matter?
I went back and tried my project and the server worked there also. Not sure what was up with that? May could have been intermittent internet connection or what was talked about in our thread previously.
Now just need to get foscam camera F19831P working in custom server. Also need a way to control pan/tilt and turn on/off IR LEDS and a few more control buttons for miscellaneous things.
One of you had mentioned if the stream from the foscam camera is too slow you could imbed it in an I-frame? Not sure if this was applicable to ez-robot custom server or to custom web page not related to ez-robot pages.
Your continued help is much appreciated ! Rick
Autoposition Movement Panel is used to give better startup and stop control. Because the bot has two big wheels, sudden stops can make it tip over forward. The AutoPosition has an intermediate step before fully stopping to prevent tipping.
Calibration should be done if one or both servos are still moving when you hit stoo, or if it doesn't drive straight.
IFrame. Yes, I can add it to the custom web page replacing the camera control. I'll test to see if it gives better performance.
Thanks much and will await your testing results. What great response time !
Has DJ been able to get jpeg stream working with ARC?
Will it be difficult to add control for pan/tilt functions and buttons to control turning IR LEDS on and off? We already have httpget commands working to do this.
Thanks Again ! Rick
I don't know what the status of the jpeg stream is. I imagine we'll know when the next ARC version is posted.
Would I be correct in assuming the buttons to control IR LEDS will be easy along with other control buttons? Thanks again.....Rick
Thanks to you all I have been able to get the Foscam F19831P Camera to display in ARC camera control. Once it is working can I view it using the custom web server as is or are there changes that need to be made to the custom http server code?
I had another question regarding the custom http server. Can existing scripts that have been created in ARC be executed or run by depressing a button in the custom web server and how would this be accomplished?
Thanks Again for all your help and vwry quick responses. Very awesome support !
I was able to view foscam video in custom http webserver with no changes to code. Response time of stream could be better.
Still wondering if we can execute an existing script (say for instance using basic HTTPGet commands to control ptz function of camera and to turn IR LED'S on and off) by depressing buttons in http custom webserver and how this would be done. Thanks to you and ptp these commands for the foscam camera already work in ARC. I have simple scripts in ARC working to control these functions. Just need to make work in custom web server. Thanks again for your continued help !
I'll put some work in, probably tomorrow night, and post an example project. (wanted to work on it yesterday, but wound up having a production system problem at work that had me up all night).
Thanks much and I will await your update. In the meantime I will work on port forwarding the page. Do I port forward the http custom server ip address and port number or the ARC laptop ip address/port number?
I will work on it and let you know if I am successful. Thanks again Alan ! This is awesome ! Rick
from your Android phone.
You will want to set the IP address of your PC to a reserved IP in the router, or a static IP on the PC so that it is always the same or you will constantly be re-setting up the forwarding.
Your external IP address may change often, or may be the same for a long time. I have Verizon FiOS. My IP used to change any time I rebooted the router, but they made a change and I have had the same IP address for over a year. You can sign up for any one of many dynamic DNS servers so that you have a domain name that follows your IP address if it changes. Used to be free options, but now they all charge something.
Thanks much ! I will check it out and let you know how it goes. Thanks again ! Rick
I was able to complete the port forwarding to view the custom web server outside of my network. Thanks again ! I have a couple of questions regarding the custom web server page while awaiting on your progress with modifying the web page:
I know that I don't want to modify and save the example custom web server page that is in the ARC projects folder but would like to try and modify it to change the existing button to execute one of my existing scripts. They are labeled script1, script2, etc. How would I change the html page button code to execute one of these scripts and what is the best method to do this. Can you provide example code?
The actual code for the custom html server page is in the http server root directory. When I right click on the page and do a view source I get the actual code for the page. I did a copy and past and saved it as ez_robot_html as a text file in my documents directory temporarily. Once modified I assume this file goes back in the http server root directory, but then does it need to be renamed "default" and the original "default" file moved to a temp directory. The whole idea being not to write over or trash the original http custom web server page code. Do hope this makes sense and again thanks for your continuing help ! Rick
Yes, you will be able to execute your scripts, and I will be providing examples when I get time to work on this (been a horrible week at work. I need another vacation).
It would be best if your scripts were in a script manager control and had meaningful names instead of just script1, script2, but I'll make examples of both.
Yes, your page will be called default.html, and it is a good idea to keep a backup of it any time you make a change. I believe it gets over-written whenever ARC is updated, so you don't want to lose work on a custom page unexpectedly.
Not sure what is going on. I saved the original default.html file in a different directory then deleted the default.html file from the http custom server root directory. I then made a copy of the original default.html file and renamed it default1.html. I then opened the default1.html file in notepad and modified the button that says hello world to speak something different. I saved it and then copied the file into the server root directory and renamed it default.html and saved. I started the custom web server and could no longer access the page from my phone. It gave me the 404 error code. It seems that if you change the default.html file in any way it does not work on the phone. All I did was change what was spoken when you push the hello world button. Maybe somewhere the date of creation of the file is checked before the page is run. Very frustrating. I put the original default.html file back in root directory and it ran fine on the phone. Any suggestions on what might be going on here would be much appreciated.
Also, I noticed that the button uses the "say" command and the speech is played on the pc speaker. Is it possible to use the " SayEZB command in the custom server web page? Does it have to be all lower case or like above as it is used in ARC scripting? Thanks again for all your help ! Rick *stress*
Yes, you can use sayers or any other EZB script command.
In notepad I saved the file as an .htm file.
When I look at the properties of the file it says it is an html file. Is this ok to do or do I have to use .html as the extention? What is the difference if any in saving it as .htm or .html?
I notice in looking at the code for the web page that the button command for playing speech thru the pc speaker is all lower case (say) and in ARC script it is (Say). Does this mean to play the speech thru the ezb speaker we could use (sayezb) or would it be (SayEZB) as in ARC scripting?
Thanks again for all your help ! Rick
EZ script is not case sensitive. The capitalization is just used for readability.
Thanks much, I will give it a try and let you know what I find out. Also when I modified the file, before I could change the code I had to change this file and the folder it was in (http server root) from read only to read and write. Does this need to be changed back to read only? I wouldn't think so?
Also, I mentioned I have a single script I would like to execute with a button on the custom web server page. Would this be the way I would do this as far as the ez-scripting goes?
ControlCommand ("Script 4", ScriptStart)
Do you have to include scriptstart and if so do you have to include a scriptstop somewhere and where would it be included if it is needed?
Thanks again Alan !
I have been working on setting this up. For the left/right/up/down camera buttons, do you want it to go until you hit the stop button, or maybe go for a second and stop on its own, so you can move it in steps if you are remote and the web response is a little slow?
I am building a script manager control with all of the movements, and using variables for the host, port, username and password so it is generic and can be used by anyone, but tailoring it to your needs for now as far as what the script functions do.
I have a script (Script 4) that uses an HTTPGet statement to move the camera right for a given amount of time determined by a sleep statement. It uses one httpget statement to start camera moving right then waits a given period of time and uses another httpget statement with the "camera stop" command to stop the pan right. Having the pan/tilt move a certain amount of time and then stop is preferable.
I was able to modify the button EZ-Script command in the custom web server to execute the pan right script (Script 4) and it worked well. I'm real interested to see how you add the movement buttons for the camera and to see how you align this with the other items on the page.
Would like to have two custom web server pages that are separate and the only difference being one would use Movement Panel for adventure robot and the other would use the Movement Panel for the I-Robot Create 2. Eventually the Foscam camera will be installed on the I-Robot Create 2 base. Is it possible to control the Create 2 base from the custom web server? I would assume so.
The other issue of course is the delay in the camera video stream. I remember you mentioning possibly putting it in an i-frame in the page if DJ hasn't gotten the jpeg stream working in ARC. Any thoughts what you might do in the interim?
Also, can we add a couple of buttons to the page for IR ON and IR OFF? I have scripts working to do both of these functions.
It also appears that one needs to use default.html and not default.htm. I found that the easiest way to make changes to the page is to use notepad and go to documents file and open up http server root directory and open default.html file, modify it and then save.
Thanks again Alan for such great work and I hope work is going much better for you this week ! Rick
The only difference will be whether the web page connects directly to the Foscam stream or uses the EZ-B project camera object. Going directly to the Foscam you will need to edit one line in the html page to make it see your camera with your credentials. I'll provide instructions and comments in the html about what needs changing.
Also, rather than replacing default.html I will make 2 seperate pages, and you will include them in your url. Again, I'll provide full instructions.
I may have something for you to test tonight or tomorrow night. I made a lot of progress today.
Thanks much and pretty exciting! Thanks for all your hard work ! Look forward to testing your pages ! Rick
I noticed that when I activate the custom web server in my project sometimes I get the following exception error:
"Object reference not set to an instance of an object"
It does not happen all the time. It is intermittent. Not sure what is up with this?
I did change the custom EZ-Script button to the following: ControlCommand ("Script 4",ScriptStart). When I depress the button it pans camera right as it should. Just wondering if I should have a ControlCommand ("script 4",ScriptStop) coomand in the server page or the (Script 4) itself? When I quit the server and enable it again before I do anything with the page, it comes up with this error. Not sure what might be going on here? When this error comes up I have to exit the program from the task manager or it will start deleting controls from my project page. Problem seems to be related to the http custom server. It should be noted I'm not using the script manager control. Any thoughts on this would be much appreciated and thanks again ! Rick
I just got home from the hospital after having a procedure to place a stint in one of my arteries. It went well, but I can't do anything for at least a week. I have a plug in the groin area where they went in with their stuff and if it comes out I am in big trouble !
Therefore, I will be a couch potato for at least a week. Oh joys. I will have lots of time to work on testing the web page that you make up ! How is that project going. I know you were having some issues getting one software tool that could do both the layout for the page and integrate the code also. Let me know when you are ready as I am set to go for some testing.
By the way, does DJ have any resolution on getting the MJPEG Stream working with ARC and if not do you have a work-a-round for this issue?
Thanks Again Alan..........Rick
You'll know when I do if/when DJ fixes the mjpeg stream in the camera control because he'll post an update to ARC and it will be in the release notes, but yes, I have a workaround in the meantime.
Haven'heard from you in a while. Hope all is well with you ! Have you come up with any resolution for the foscam custom web page? Curious as to what you come up with? Thanks for your help !
I hear you about having to waste time on computers that are crashing and acting up ! Did you ever resolve if it was a problem with the computer or ARC?
Take care ! Rick
That is awesome ! Look forward to checking it out ! Rick
first, enable mjpeg streaming from your Foscam.
Download the two attached files.
Unzip foscam.zip to your ARC\HTTProot directory, so there is a foscam.html file in the root (every time you upgrade ARC, it over-writes the default.html file, so we don't want to use that one for customization).
Edit the foscam.html file. (I use notepad++, but notepad will work too). Near the top is a line that starts "iframe". Edit this line so it uses your camera's IP address, port, usr and password. If you are only using this on your network, this can be the internal IP address of hte camera. If you are using it outside your network and have port forwarded to the camera, then it is the external IP address or dynamic host name.
If you prefer to use the ARC camera object with the snapshot URL, delete the iframe line, and un-comment the following line which adds an EZ-B Camera object.
Now, you can either start with the Foscam-Control-EZB project and add your own camera object, movement panels, etc to it, or open your own project and merge in the FoscamScripts script manager control (and the variable watcher and http server (custom) if your project doesn't already have them).
Now, you need to edit one of the scripts in the FoscamScripts script manager. The CamInitialize script contains your camera IP address, port, username, and password. Edit it as needed. This can be the internal IP address of your camera, since it will be ARC, not the web page sending the commands to the camera.
Before running any of the other scripts, you must run the CamInitialize script. All of the others use variables that it initializes. If your project has an EZ-B, you can have your initialization script call this script with a control command, or there is also a button for it on the foscam.html web page.
You are now ready to start. Start the http server control.
From your browser, either on your computer or Android/iPhone device, go to http://YourEZBuilderIPadress:Port/foscam.html (ie, mine would be http://192.168.0.203:81/foscam.html -- this is the IP of your ARC, not your camera).
The page is laid out to look/work best in portrait mode on a phone.
Let me know if you have any questions.
That is Great,
I will give it a shot ! Haven't looked at it yet but as soon as I get back home I will check out. Just wondering if you had a chance to add buttons for IR ON and IR OFF? I have the command numbers if you need them. Thanks again...Rick
Only thing I didn't add is cruise because I haven't programmed a cruise pattern yet.
That is awesome ! I haven' programmed cruise yet either. Thanks again as always ! Rick
Awesome job ! I have the page working and it works perfectly. The video stream on my Android Phone is much faster ! I am sure you have seen this also. Your instructions were superb and if anyone deserves a bonus from ez-robot you would be the man !
I put the foscam-control.EZB file in the ARC My Projects Folder and it works great. I noticed that it has a long number displayed after the project title. Doesn't hurt anything but just wondering what this number is and if there is a way or a need to remove the long number? I noticed none of my other projects have this long number after their names. Just curious. Cant't thank you enough and being able to look at and see what you have done with the html page code is a great learning experience for myself and others ! Very awesome ! Rick
Thanks much ! You did an awesome job ! Rick
Once I figured out how it was working (and stopped trying to fix my crashing computer) it was fairly easy to set up.
Can we make the window for the video larger or wider? I'm thinking maybe you set up the size to get maximum speed out of the stream. Would this be correct?
If the size of the window could be made larger without sacrificing the speed of the stream, we could probably reduce the size of the robot Movement Panel to fit everything on the mobile screen ok.
My I-Robot Create 2 should be delivered today so was wondering if any thing needs to be changed for the custom page movement panel? Also I noticed there is quite a bit of space leftover on the right side of the phone display so would it be possible to add more buttons specifically to control I Create 2 functions?
Thanks again Alan ! This makes possible a pretty decent telepresence robot using the ezb-v4 and I Create 2 along with the Foscam Camera. What are your thoughts regarding this?
Take care and again thank you ! I can see this being an evolving project for us and others ! Rick
The H.323 stream supports higher resolution, but for that you need to use the EZ-B camera object instead, and you lose the fast video response.
That sounds good to me. I thought it might have something to do with speed but size is fine as is. I was just curious.
What are your thoughts on the Movement Panel for the I Create 2 platform? Would the page Movement Panel ad is need to be changed. My first guess is that it should work.
Also, can buttons be added to right side of page to accomadate some of the special functions of the Create 2 platform?
What is your thinking on using Create 2 platform along with ez-b4 and foscam camera for telepresense robot?
Thanks afain Alan ! Rick
Adding additional buttons is easy, just need to have scripts to map them to.
If I wanted to try and add buttons on the right side of the page, how would I go about positioning them? I see how the scripting is done but not clear on how you position buttons where you want them. Thanks again Alan ! Rick
The buttons are laid out in an HTML table.
Take a look at this page http://www.w3schools.com/html/html_tables.asp then look at the entries in the foscam.html file and it should make sense how it is set up.
Basically, there is one big table of three rows and one column. Each row holds one of three smaller tables. (this was done to make the buttons all align to the left of the page and look correct on a mobile screen. Without it, they centered on the web page, but that was not the center of the screen on the Android browser. Probably other ways to do this, but it was also how DJ had laid out the default, except he had 2 columns, with the video in the second column, and it seemed to make sense).
The first table is the movement panel, which is a 3x3 table, but some entries are empty, the second is the Foscam movement control, which is also 3x3, but all fields have a button in them, and the last is the additional controls, which is a 2x2 table.
You could add another table, or add a column or row to any of the existing ones, whichever makes the most sense.
I have been able to modify and add buttons to the custom web server thanks to your help but have run into an issue when trying to port forward the custom web server page. There is an IP address in the custom web server that it shows in the control and when I port forward that IP Address using the port forwarding address I get some unexpected results. I have two html pages in the HTTP Server Root directory. One is the default.html file and the other is the foscam.html file.
If I port forward the basic default html file the port forwarding works and I see the foscam video. However if I try and port forward the foscam html file the movement controls and buttons work in the page but no foscam video shows.
I tried renaming the default.html file to default1.html and I renamed the foscam.html file default.html. still no video display. Again the buttons and movement control display and work but the video doesn't show.
This doesn't make much sense to me. If the foscam video displays o.k. with the original default.html page why not in the modified foscam.html page? The only thing I am thinking is that you display the foscam video in the foscam.html page in an IFrame. Not sure why this would make a hill of beans to port forwarding as IFrames are commonly used in web pages?
Your help on this is much appreciated !Rick B.
Otherwise it is trying to display an internal ip address that cannot be seen from the Internet.
I explained this in my initial instructions :
Thanks much ! I forgot to modify the page with the external ip address. I will give that a shot.
One other quick question. The page works perfectly within my internal network, but I noticed that when using google chrome on my android phone that the video will go blank after an interval of time and I can get it back by swiping down with my finger inside the video window. Is there some kind of setting I need to change in google chrome?
I am coming along well on my create 2 security robot and should be posting something soon. Waiting for parts, etc.
Again, thanks much Alan !
Just wondering if you had a chance to try out the foscam custom web page issue I mentioned in the post above. On Android phone camera view disappears after 2 to 3 minutes or so and won't come back unless you swipe down with your finger in the video frame window. Seems to be a refresh issue maybe. Thanks for your help ! Rick