How to add the HTTP Server (Custom) robot skill
- Load the most recent release of ARC (Get ARC).
- Press the Project tab from the top menu bar in ARC.
- Press Add Robot Skill from the button ribbon bar in ARC.
- Choose the Remote Control category tab.
- Press the HTTP Server (Custom) icon to add the robot skill to your project.
Don't have a robot yet?
Follow the Getting Started Guide to build a robot and use the HTTP Server (Custom) robot skill.
How to use the HTTP Server (Custom) robot skill
This HTTP Server is different than the regular HTTP Server because it allows custom HTML Files. The HTML Files may contain special commands for controlling your robot
Supported file extension types:
- .HTML
- .JPG
- .PNG
- .CSS
The HTTP server will get the files from the My Documents\ARC\HTTP Server Root folder by default. This is found in your My Documents folder. In that folder, you can place HTML files, jpg files, png files, etc.. An example HTML file in the HTTP Server Root folder demonstrates the various syntaxes that can be used.
If your Windows installation already has a web server running on port 80, this server will not be able to start. Only one application can use a port at a time. If that is the case, disable the other web server or change the port for this server.
Embedded Control Syntax
Special HTML style tags are used to create buttons for interaction with ARC. These buttons are AJAX, which means they do not reload the page when pressed.
- <ez-move text="button title (i.e. Forward)" data-direction="forward" />
- <ez-move text="button title (i.e. Right)" data-direction="right" />
- <ez-move text="button title (i.e. Reverse)" data-direction="reverse" />
- <ez-move text="button title (i.e. Left)" data-direction="left" />
- <ez-move text="button title (i.e. Stop)" data-direction="stop" />
- <ez-script text="button title">ezscript command</ez-script>
- <ez-camera data-controlname="Camera" data-interval="100" />
- <ez-getdigital data-port="d0" data-interval="1000" data-truetext="True" data-truebgcolor="#00ff00" data-truefgcolor="#ffffff" data-falsetext="False" data-falsebgcolor="#ff0000" data-falsefgcolor="#ffffff" />
- <ez-variable data-variablename="$Direction" data-interval="1000" />
I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
FYI. I do not have any directories on my computer called EZ-Robot only Synthiam
I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
HTML:
```
<html>
<head>
<script>
function sendData() {
var data = document.getElementById("myInput").value;
var xhttp = new XMLHttpRequest();
xhttp.open("POST", "http://localhost:83/postdata");
xhttp.send("myData="+data);
}
</script>
</head>
<body>
<input type="text" id="myInput">
<button onclick="sendData()">Send Data</button>
</body>
</html>
```
EZ-Script:
```
ControlCommand("HTTP Server", HttpServerStart, "83")
:loop
IF($HTTP_POST_READY == "1")
$myData = $HTTP_POST["myData"]
$HTTP_POST_READY = 0
ENDIF
GOTO(loop)
```
This will send the value of the input field with an ID of "myInput" to the ARC HTTP Server at port 83 when the "Send Data" button is clicked. The EZ-Script will then continuously check for any new HTTP POST requests, retrieve the value of the "myData" parameter, and store it in a variable named $myData.
Here is an example of how to send data from ARC to the HTTP Custom Server:
HTML:
```
<html>
<head>
<script>
function receiveData(data) {
// Do something with the received data
}
</script>
</head>
<body>
</body>
</html>
```
EZ-Script:
```
$myData = "Hello, World!"
$HTTP_GET["myData"] = $myData
ControlCommand("HTTP Custom Server", HttpServerRefresh)
```
This will set the value of the "myData" parameter in the HTTP GET request to "Hello, World!" and refresh the HTTP Custom Server. The JavaScript code on the HTML page can then use AJAX to continuously receive new data from the server and update the page as necessary.
I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.