Asked — Edited

Running Your Bot Through A Custom Website/Http Server Layout

Hey guys. Little project I want to look into.

As I mentioned in this thread, I want to make a webpage/custom web server layout and run the ez-b through this. I have html background, so designing the webpage should be no problem, but I know little of getting ARC stuff into that page. I tried setting up the http server but it wouldn't work. So, who's up for helping me try this?


ARC Pro

Upgrade to ARC Pro

Take control of your robot's destiny by subscribing to Synthiam ARC Pro, and watch it evolve into a versatile and responsive machine.

#33  

Cool! I'm glad it's working out for you. I'd like to see it when it's done:D I haven't done much with the ARC web interface stuff yet, been so busy with other stuff. I need something to get me to play with it!

By the way, the "local version" is the same file that you'd run on the web server - only you'd place it in the web root of the local server and go to http://localhost:someport/mypage.html to see it:) So no changes really, it's just a difference in how you're opening/running/viewing the file.

#34  

It appears I'm having the problem you metioned with the Java script, Chrissi. Do I put the script after the </body> Tag or at the bottom of the body?

#35  

Right before the </body> tag!

#36  

Alpha release to try to figure out the Bugs.

1.Camera not working. 2. script trigger buttons not triggering 3. Help me clean it up! It is freaking messy!

Instructions: 1.Download folder. Unzip it(extract items out) 2. open the MTR.ezb project file and start the http server. Start camera too. 3. Open the index.html file in the downloaded file. Set your camera url in the camera java script(labeled)(same as ip as the main server) 4.Configure anything else in the script that is mentioned 5. Java/html people help me try and figure out the listed problems. Betabugrelease.zip Yes I know it says BETA^ Thanks for any help I receive! Tech

#37  

Here's the jquery script which needs to be added( it wasn't working):

&lt;!--JAVA SCRIPT SCRIPT TABLE--&gt;
&lt;script&gt;
$(document).ready(function(){
 $(&quot;.script1 button&quot;).click(function(){
 $.get(&quot;http://localhost:8080/Exec?password=admin&amp;script=ControlCommand(&quot;Script Manager&quot;, ScriptStart, &quot;script 1&quot;)&quot;,function(){
 });
 });
});
&lt;/script&gt;
&lt;script&gt;
$(document).ready(function(){
 $(&quot;.script2 button&quot;).click(function(){
 $.get(&quot;http://localhost:8080/Exec?password=admin&amp;script=ControlCommand(&quot;Script Manager&quot;, ScriptStart, &quot;script 2&quot;)&quot;,function(){
 });
 });
});
&lt;/script&gt;
&lt;script&gt;
$(document).ready(function(){
 $(&quot;.script3 button&quot;).click(function(){
 $.get(&quot;http://localhost:8080/Exec?password=admin&amp;script=ControlCommand(&quot;Script Manager&quot;, ScriptStart, &quot;script 3&quot;)&quot;,function(){
 });
 });
});
&lt;/script&gt;
&lt;script&gt;
$(document).ready(function(){
 $(&quot;.script4 button&quot;).click(function(){
 $.get(&quot;http://localhost:8080/Exec?password=admin&amp;script=ControlCommand(&quot;Script Manager&quot;, ScriptStart, &quot;script 4&quot;)&quot;,function(){
 });
 });
});
&lt;/script&gt;
&lt;script&gt;
$(document).ready(function(){
 $(&quot;.script5 button&quot;).click(function(){
 $.get(&quot;http://localhost:8080/Exec?password=admin&amp;script=ControlCommand(&quot;Script Manager&quot;, ScriptStart, &quot;script 5&quot;)&quot;,function(){
 });
 });
});
&lt;/script&gt;
&lt;script&gt;
$(document).ready(function(){
 $(&quot;.script6 button&quot;).click(function(){
 $.get(&quot;http://localhost:8080/Exec?password=admin&amp;script=ControlCommand(&quot;Script Manager&quot;, ScriptStart, &quot;script 6&quot;)&quot;,function(){
 });
 });
});
&lt;/script&gt;

&lt;script&gt;
$(document).ready(function(){
 $(&quot;.script7 button&quot;).click(function(){
 $.get(&quot;http://localhost:8080/Exec?password=admin&amp;script=ControlCommand(&quot;Script Manager&quot;, ScriptStart, &quot;script 7&quot;)&quot;,function(){
 });
 });
});
&lt;/script&gt;

&lt;script&gt;
$(document).ready(function(){
 $(&quot;.script8 button&quot;).click(function(){
 $.get(&quot;http://localhost:8080/Exec?password=admin&amp;script=ControlCommand(&quot;Script Manager&quot;, ScriptStart, &quot;script 8&quot;)&quot;,function(){
 });
 });
});
&lt;/script&gt;

&lt;script&gt;
$(document).ready(function(){
 $(&quot;.script9 button&quot;).click(function(){
 $.get(&quot;http://localhost:8080/Exec?password=admin&amp;script=ControlCommand(&quot;Script Manager&quot;, ScriptStart, &quot;script 9&quot;)&quot;,function(){
 });
 });
});
&lt;/script&gt;
&lt;script&gt;
$(document).ready(function(){
 $(&quot;.stopscript button&quot;).click(function(){
 $.get(&quot;http://localhost:8080/Exec?password=admin&amp;script=ControlCommand(&quot;Script Manager&quot;, ScriptStopAll)&quot;,function(){
 });
 });
});
&lt;/script&gt;
#38  

Update: Camera source code was fixed. Still not sure why the script buttons don't work.

#39  

After reading up on the earlier posts, I noticed that I Chrissi said

Quote:

You can put your script at the end of the page, or there is the deferred function $(document).ready() that you can use to make sure all the elements in the page have loaded before your script runs
so that means adding the script trigger scripts listed should be fine at the top, but it doesn't work!

URLs were checked, there fine. its gotta be the code!

Code for script 1-9(identical jquery):


jquery:

&lt;!--script 1--&gt;
 &lt;script&gt;
$(document).ready(function(){
 $(&quot;.script1 button&quot;).click(function(){
 $.get(&quot;http://localhost:8080/Exec?password=admin&amp;script=controlcommand(&quot;Script Manager&quot;, ScriptStart, &quot;script 1&quot;)&quot;,function(){
 });
 });
});
&lt;/script&gt;


HTML body:

&lt;div class=&quot;b3&quot;&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;Script starters&lt;/p&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;div class=&quot;script1&quot;&gt;&lt;button&gt;Script 1&lt;/button&gt;&lt;/div&gt;&lt;/td&gt;
&lt;td&gt;&lt;div class=&quot;script2&quot;&gt;&lt;button&gt;Script 2&lt;/button&gt;&lt;/div&gt;&lt;/td&gt;
&lt;td&gt;&lt;div class=&quot;script3&quot;&gt;&lt;button&gt;Script 3&lt;/button&gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;div class=&quot;script4&quot;&gt;&lt;button&gt;Script 4&lt;/button&gt;&lt;/div&gt;&lt;/td&gt;
&lt;td&gt;&lt;div class=&quot;script5&quot;&gt;&lt;button&gt;Script 5&lt;/button&gt;&lt;/div&gt;&lt;/td&gt;
&lt;td&gt;&lt;div class=&quot;script6&quot;&gt;&lt;button&gt;Script 6&lt;/button&gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;div class=&quot;script7&quot;&gt;&lt;button&gt;Script 7&lt;/button&gt;&lt;/div&gt;&lt;/td&gt;
&lt;td&gt;&lt;div class=&quot;script8&quot;&gt;&lt;button&gt;Script 8&lt;/button&gt;&lt;/div&gt;&lt;/td&gt;
&lt;td&gt;&lt;div class=&quot;script9&quot;&gt;&lt;button&gt;Script 9&lt;/button&gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;div class=&quot;Stopscript&quot;&gt;&lt;button&gt;Stop All&lt;/button&gt;&lt;/div&gt;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
#40  

You need to escape your quotation marks that are nested.

eg.


          $.get(&quot;http://localhost:8080/Exec?password=admin&amp;script=controlcommand(&quot;Script Manager&quot;, ScriptStart, &quot;script 1&quot;)&quot;,function(){

It's not working because the quotation mark in front of Script Manager is ending the string, and you're ending up with invalid Javascript.

Press F12 in your browser and you'll see the Javascript console. You can see errors there.

Also, if you use an editor with syntax highlighting like Visual Studio, Sublime Text, Notepad++, etc... you will see small mistakes like this.

I don't think putting information that needs to have quotation marks and spaces in the URL is a very good idea. You should see if you are able to post things to the page instead of putting it in the URL.

If you really need to do it like this... try running the URL through encodeURIComponent() first, and use single-quotes around the URL in $.get().