It's been requested so here it is... a quick (and brief) look at TELNET.
First off, you can view DJ's video on TELNET for some info on how it works, here it is...
Which is great and covers the TELNET application but if you want to use something else, say EventGhost you'll need to know how.
The first steps are the same, enable the server for the board(s) you want to control, DJ covered this in the video so I wont repeat it.
Now, in EventGhost you will need to add a Python Script. This is a very basic Python script I have knocked up to show it working. You may need to change IP addresses and ports to suit your ARC but that should be easy enough to see how.
In EventGhost I have a Python Script written;
from socket import *
import time
HOST = '192.168.0.100'
PORT = 6666
ADDR = (HOST,PORT)
BUFSIZE = 4096
cli = socket( AF_INET,SOCK_STREAM)
cli.connect ((ADDR))
data = cli.recv(BUFSIZE)
cli.send('$incoming = "Hello, I am Event Ghost"')
cli.send('\n')
cli.close
HOST and PORT may need changing for you. This script simply sets a variable $incoming to be "Hello, I am Event Ghost". Run it and the command is sent to ARC, the variable is set.
I have added a simple EZ-Script to ARC, something that will use the variable that was set.
# Set up the variable so that it exists
$incoming = 0
# Set up a loop
:loop
# Wait until data received from EventGhost
WaitForChange($incoming)
# Speak the incoming text
SayWait($incoming)
# Loop back to the start
Goto(loop)
Now, the Python script will set the variable $incoming to the specified phrase, the script will see the change and will speak the phrase.
Also added is the Variable Watcher, which should show a change in the variable.
Also the debug window is added so you can see the connection happen.
Hopefully (it's currently uploading) here is a video of the example code above working and ARC being controlled by EventGhost... NOTE: TURN DOWN YOUR VOLUME! The sound went a bit wrong, I guess I forgot to set the audio device and it used the mic not the speakers so sound is messed up and very loud.
I also showed some other script commands, however the servo one didn't work but that was due to not being connected to an EZ-B at the time of testing. I'm too lazy to cut it out of the video.
Hopefully that should give an indication in to how to get EventGhost (or anything that uses Python) to talk to ARC. Writing the Python scripts is a more in depth process and there is a multitude of resources on the internet which should be able to help you work out how to write the code which sends other variables in to ARC (I am unable to show my code which creates the cli.send at this time due to a whole bunch of things that are going on with Jarvis right now - sorry it's vague, I wish I could say more).
How about EZ-B talking back to an app (like Eventghost?). I see script commands for http gets, file IO, twitter posting, and executing apps form the command line, but I don't see anything for simple tcp communication (telnet). Am I missing it, or is this currently a one way interface?
Although any of the above could be used for integration to external apps, I agree with you that telnet is incredibly simple text based protocol with no particular required nomenclature, which gives a lot of freedom when creating external interfaces (and most important for me, I already have experience writing apps with it in VB, so the transition to .NET when I finally get around to it should be easy).
There was some recent discussion about a plugin framework for EZ-B to interface with 3rd party SDK's, and I understand DJ's reluctance on that front since it is impossible to guarantee code quality, but really, as long as we have simple communication methods to external apps, and those apps have SDK's or already support those interfaces, there is no particular reason a plugin needs to exist within EZ-B. Just write a script to send commands to the external app.
Alan
This example was only one way communication, to send information to ARC from other apps, trigger scripts, move servos etc. mainly to show @irobot as he requested in a different thread which I didn't feel should be hijacked with this, it is not intended as a tutorial (hence no tutorial flag on the post). Currently I only use one way communication with ARC and I have no intention on requiring two way communication however when I have more time on my hands I'll look in to two way communication over telnet.
Ideally it will spur others to discuss their telnet methods etc. though.
Awesome @Rich! above and beyond the call of "request" thank you so much ! Your explanation is "rich" with detail and substance, while you might not call it a tutorial I certainly do! I now have lots to study this evening and imagine/create how I will use it! I have last night (til midnite, and I know Rich and DJ put in those hours ALL the time) completed a number of EG "action s " to begin listening to music from online and from my own collection. Now I want to have ARC talk to EG I have seen DJ's tutorial before but didn't fully realize its "scope" Soooo with a demo bot set up in DJ's workplace someone from the UK or south Carolina or Salt Spring Island can control it! I think that would be awesome media/fun/social event sometime to set up ....@DJ ....what do you think of that idea? Perhaps when the EZ V4 has arrived!
Midnight is early for me lol (I am posting this at 1:55am! Edit: it was 2:06am when I finished writing it)
The above example would control ARC from EventGhost rather than send EventGhost data from ARC, I don't have anything where ARC talks to EventGhost but I will look in to it when I get the chance, I don't expect it's too difficult.
Some examples of what I use (or plan to use more to the point, since Melvin isn't finished and has once again been put to one side) EventGhost and ARC for are; To tell the robot what music is being played, rather than relying on listening with microphones he is told over telnet. This enables cool little gimmicks like him suddenly shouting out "Oh I love this song" or starting to dance. To tell the robot what film is on, including the exact part of the film. This enables more gimmicks like him laughing if he is watching it, hiding, screaming, reciting the words to his favourite parts. To tell the robot the current room temperatures. To tell the robot the current load on the power. To tell the robot which appliances are on and off along with any changes of status - for instance if the washing machine finishes a wash the robot could switch to face tracking, find a face and then say "the washing has finished". To tell the robot if any new TV shows, films or music have been added to the library. To tell the robot if there is a power failure (after detection by the UPS) so it can safely shut down before the PC running ARC shuts down.
Mainly, it's gimmicks and little scripts to make the robot seem more lifelike but I am sure there are a whole lot of other functions that could be thought up, especially since EventGhost can control and monitor anything on the PC.
Also, with even the V3 the robot could be easily controlled from anywhere in the world. That's the beauty of the HTTP Server control
But better still, with Telnet/server enabled in the connection options you can connect a copy of ARC from one PC to another copy of ARC running on a different PC halfway around the world. I have tested it from work to home before and it worked very well (you just need to port forward the correct ports (defaults to 6666) to the correct internal IP address)
Perfect! Great explanation...That's exactly the kind of activity/behavior I want from a robot! Jarvis is amazing but I am inclined towards something interactive and mobile..In your last paragraph you described something I have suggested to DJ as a media/promotion/fun day were Forum members could control a demobot based in Calgary from any of the Forum members ...like from the UK ,France, Netherlands ,West Coast of British Columbia(
)...we'll see what he says.. I think your idea of EZ-Robot paired with something like EG and Telnet will greatly add to "Revolution" ...IMO
Hey Rich,
You mentioned the possibility of sharing your thinking about the two way communication with ARC....
"I don't have anything where ARC talks to EventGhost but I will look in to it when I get the chance, I don't expect it's too difficult."
I've got ARC responding to Eventghost but what about the other way round?
What would be your IMO on the subject?
@Tameion
The other way around, I have something somewhere... I've not touched on it for a while and all I have saved in EventGhost is the following very rough and quick python example...
This basically creates the variable (or updates the variable) $incoming to be set to "Hello ARC"
Sorry, I read too quick, you want EG to respond to something ARC sends?
I did do this too, I'll see what I can find.