Rasathus
Posts: 45
Joined: Sat Jun 02, 2012 11:37 am
Location: Reading, UK
Contact: Website

Robots with frick'in WiFi

Fri Aug 31, 2012 10:27 am

Has anyone got any interesting implementations of robot control over WiFi, my current mechanism is rather prone to issues with variable roundtrip time. On a solid low latency WiFi network all works well, but once things get busy or you get a bit of interference that requires resends, things get a bit shaky.

I've often seen scenarios where on the same network one http get will take 250ms roundtrip, while others take upwards of 1750ms, making the control system seem very unresponsive.

I suspect its quite a common issue, and was wondering if anyone had come up with any interesting control mechanisms to negate the latency impact.

http://rasathus.blogspot.co.uk/2012/08/ ... -woes.html

Rasathus
Pi1 - Revision 002 - Used for some circuit experimentation and learning.
Pi2 - Revision 002 - Currently powering the 'Monstrosity Rover' project.
Pi3 - Revision 004 - Raspberry Pi Laptop using a Motorola Lapdock.

Take a look @ rasathus.blogspot.co.uk

aonsquared
Posts: 21
Joined: Sat Jan 28, 2012 6:40 pm
Location: Bristol, UK

Re: Robots with frick'in WiFi

Fri Aug 31, 2012 9:32 pm

I've built a similar rover called Xaver Mk.2 (http://www.aonsquared.co.uk/the_dark_pi_rises) and to avoid latency I've put him on an ad-hoc wifi network.

I've also written a Python tcp server and client, and if you set the niceness levels in your server and client to very low (0 to -20) then the controlling computer and the robot will prioritise sending and receiving the commands. Overclocking the Raspberry Pi also helps.

Rasathus
Posts: 45
Joined: Sat Jun 02, 2012 11:37 am
Location: Reading, UK
Contact: Website

Re: Robots with frick'in WiFi

Fri Aug 31, 2012 9:46 pm

I had tried using an adhoc network previously, but unfortunately didn't notice it being any more reliable. Ill take a look at your suggestion of tweaking the process priorities though. Thanks

Ill take a look through your code though. What sort of responsiveness have you been getting ?
Pi1 - Revision 002 - Used for some circuit experimentation and learning.
Pi2 - Revision 002 - Currently powering the 'Monstrosity Rover' project.
Pi3 - Revision 004 - Raspberry Pi Laptop using a Motorola Lapdock.

Take a look @ rasathus.blogspot.co.uk

-Matt-
Posts: 4
Joined: Fri Aug 31, 2012 9:07 pm

Re: Robots with frick'in WiFi

Fri Aug 31, 2012 11:06 pm

>> Has anyone got any interesting implementations of robot control over WiFi

Not exactly what you were asking but I was wondering about the possibility of an aerial drone that could collect wifi ssid's?

simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
Contact: Website

Re: Robots with frick'in WiFi

Fri Aug 31, 2012 11:34 pm

Surely the idea is to get an RPi into a robot and get it to autonomously sort itself out (sensors - motor control etc) and just use the wifi to tell it to move 50cm and it does what its told without further intervention.

If you want real-time manual control - then that's what radio control is for :)

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter

Rasathus
Posts: 45
Joined: Sat Jun 02, 2012 11:37 am
Location: Reading, UK
Contact: Website

Re: Robots with frick'in WiFi

Fri Aug 31, 2012 11:42 pm

That comes once the wheel encoders are wired up and the rest of my order of sensors arrives. :-)
Pi1 - Revision 002 - Used for some circuit experimentation and learning.
Pi2 - Revision 002 - Currently powering the 'Monstrosity Rover' project.
Pi3 - Revision 004 - Raspberry Pi Laptop using a Motorola Lapdock.

Take a look @ rasathus.blogspot.co.uk

aonsquared
Posts: 21
Joined: Sat Jan 28, 2012 6:40 pm
Location: Bristol, UK

Re: Robots with frick'in WiFi

Sat Sep 01, 2012 6:45 am

simplesi wrote:Surely the idea is to get an RPi into a robot and get it to autonomously sort itself out (sensors - motor control etc) and just use the wifi to tell it to move 50cm and it does what its told without further intervention.

If you want real-time manual control - then that's what radio control is for :)

Simon
Yes that's definitely the next step - I've got a gps sensor now connected to the pi, but I need to find a solution for more accurate localisation involving computer vision.

Rasathus
Posts: 45
Joined: Sat Jun 02, 2012 11:37 am
Location: Reading, UK
Contact: Website

Re: Robots with frick'in WiFi

Sat Sep 01, 2012 8:17 am

I've got a gps setup for the arduino, but I'm not convinced the resolution is going to be high enough for ground based navigation. It would work well for my next quad rotor project though.

On the autonomous side I was interested in getting it to map its environment. Using the sensors it could explore around and draw a map of the objects it senses.
Pi1 - Revision 002 - Used for some circuit experimentation and learning.
Pi2 - Revision 002 - Currently powering the 'Monstrosity Rover' project.
Pi3 - Revision 004 - Raspberry Pi Laptop using a Motorola Lapdock.

Take a look @ rasathus.blogspot.co.uk

User avatar
maksm
Posts: 10
Joined: Sun Jul 08, 2012 6:36 pm

Re: Robots with frick'in WiFi

Sat Sep 01, 2012 8:25 am

On the issue of navigation, what solutions do you foresee?
My best guess is to use Kinect locally to map and classify terrain, with the support of GPS (for outdoor) for getting a global sense of position.
The Kinect usage can be quite amazing, like in the following video: http://www.youtube.com/watch?v=9Y4RQVpp-BY

Rasathus
Posts: 45
Joined: Sat Jun 02, 2012 11:37 am
Location: Reading, UK
Contact: Website

Re: Robots with frick'in WiFi

Sat Sep 01, 2012 8:30 am

A kinect would be good, but I think they require an ac adaptor too, so we'd have to see how else we could power it.

At the moment the rovers being used indoors, so the gps just isn't granular enough. I think the big wide outdoors may wait for the quad rotor.
Pi1 - Revision 002 - Used for some circuit experimentation and learning.
Pi2 - Revision 002 - Currently powering the 'Monstrosity Rover' project.
Pi3 - Revision 004 - Raspberry Pi Laptop using a Motorola Lapdock.

Take a look @ rasathus.blogspot.co.uk

mikerr
Posts: 2825
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: Robots with frick'in WiFi

Sat Sep 01, 2012 10:49 am

When doing similar I found the wifi adaptor is often negotiationing faster and slower speeds based on signal strength and interference.

This is good for overall bandwidth, but bad for latency.

You can set it fixed with iwconfig

Code: Select all

sudo iwconfig wlan0 rate 1M
Yes, that restricts your transfer rate, but it also stops it continuously cycling 54MBps-> 24Mbps->54Mbps->1Mbps->8Mbps->54Mbps with delays in between.
You don't notice this with file transfers and the like because you look at the average rate over time, not the instantaneous rate, or latency lost changing speeds.

This trick was useful in the dialup days too - modems would "go dead" for 2-3 seconds when line conditions changed, fixing it at a lower rate made things better on noisy lines, at the expense of bandwidth.
Android app - Raspi Card Imager - download and image SD cards - No PC required !

Rasathus
Posts: 45
Joined: Sat Jun 02, 2012 11:37 am
Location: Reading, UK
Contact: Website

Re: Robots with frick'in WiFi

Sat Sep 01, 2012 11:06 am

Thanks for the tip, Ill go give it a go. Any ideas if this is persistant or needs to be done with each wlan0 up cycle ?
Pi1 - Revision 002 - Used for some circuit experimentation and learning.
Pi2 - Revision 002 - Currently powering the 'Monstrosity Rover' project.
Pi3 - Revision 004 - Raspberry Pi Laptop using a Motorola Lapdock.

Take a look @ rasathus.blogspot.co.uk

limor
Posts: 1
Joined: Thu Sep 13, 2012 11:58 am

Re: Robots with frick'in WiFi

Thu Sep 13, 2012 12:20 pm

Check out http://linuxified.net (a work-in-progress framework by RoboSavvy.com)

It is a robot framework concept whereby the robot has a microcontroller, an embedded linux and a remote PC. The framework provides various operating modes allowing each computation unit to shine in its own merit. The microcontroller is good at controlling motors in real-time and digesting sensor data. The embedded linux can do trajectory planning and signal processing but may not be able to do complex image processing at high framerate. The remote PC has all the computation power needed to do video processing but there's unreliable wifi related latency in the middle.
The framework allows you to explore the distribution of computation across the 3 processing units taking away some of the hardware/software gotchas.
Another embedded linux was used at the time this was developed but we are currently porting the system it to Rasberry-Pi and to a new self-balancing 2-wheeled robot frame.

Sandie1106
Posts: 3
Joined: Fri Sep 07, 2012 9:45 am

Re: Robots with frick'in WiFi

Fri Sep 14, 2012 3:06 pm

Have you considered other options than Wifi? What about sub 1GHz radio? ERA-CONNECT2-Pi may be a good option. It uses the easyRadio Advanced software protocol - 800-915MHz bands (or 434MHz)
Has better receiver sensitivity and therefore better range. Try pasting the link below. or Farnell code 2147161
Good luck.
http://uk.farnell.com/lprs/era-connect2 ... dp/2147161

Rasathus
Posts: 45
Joined: Sat Jun 02, 2012 11:37 am
Location: Reading, UK
Contact: Website

Re: Robots with frick'in WiFi

Sat Sep 15, 2012 10:14 am

Thanks for the suggestions. I'm currently rewritting monstrosity around a distance & degree based concept, which should be much less prone to latency issues. My main concern with alternative radio solutions is that I wouldn't be able to serve web pages directly from the rover, as I envisage having to implement my own protocol accross the hop. Are there any devices that effectively extend ethernet over an alternate radio device?
Pi1 - Revision 002 - Used for some circuit experimentation and learning.
Pi2 - Revision 002 - Currently powering the 'Monstrosity Rover' project.
Pi3 - Revision 004 - Raspberry Pi Laptop using a Motorola Lapdock.

Take a look @ rasathus.blogspot.co.uk

neovin
Posts: 2
Joined: Sun Sep 23, 2012 10:44 am

Re: Robots with frick'in WiFi

Sun Sep 23, 2012 11:10 am

Hi all,
@ Aonsquared, Loving the epic trailer on you site. I have pretty much built everything up for my own bot but my python programming is terrible, I have search the world of google for an answer on how to route the serial port across the network but am really struggling, would you be able to help? ;)

Thanks, Neo

aonsquared
Posts: 21
Joined: Sat Jan 28, 2012 6:40 pm
Location: Bristol, UK

Re: Robots with frick'in WiFi

Sun Sep 23, 2012 1:36 pm

What do you mean routing the serial port through wifi?

Xaver runs a TCP server which uses pyserial to send the commands to the arduino:

Code: Select all

#!/usr/bin/python           
# Xaver's TCP server. Runs on the Raspberry Pi.

import socket               # Import socket module
s = socket.socket()         # Create a socket object
host = '192.168.1.135' # Get local machine name
port = 12345                # Reserve a port for your service.

import serial

DEVICE = '/dev/ttyACM0' # the arduino serial interface (use dmesg when connecting)
BAUD = 9600
ser = serial.Serial(DEVICE, BAUD)

print 'Server started!'
print 'Waiting for clients...'

s.bind((host, port))        # Bind to the port
s.listen(5)                 # Now wait for client connection.
c, addr = s.accept()     # Establish connection with client.
print 'Got connection from', addr
while True:
   msg = c.recv(2) # get 2 bytes from the TCP connection
   ser.write(msg)  # write the 2 bytes to the serial interface
Hope this helps! ;)

neovin
Posts: 2
Joined: Sun Sep 23, 2012 10:44 am

legend

Sun Sep 23, 2012 5:37 pm

Cheers Aonsquared, I shall post photos and a video of it in action, can't think of anything to say must build robot overlord!

Return to “Automation, sensing and robotics”