Sighthound Cloud API icon Sighthound Cloud API Cloud-based detection of people and faces in robot camera video; returns locations, gender, age, pose, emotion, plus 68-point facial landmarks. Try it →
Asked — Edited
Running Your Bot Through A Custom Website/http Server Layout

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

Join the ARC Pro community and gain access to a wealth of resources and support, ensuring your robot's success.

#41  

Ahhhh I see it now. Hmmm... I guess I need another way to trigger scripts over the webserver. Any ideas people?

#42  

I am not sure if this will work but... try this?


      $.get(
        'https://localhost:8080/Exec';, {
          'password': 'admin',
          'script': 'controlcommand("Script Manager", ScriptStart, "script 1")'
        });
#43  

That didn't work, but thanks for the try.

Here's the camera code, which, if tweaked and reengineered, I think we can get it to do what we want it to do.

We'll need to takeout the reload interval, and change the address to what we need. for the html, i'm not sure. This script gets the url of the camera, so I wander if it could work for the scripts(it uses fragments of the address with variables).

<script type='text/javascript'>         
    function loadImage(imgID, address)         
    {             
        var now=new Date();
        document.getElementById(imgID).src='https://'; + address + '/CameraImage.jpg?c=Camera&Password=admin?'+now.getTime();
    }          

    setInterval(function() {
        loadImage("the_img_1", "192.168.0.115:8080");
    }, 100); //Interval to refresh at, in milliseconds
</script>

HTML(maybe change to a button):

<img id='the_img_1' src='https://localhost:8080/CameraImage.jpg?c=Camera'>;
#44  

That's going at the bottom of the page, right? It needs to either be at the bottom or use $(document).ready().

For the previous problem, does it work if you use encodeURIComponent(), eg.


'script': encodeURIComponent('controlcommand("Script Manager", ScriptStart, "script 1")')

and have you checked for errors in the javascript console?

#45  

The code I just posted was the canera code which I thought we could change to work with the script trigger idea. I'll test the encode idea when I get home.

#46  

Is that the camera code that ARC's web server creates?

It just requests an image every so often. Loading it into the page. I'm not sure how it will help you - you're just trying to trigger a script to load, right?

What I gave you should work I believe. There may be other problems stopping it from working. It would be best to check the console for errors.

#48  

That's good to hear! :) I thought it would. Was it with, or without, the encodeURIComponent()? I wasn't sure whether it would work better with, or without, that.