Tuesday, December 11, 2018

XMRemoteRobot - SignalR - nice messaging but watch out for the size limit

Early successes with SignalR for Internet communications got us thinking, "let's use SignalR for everything!". Sending images from the robot camera being first on our TODO list. As in see through the robot's eyes. We attempted sending images as "base64" strings. We can share with you that SignalR does not handle big strings in one message. When we tried this we had no error messages and apparently almost-working results like the first image received as a small black image. That looked promising enough to keep trying until we thought of  testing with smaller message sizes and our broken communications started working.

Time for a Google search. "signalr maximum text length" which found
"There's no maximum message size but we recommend < 32K per message" on the Github home site. ref: https://github.com/SignalR/SignalR/issues/1205

That got us trialling different sizes of messages on XMRemoteRobot with the finding that our maximum reliable message string length is 32700 characters.

We process the still images from our robots into 'base64' encoded strings of about 640K in length so that is not going to work as a single chunk. Next steps in this development:

A possible alternative. "Ricardo" writes about achieving video streaming without audio over SignalR:

Saturday, August 18, 2018

Big Update! XMRemoteRobot 2.0 speeds up with SignalR

Big advances in our open source server app for remote control and/or remote monitoring over the Public Internet.

XMRemoteRobot 2.0 is a major rewrite replacing "http long polling" with "signalr" giving faster, more direct communication. The latency (delay or lag time) is down to 10ms on local networks and 70ms over a 4000 km test. The new app replaces the database with in-memory objects. This means that the download is ready to run immediately in Visual Studio 2017. This also makes for easier  deployment..

Downloads and more details at: https://github.com/manukautech/XMRemoteRobot

Live Demo - test drive this app at:
https://xmrrnz.manukautech.info - Server located in Auckland, NZ.
https://xmrrae.azurewebsites.net - Server located in Azure "Australia East".
https://xmrrwu.azurewebsites.net - Server located in Azure "West US".
You can see the (low) latency at different distances.

For pages "Test01" and "Test02", commands travel from the left side of the page, to the server, then back to the robot code separated into an iframe on the right side of the page. Or to your smartphone-acting-as-robot when you navigate that to pages "Robot01" or "Robot02". Therefore multiply the distance to the server x 2 for the remote control distance.

"signalr" is a Microsoft-sponsored open source project which implements "WebSockets".

Sunday, June 24, 2018

Snake Robot moves faster - sideways

Snake Robot - moving faster. I would say "baby steps" meaning improvements in small steps except that snakes do not step, they have "gaits", so this is progressing by "baby gaits".

System voltage is up from 5V to 6V to get more servo torque. Achieved by replacing step-down "buck" voltage regulators with "buck-boost" regulators which have both step up and step down capability. This means that they can maintain 6V over the range of 2-cell lithium battery supply voltage: starting at 8.4V and dropping in use as they drain to the lowest operational limit of 6.4V.

More important: A new programming approach for gaits that makes development easier and the code more self documenting. With this comes the programming of new gaits that perform well along my workbench but not so well across the floor. Except for "rectilinear reverse inchworm double wave ripple" which does move faster, but sideways, which is a surprise, very different to the programming good intentions. Great movement, now we only need to sort out the lesser issue of going where we command.

XMSnakeRobot is an open source project (Apache License) with programming code and designs published on "Github".

Gait coding:

Coding in JavaScript for the best gait so far, the "rectilinear reverse inchworm double wave ripple", is pasted below.
Gait "functions" now consist of data in arrays specifying cycles of servo angles. These arrays are interpreted by common code in the main program.

function Gait02() {

    var vert = [
        [-30,  20,  20, -20,   0, -20,  20,  20, -20,   0],
        [-10, -20,  20,  20, -20,   0, -20,  20,  20, -22],
        [-10,   0, -20,  20,  20, -20,   0, -20,  20,  15],
        [-10,   0,   0, -20,  20,  20, -20,   0, -20,  40],
        [-30,  40, -20,   0, -20,  20,  20, -20,   0,   0]

    var horiz = [
        [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0],
        [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0],
        [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0],
        [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0],
        [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0]

    return [vert, horiz];

Saturday, January 20, 2018

XMSnakeRobot - Review of a possible robot brain - SmartWatch X01S Android 5.1

Our small robots need small but powerful Android devices as a central controller computer ie "brain". We have been using low cost Vodafone VFD 300 SmartPhones but they are a little large and heavy for our new robot designs. Preferably running the same Android OS with the capability of programming in JavaScript using the DroidScript framework. We also need a sideways pointing camera,

The candidate devices are:

"X01S SmartWatch" - currently testing. Good results so far, details below. At 64g it is a little heavy but physical size is good and it has full Android 5.1 features and good performance with 1 Gig of RAM which is better than the 500 Meg of the VFD 300 and the other candidates..

"QW09 SmartWatch" - we have bought and tested a "DZ09" which is the same physical hardware with a "Nucleus" operating system. We were unable to program the "DZ09". We do discover that it has a sideways pointing camera and a weight of only 38g. The more expensive Android version "QW09" has Android 4.4 and 500 Meg of RAM which is low end, but that low weight is a very attractive feature. Possible TODO = buy and evaluate QW09.

"Raspberry Pi Zero" - this is physically larger than the SmartWatches although less weight at only about 10g. We can buy an optional extra camera, only about another 2g,  that attaches with a flexible ribbon cable which can fit robot layout needs. "Pi Zero" can be programmed in JavaScript with a different framework "node.js". The current biggest barrier and still under investigation is GSM communication - ie cellphone data comms which appears to be a complex and challenging exercise involving connecting a GSM modem to a USB port. The GSM modem has a weight of 21g losing much of the "Pi Zero" weight advantage although we have the option of using USB cabling to separate it from the "Pi Zero" and away from the robot "head" to get better weight distribution. Another issue is that microphone, speaker, motion sensors, GPS are all add on extras for the "Pi Zero" where the X01S has them in the package.

X01S in detail.

As a SmartWatch

Before removing the straps and going robot-brain, I did try it out as a wearable.
The X01S works well as a watch and it is a very capable complete SmartPhone. It has a solid metal case which is good for a SmartWatch but not so welcome in a robot brain. I was able to type with my big clumsy finger on a tiny screen while feeling surprised that this was working so well. The improving Google speech recognition is a welcome alternative to typing. Websites are surprisingly readable. Making phone calls and texting is all do-able.

I mail-ordered the X01S from an "AliExpress" seller - "Xiao mi World Store".
Cost including shipping was just under 100 New Zealand dollars which is about 70 US dollars.
On arrival I swapped the SIM card over from the VFD 300 and the X01S was all go with Vodafone New Zealand.

I wanted to get screen lock working with a PIN number. I searched through many options looking for this before finding it under the rather less than obvious "VPN".
That is "Settings" -- "Wireless & Networks" -- "More" -- "VPN"

As a Robot Brain - so not the usual kind of review!

The "DroidScript" framework downloads from the Google Play Store and works fine. DroidScript  remote coding over Wi-Fi from a full size computer works which is an essential need for a small device. All my code created on the VFD 300 SmartPhone copied across and ran on the X01S. I use the HTML hybrid interface coding option which I understand may be relatively high demand for the device, so well done X01S.

Bluetooth, Wi-Fi and GSM Data all perform well.

Removing the straps was a challenge. They are held by what looks like a screw at each end of a rod but there is only one small screw threading into the end of a long rod. I needed to try both ends to find the end where the screw unscrews then push the rod out from there. On pushing the rod out about 3mm it becomes easy to grab and pull the rest of the way.
Then I discovered as is common with SmartWatches that there are antennas in both watch straps. So it was replace the rods then peel the backing off the straps to unstick the antennas. Doing this, one of the antenna wires pulled out of the watch. However GSM, WiFi and Bluetooth are working well with only one antenna so I am continuing with that. (Maybe I have lost GPS? Todo check),

Strap removal is difficult compared to the DZ09 / QW09 design.
If I was to do this again I would cut the straps 33mm from where they meet the device, although this depends on how the device needs to fit into the robot.
My complete strap removal gave a weight reduction from 85g to 64g.

Other robot brain points of interest:
Is it possible to run and/or recharge from the robot power source?
Yes. External power (5V)  is a little unusual being metal touch pads contacted by the USB charger. I would need to make a mock charger but that does look doable. See photos below. The supplied charger unit could become part of a robot but it has magnets in it giving it a relatively high weight of 29g.
The battery weighs 13g so it would be possible to run with that removed and get the unit weight down to 51g. I plan however to keep the battery in the watch for the convenience of being able to work with the watch while the rest of the robot is switched off. Good also to be able to remove the watch from the robot for better access to it for setups and adjustments.


Strap removal surgery. Sticky antenna revealed.

Straps removed. X01S with 1 antenna. On the weighing machine.

X01S running my Snake Robot Brain code. That app "XMSnakeBrain" along with other code and designs from the "XMSnakeRobot" open source project is on Github:

X01S, straps removed, showing antenna.
There are 2 buttons and the camera on the right side of the X01S.
The camera lens is in the middle.

X01S with charger unit which also acts as the USB adapter.
The 4 pins are a custom USB connection with the outside 2 pins as GND and V+ (5V).

Photo taken with the X01S. Street scene.

Photo taken with X01S. Interior old machinery. Low light, twilight outside.

Test run of remote control of X01S with "AirDroid" and "AirMirror".
The "AirMirror" window mirrors the app running on the X01S.
There is also a camera window so we can see what the Snake Robot is seeing.
In this screenshot I have a snake robot looking at me.

Link to X01S on "Xiao mi World Store" as at 21 Jan 2018.
These links change a lot as do the manufacturing runs of changing device designs.
If you are a future reader finding this link dead, you can try searching AliExpress for "SmartWatch X01S".