Web Remote Control - in beta

Hi all,

I've been putting together a little rudimentary remote control for Marty. It's not quite ready for release yet, but it would be good to get a few people trying it out and checking for errors

You can get to it at http://docs.robotical.io/rc/rc.html.

Remote control

It gives you a few buttons to control Marty, as well as a D-Pad and an analog joystick for moving Marty around

It uses the same Marty scanning as the calibration/Scratch etc. Still working on making that better for mobile devices, but interestingly I've found it seems to work a lot better in Firefox

All feedback welcome!



Leave a comment and join the discussion here

Please Log In or Sign Up to write a comment response

10 Responses


Hi Assadollahi,

There are one or two things you need to try out before 'installing' the file with the modifications on your mobile phone.

You probably realise already that, in order to use a phone as a remote control and with the freedom to use the remote at any location, possibly when there is no easy access to a wireless network and the internet, one first needs to save a local copy of Robotical's http://docs.robotical.io/rc/rc.html web page on the phone or PC. When you save that page, for example, using Firefox or Chrome on your PC, it will probably be saved in the PC's 'downloads' folder. The html file of the remote control web page, called rc.html, will be saved with a new filename, something like Robotical_Remote_Control with an htm or html extension. Additional files are saved in a new folder within the downloads folder. Those extra files contain the code needed to provide all the functions of the web page. The name of the new folder will be something like Robotical_Remote_Control_files. This may seem complicated but is fairly straightforward in practice. Many will have used this method already for offline viewing of a web page. It is commonly referred to as 'saving a web page' - but note that we do not want to save as a PDF.

Of course, there is another reason for using a local copy of these files. We cannot add the extra control functions without first downloading the web page. We cannot modify that web page sitting on the Robotical web server but we can edit the copy of that html file once it is downloaded and saved on a phone or on a PC. Most people will not want to edit the html file themselves. All they want is an updated html file that contains any new buttons and functions so that they can replace the original html file with the new version.

So, you can see that there are two reasons why we need a local copy of the web page for offline use. Before we can make use of a modified html file we have to go through the process of downloading the original html and the associated files. Then you replace the original html with the modified version and leave the original associated files in place.

Fortunately, saving the html file and the associated folder of files to your PC is easy using the Firefox or the Chrome browser. It is much easier to use a PC in the first instance and so you should check that the Remote control running with local files works correctly on a PC/Laptop before replacing the html file with the new version and before attempting to replicate the setup on your phone. I'll get back to you in a few days. You may be happy to download those files with Firefox without any instruction. In the mean time, Robotical may make modifications to their beta version to incorporate extra functions. If they do it is still very useful to use local files because you are then no longer reliant on a fixed wireless LAN and an internet connection.

Just to give you some insight, here's an example of the simple editing of the javascript code in the robotical html file. The original robotical file shows the move forward function:

function forward(marty) {
  marty.walk(1, 0, 1500, 40, "any");

It is as simple as that. The time interval for one step is 1500ms or 1.5 seconds.

Here's the modification:

function forward(marty) {
  if (fast == 0) {
    marty.walk(1, 0, 1500, 40, "any");} // edit 26 Oct
  else {
    marty.walk(1, 0, 750, 40, "any");}

'fast' is a variable, like a switch, which is set to zero (0) for slow and set to one (1) for fast.

You can see that:

if fast equals zero the time interval is a slow 1500ms

else if fast has some other value (example, if fast equals one) then the time interval is a faster 750ms

750ms is twice as fast as 1500ms

There are other more elegant ways of writing that code but I prefer the simple approach - particularly when teaching a child to code.

You can see that changing the code is fairly simple - creating the extra buttons required more work.


14:36:01, 06th November 2017  *   |   Permalink   |   View Source

@peter broadford, are you planning to release the code? it would be great to learn from you.

09:59:12, 06th November 2017   |   Permalink   |   View Source

In a previous post I suggested some extra buttons for the remote control. They are shown below in portrait mode. The buttons are smaller to fit the display on my phone and to accommodate the extra buttons.

The three extras are: Celebrate, Move Fast, Move Slow

Marty Alternative Remote Control

The extra functionality is provided by a few simple mods to the javascript functions in the html file, which is then saved in the download folder of the mobile device.

If you tap Move Fast the movement, apart from the Left and Right sidesteps, speeds up. The walk forward, walk backward and the joystick movements are then twice as fast. The dance and the celebration dance routines are 50% faster. The Left and Right arm movements are not affected. Pressing Move Slow resets to the lower speed.

If you do speed up Marty then he may fall. A smooth, level surface is important. After tapping Move Fast then Marty will remain in fast mode until Move Slow is tapped.

Using an Android phone remote control is ideal for demonstrating Marty, for example to a class of young students. You only need a phone or tablet - and no need for internet access. The WLAN network is provided by the phone's or tablet's portable hotspot and the phone's mobile data can be switched off.

It is sensible to start with Move Slow (the default) followed by the fast button. Increasing from slow to fast, with the Celebrate routine in particular, the mobility of Marty is impressive and amusing.

23:26:06, 05th November 2017  *   |   Permalink   |   View Source
23:09:18, 29th October 2017

i like it! having read the previous comments, in particular peter broadford I will have to try it with my Android phone. As you will see from my posts and comments on the forum I have been havjng issues using Marty anywhere but home!

11:04:40, 24th October 2017   |   Permalink   |   View Source

This controller is a massive step forward for Marty - and is a literal step in every direction. I've been working on IT projects with my coding buddy, Marcus, since he was six or seven. He has coded in Scratch since about then - he is now eleven. Naturally, we thought that ScratchX would be an ideal platform for Marty. The Marty ScratchX extension is excellent and within seconds Marcus was coding dance routines. That was a relief. Without that encouragement and insight into Marty's possibilities then I suspect Marcus would have given up on Marty.

However, we moved from Scratch to a game pad using Python (on Raspbian) just last week. Marcus wanted Marty to be portable and controllable from a game controller or some alternative remote control. We had previously used a simple TV remote and a photodiode IR receiver circuit to control a robot arm and so controlling Marty using a wireless LAN seemed too complicated. If he took Marty to his local Scouts group or a school hobby club then how would he get it to work? Would there be access to WLAN?

One idea was to use a portable Raspberry Pi and 7" touch screen instead of a PC for portability and to use a wireless game controller tethered to the Pi. We followed your very helpful instructions on how to "Control your Marty with a Gamepad using Python" but, you still need a WLAN. We tried this in house using a standard monitor. The XBox One Wi-Fi controller will not work with Linux and so we used a cable connection, got it working over the weekend, programmed the controller buttons and for the first time were able to control Marty real-time using Raspbian on the Pi. However, did I really want to buy a wireless controller and the 7" screen? No. Then yesterday noticed again this thread on Web Remote - but this time read it properly and realised that it was almost exactly what was required.

The problem of portable Wi-Fi was solved using the hotspot on my Android phone. I would prefer to be able to control Marty directly from a remote control but using a tablet or phone as the 'remote' is far superior to using a Pi and an expensive, small touch screen. So last night I tried your Web Remote and was amazed how effective it is. I was already using the hotspot on my phone as the WLAN router with the Ras Pi and Xbox remote and so just substituted your Web Remote running on an iPhone. Then this a.m. realised that I may be able to use the Android phone as both the hotspot and the remote - and it worked.

To conclude, all you need is the mobile phone for both the WLAN and the remote control - and, of course, Marty. Marty is then fully portable. You do not even need access to the internet. As a test I switched off all internet access to the phone, including the SIM card data. I have not tested with a tablet yet but this solution should work. Without internet you have to run the Web Remote web page robotical.io/rc/rc.html locally. I saved it as an HTML using the Firefox Android app.

The Android hotspot uses IP addresses: 192.168.43.x

Thank you, Sandy. You and the team have done an amazing job of developing Marty and getting it into production.

Controlling Marty with your remote makes it instantly accessible and could encourage more children to persevere with the programming.

The Thumbstick is impressive - was surprised it works. Any chance of an extra set of buttons with more functions. Can you include a button to set a "fast" flag? Pressing that button followed by, for example, Dance, could perhaps then be used to speed the dance. Also, perhaps you can reduce the size of the buttons. On my phone, in portrait, you have to scroll to see the Get Ready button.

Regards, Peter

21:19:06, 23rd October 2017  *   |   Permalink   |   View Source

works like a charm on my galaxy tab 8, chrome browser. you should DEFINETLY integrate this script right behind the "calibration" dialog instead of the "walk" button. my kids (6 & 8) were helping me to assemble the bot and it is really a gap between end of assembly and really gettingm marty to do something (e.g. via scratch, since my kids don't know how to write software etc). so this script is really helping them to understand what the bot can do and nextt step was immediately to put marty on the soccer field and let him kick the ball!

18:38:19, 30th September 2017   |   Permalink   |   View Source


Ubuntu / Firefox and Ubuntu / Chromium work without any issues (except that finding Marty without specifying the IP works only 50/50 for me - as it does in calibration etc.)

On my Jolla phone, the thumbstick works like a charm. But the D-Pad and the buttons did not react most of the time. About 1 in 20 hits did anything. I couldn't reproduce, why and when, though.

Cheers, Andreas

12:04:24, 24th September 2017   |   Permalink   |   View Source

Very useful demonstration, and picked up Marty first time on a network.

20:34:15, 23rd September 2017   |   Permalink   |   View Source

Really nice. I think it is very useful to have a simple and accessible way of interacting directly with Marty.

After building and calibrating Marty this would make a great "What do I do next?" step.

I particularly like the analogue joystick - it is pleasing to see Marty walking and turning with a constant step rhythm. Quite amusing how he can get about faster going sideways!

Just tested it quickly on a few platforms

imac / firefox - all good

imac / safari - all good

samsung galaxy tab S / chrome - all good

chuwi hi12 android tablet / chrome - all good

iphone 6 / safari - all worked apart from D-pad triangles (strange)

oukitel android phone / chrome - can't find Marty when scanning (however same phone can find and calibrate Marty using calibration tool)


16:31:42, 17th September 2017  *   |   Permalink   |   View Source