Asked — Edited
Resolved Resolved by DJ Sures!

Execute Scripts Or Commands With Http Get Commands

I think this is possible and has been discussed, but I can not find it. Is there a format to execute scripts or commands using an application that can send HTTP GET or POST commands but not be using a web browser, either with the HTTP Server or HTTP Server (custom).

I don't think I can do it with the HTTP Custom because it uses AJAX and I don't know how I would format a request (and unfortunately, the documentation is fairly minimal) but I thought someone was already doing this with the simple HTTP server, embedding the user name and hte request in the URL of the GET.

I also know I can do this with Telnet using the TCP Clients object, and I may use that for my solution, but it is a little more limiting.

I'll explain my goal in case it provides any other thought.

I want to be able to drive my robot from my Android phone or an Android Wear smartwatch. I don't want to use the mobile interface, I want to have an embedded computer running ARC performing a number of tasks, the remote interface just to give additional commands.

I have two applications that can easily send HTTP Get or Post requests and allow me to build custom interfaces. Anymote smart remote, and Tasker. With a Tasker plugin I can also send Telnet requests, and I may wind up going in that direction if I am wrong that this can't be done with one of the web servers, but that isn't really the direction I wanted to go. (I think I could also do it using Eventghost to receive the HTTP requests and then send telnet requests to ARC, and I am sure I could write a plugin or do something with the SDK once my C# skills are up to speed, but I could swear this is existing functionality and I just can't find the right nomenclature for the command).

Alan


ARC Pro

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.

PRO
Synthiam
#1  

Create a plugin. It will only be a few lines of code.

Or

Use the telnet server.

The telnet server makes the most sense. Sinply send the command with a terminated \r\n

The plugin would end up reproducing the telnet server. If you're idea is to have the watch control the robot, I could consider what it takes to add the telnet server to the mobile app.

#2  

Thanks DJ.

I must have been mis-remembering that this could be done via HTTP.

I explicitly don't want this in the mobile app (although others might). It is for providing remote control of a robot that will have an embedded Windows computer.

Short term, I can use the Tasker plugin to create buttons for the Telnet commands, and I will add this to my list of things I want to do with the plugin when I finally have time to learn a little C#. In fact, it fits perfectly with my plans to make an IFTTT plugin, so I might be able to kill two birds with one stone.

Alan

PRO
Synthiam
#3  

Is Tasker the name of the plugin you want to create?

Is the idea to not send ezscript commands and send other commands instead? Is this because ezscript commands are too lengthy? Ie forward() or stop()? Would your commands be shorter in length or something?

I'd like to get a better understanding of the initiative to use a plugin instead of the telnet server.

#4  

Tasker is an Android app that can do many many things based on many many triggers. It also has a plugin architecture. One of its plugins is a Telnet client, where I can set up specific sequences of tenet commands (a built in function is Get URL, which is where I was starting).

You can use Tasker to create simple Android apps that execute these tasks, or trigger them from any number of other events that Android can see.

There is also an Android Wear Smartwatch plugin for Tasker that can make simple UI's.

So what I am going to build with this, is a simple UI similar to what you did for the Apple Watch that sends forward, reverse, left, right, and stop commands (and maybe some others) to my robot from my new LG Urbane smartwatch (that was just delivered 30 minutes ago).

I probably don't need to make a plugin for this capability except for the fact that Tasker and the two Tasker plugins needed to make this work are all paid apps, and on the more expensive side for Android, and takes a bit of configuration to set up, so if others want to do the same, it will be more complex than if I can write a plugin and an Android Wear app.

I have also been thinking of how to best do an IFTTT plugin. It is easy using the IFTTT Maker channel to have a robot send events, but more difficult to make it respond. If I ARC could take actions based on GET requests without opening a web page, then the Maker channel could be used for both directions of communication, so building a integration web service plugin would be a nice challenge for me.

Alan

Alan

PRO
Synthiam
#5  

Ah i see.

The ifft I have looked into. I was so frustrated with their terrible api that I wasn't able to continue developing.

If you were to make one, the plugin would only be difficult because their api is so terrible. Thinking about reading their api pages again gives me the shakes!

#6  

That is why I wanted to take advantage of the existing Maker channel. As long as I can make the web page "internet visible" which is not difficult in my environment since I have my own domain and Dynamic DNS service, the Maker channel can do a GET or POST request. So all I would be to create a web interface that can pass credentials and script commands from a single GET or POST.

Would not be easy for all ARC users, but with good documentation I think it could be useful.

It can also be done with EventGhost hosting the web commands and sending to ARC with the telnet interface, but that adds another layer that can break, and more to configure.

Alan

#7  

I use IFTTT a lot to trigger some actions in and by ARC, but I have to follow complex paths for that. I use recipes with Dropbox: I make ARC write files/take pictures in Dropbox to trigger external actions by IFTTT and the other way I make Dropbox write .txt files and ARC read them in scripts.

I would love to see an IFTTT plugin (no pressure Alan ;)) and it's a shame their api is so terrible. (It is also a shame I am not capable of writing a plugin, but that's another story :D)

Fred

#8  

At this point, I think you are as capable of writing a plugin as I am. I need to learn C#. I am a fairly accomplished VB6 developer, but VB6 is so old it can't even be installed on anything newer than WindowsXP, and the new languages are completely different, so I am pretty much starting from scratch.

Alan

PRO
Synthiam
#9  

C# sounds intimidating because it has the letter C in it. The only reason for the C is the inspired syntax. But I assure you, that c# is the best programming language since basic on my Apple ][ :)

The great thing about visual studio is syntax completion. Every time you press the . button after a namespace/class/method, there is a popup of optional children. And then once you select the child, you can scroll through overrides (different uses of the command). It's amazing how self documenting C# is because of that intellisense.

Another great feature of C# is that it's very "basic-like". Meaning, basic has become more complicated than C# to do anything at all. When i read about people using VB.Net, i shake my head at how frustrated they must be to get anything done. If they just used the energy to learn C# rather than be frustrated, life would be grand.

The flexibility of C# is really where it helps programmers like me. Obviously I have quite the range of programming environment ability, as the ez-robot products demonstrate. From assembler, to C to C++ to C# to HTML to Javascript etc etc etc... The language i prefer is C#. This is because you can start small, such as the plugin tutorial demonstrates. And once you really get the language, you can start digging deep into direct memory access (which is called unsafe in C#). You can even use pinvokes to execute C/C++ unmanaged code. And if you're a C++ programmer, you can (i don't know why anyone would) use CLR.

There's a pile of benchmarks out there - and if you look, it's interesting to notice the performance benefits of C# as well. This is because unlike native code, the .net runtime can perform ahead of time pre-compiling and re-using object memory. I can go on for ever about how great the performance is and why...

Lastly, say good bye to buffer overflows with C#! Unless you're using unsafe{}, but that's for experienced C++ programmers that want access to memory via pointers.

So, visit the plugin tutorial and try it out. It's not hard!

PRO
USA
#10  

@Alan,

1) a web http frontend app (some buttons) is not enough ?

2) expose a http rest API and create an android widget, i never tried to build one, does the watch support widgets ?

PRO
Synthiam
#11  

That's a good question, ptp. You can easily create a plugin that hosts a webservice. That is a built-in feature of .Net which is super easy to create. If the watch has an app that can send/receive webservice based on a wsdl (or what ever xml template), the ARC skill plugin can accommodate.

PRO
USA
#12  

@DJ yes that is available and .net make the life easy,

the other side (watch) is the unknown part, trying to understand what could be used or Alan's idea.

not related with the initial question, since the first consumer smartphone (iphone) i stopped using a watch, i had the feeling that the watch concept was dead (excluding the apparel reasons), i m always with a phone near by me, so i still struggle to find a need for a smartwatch but if i had a car like the Knight Rider could make sense to talk to the watch....
it's interesting apple and others trying to bring the concept back ...

PRO
Synthiam
#13  

ptp, have you seen the ez-robot apple watch app? It's the only reason i have an apple watch. Soon you will be able to customize the apple watch app just like the ARC mobile interface. It's on the list, just haven't had time to finish it yet...

#14  

I am not aware of any Android apps, let alone Android Wear apps that allow you to call the web service of your choice. Certainly many of them use web services (all of the weather apps certainly do).

Interestingly, one of the reasons I haven't buckled down and taken on C# yet is that I also want to write some Android apps, and they has typically been done in Java in Eclipse. However, I just installed Visual Studio 2015 Community this weekend and see that it has Android App development, so it looks like I can potentially just learn C# and kill two birds with one stone (I haven't really looked to see if the Android development is actually done in C# or something else in the same IDE).

I have some other web service stuff I want to do as well, so that might be the direction I follow, and the EZ-B control app would just be 5 buttons with web service requests behind them, and maybe a settings screen to define the URL where the services are hosted, so should be pretty simple to write in any language.

Lots of food for thought.

Alan

PRO
Synthiam
#15  

it's Xamarin - which Microsoft has teamed up with for cross platform development on mobile. It's also what EZ-Robot uses for mobile.

It uses C# and "converts" the binary output to the native language. For example, on Android, the C# is binded to Java methods. On iOS the C# is compiled native to it's objective c.

The only down fall is the price. Xamarin is a few thousand dollars for a year subscription. As a corporation, it makes sense for us. This is also why the Android and iOS version of ARC Mobile is identify. They both share about 40% of the same code. That 40% of code relates to hundres of man hours per year, which justifies the cost.

However, Xamarin has so many bugs and poor implementation that 10% of development cycles are used to circumvent stuff they over looked. Implementing RoboScratch on Mobile, for example, was an absolute nitemare! You have no idea the number of GUI issues i suffered with, and their responses are never helpful. You have to learn to accept that they're doing anything about it :P

#16  

Hmm. I'll have to see how the licensing works in the Community Edition of VS. I suspect it will let me build apps for personal use but not distribute them.

Alan

PRO
Synthiam
#17  

Ironically: http://blogs.microsoft.com/blog/2016/02/24/microsoft-to-acquire-xamarin-and-empower-more-developers-to-build-apps-on-any-device/

Maybe this means the cost will go down. Or the bugs go up?

PRO
Belgium
#19  

dj

what type watch did you use.

#20  

Patrick, DJ used an Apple watch.

Alan

PRO
Belgium
#21  

yes i know but withs one,there are a bunch .

ps i found the config off jeremie adventure bot,how he did it. will post a pic soon.

#22  

I would love too see any IFTTT related plugin for ARC...just got me a FitBit so my robot will know if I slept well, and worked out! :D

It would really add up if you could use the Maker Channel bi directional! ;)

#23  

Quote:

yes i know but withs one,there are a bunch .

Apple Watches are all the same. Only difference is the band and finish. Android Wear watches there is some difference in features between brands , although not as much as in the phones.

Alan

#24  

Quote:

It would really add up if you could use the Maker Channel bi directional!

I agree, and it shouldn't be too hard. I think it would be possible to cobble something together with Eventghost and not need to write a plugin. Going to look into it the next couple of evenings when my wife is working late so I will be home alone for a while.

Going to start learning C# this weekend I think.

Alan

#25  

Quote:

I agree, and it shouldn't be too hard. I think it would be possible to cobble something together with Eventghost and not need to write a plugin. Going to look into it the next couple of evenings when my wife is working late so I will be home alone for a while.

Going to start learning C# this weekend I think.

Alan

Alan,

Have fun learning it! It is not nearly as hard as I expected it to be after hearing about C and C++. I am by no means a master, or even proficient in the language, but am having a blast with it. If you are looking for advice on learning materials I used lynda.com. It does have a monthly subscription but I have found it well worth it. They have an instructor named David Gassner, that has helped me understand many different concepts, in fact, I would say my JavaScript understanding has improved greatly because of how he explain object-oriented programming.

If you are looking for learning materials just let me know, I have quite a few.

Again, best of luck.

#26  

Thanks @mikebmac

I have a book to start, and some on-line resources I gathered a while ago. I'll touch base with you if I think I need more.

Alan

#27  

@Mickey666Maus

I found this old post from Rich about using the Eventghost HTTP server plugin to send Telnet commands to ARC: https://synthiam.com/Community/Questions/5128

This could easily be adapted to use with the IFTTT Maker channel. One warning though, the eventghost HTTP plugin is not really designed to be exposed to the Internet. It has very little security built in and has not been well tested for vulnerabilities. Writing an asp.net web page to interact with the ARC SDK would probably be the better way to do this since you can use the built in Windows web server, which is a little better, and there are published best practices for securing it.

Alan

#28  

Here is another option for IFTTT integration. IFTTT has a Twitter channel that can both respond to and send tweets.

ARC can send and respond to tweets.

Use the Twitter channel as the link between ARC and any other IFTTT channel (or still use hte Maker channel for having EZ-Robot initiate requests, and Twitter to communicate requests back). ( I had missed that EZ-Robot can react to tweets until someone else asked in this thread: https://synthiam.com/Tutorials/Help.aspx?id=170 )

Alan

#29  

Hey Alan, missed the one from five days ago...but will check it out now! Also the tweet option seems to be very interesting, I was researching on some Twitterbots recently...which could give you different flavors of implementing chatbots!

Lets see where this is taking us...I think also your research into Android wear is superawesome!

Lets try to keep the topic updated... ;)

#30  

So after reading this it made we wonder what would be the benefit of using the Telnet client over the HTTP server build into ARC? I am pretty new to this so forgive me if this is a stupid question... eek

I was able to connect IFTTT and also 3ds max (all Autodesk software is available free for students for 3 years at the moment, try it it is awesome!) to ARC using the HTTP server!

I was using the IFTTT DO button to move a servo which worked well, @Alan helped me to straighten things out with port forwarding my router! ;)

Also I was able to trigger events with the Maker Channel, so this is sort of the two way connection we were looking for right?

IFTTT is kind of limited there are more interesting things out there which are good open source IFTTT alternatives, but right now I am back to just constructing my robot physically, which is a lot of fun!

Talk to you guys soon :D

#33  

@Mickey666Maus, Thanks for the tip on how to do this in IFTTT !

I was able to duplicate your findings using Maker on IFTTT on simple commands like the Servo(d11,90) that didn't rely a return value like SayEZB("My voltage is" + GetVoltage() )

For the more complicated commands I created a script in EZB Script Manager and invoked it through IFTTT using ControlCommand ...It even worked on a complex action like DJ's battery level script.

IFTTT....... http://23.119.244.175:8020/Exec?password=admin&script=cc("Script Manager", ScriptStart, "battery level")

EZB script... SayEZB("I have " +round( ( ( getvoltage() - 7 ) / 1.2 ) * 100, 1 ) + " percent battery remaining")

Thanks, Frank

#34  

@Mickey666Maus I think there have been some updates to IFTTT and I'm now getting "Applet skipped" messages

Is it still working for you?

Regards, Frank

#35  

@faengelm,

Just wondering if you were able to determine why all of a sudden Ifttt is exibiting errors when communicating with ARC? Thanks much....Rick

#36  

Hello Rick, I haven't seen those messages again and I use IFTTT fairly often

But, the actual response times vary quite a bit... sometimes within a few seconds, sometimes over a minute on the same applet

Frank