Let's Make Robots!

3D scanning/artificial robot vision

This image was created via data from a sharp IR sensor and maxrobotics sonar, mounted on a pan/tilt servo setup.


The "real" image is not taken from the same perspective as the robot - as the robot has over 180 degree field of view (sorta, for the middle 1/3rd of the screen) it was pointless to try to replicate its view with a cameraphone.


Instead i will point out some objects visible in both images. The scanning unit is obscured in the real image -  the top half of the robot (white triangle, mid far right of image) is wedged into a filing cabinet. The arm is on top of this, and the sensor unit is mounted just below the arm. THis gives you an idea of where the robot is scanning from.

Pretty much everything in the bottom 1/3rd of the scanned image is the sensor pointing downwards at the floor and panning. Imagine it as some sort of fisheye effect.


Starting from the left of the scanned image, you can see a beer bottle sitting on top of the robots base. This is visible in the bottom middle/right of the real image. The USB hub with the lit light would be just out of range of the scanned image. You can make out the double layers and the wheel of the robot base that are obscured in the real image.

To the right of the beer bottle in the scanned image, you can see the bar heater (big blob) , and then next to that is the rear of a 19" LCD monitor(smaller triangular blob) .

Far to the right side of the scanned image, in the top 1/3rd of the image you can see a line with a circular streak at its bas. This is a standing lamp which can be seen as a black line in the brightly lit upper right hand side of the real image, with a beige PC case just behind it, also sort of visible in the scan.


The colours were made up from sonar and IR sensors, with sonar providing the blue channel, and IR providing the red, with green made up of the two averaged. If you load it into a decent image manipulator, you can crank the colour channels up and down to reveal different details


Scan was with a starting step size of 16, halving after each cycle, until i got bored halfway through the 2x step cycle - there is a pause for each reading, so it ends up taking a long time even for a 2x scan.


Software is python/pygame, client/server/networked, etc, maxrobotics sonar and sharp IR are hooked up to an arduino, servos are controlled via a pololu servo controller

robotscan.png30.71 KB
realimage.jpg50.53 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
How was the sonar and IR ranging data taken in? Could you show your program for reading data from the Arduino in Python?

import pprint
from cStringIO import StringIO
import cPickle as pickle
from socket import *
from select import *
from string import *
import sys
from getopt import getopt, GetoptError
import math
from decimal import Decimal
from struct import unpack
import time
import serial
#Arduino /sonar stuff
running = 1
arduinoserialdev = sys.argv[1]
arduinoser = serial.Serial(arduinoserialdev, 57600, timeout=1)
print "Arduino device", arduinoserialdev
arduinoport = 21563
arduinohost = ""
arduinoaddr = (arduinohost,arduinoport)
sonar = 0
laser = 0

while running:
   read = arduinoser.readline()
   if read.startswith('A'):
                sonar = read.lstrip('A')
   if read.startswith('B'):
                laser = read.lstrip('B')
   read = arduinoser.readline()
   if read.startswith('A'):
                sonar = read.lstrip('A')
   if read.startswith('B'):
                laser = read.lstrip('B')
   #arduinodata = ["Sonar",sonar,"Laser",laser]
   #print arduinodata
   sonar = int(sonar)
   laser = int(laser)
   arduinodata = ["Sonar",sonar,"Laser",laser]
   sendstring = pickle.dumps(arduinodata)


There is an equivilant bit of code in the master control program that listens for the UDP packet when it wants to gather the rangefinding data.  This just spits out a steady stream of UDP messages. The arduino sketch simple prints A or B and the sonar or IR analog reads to the serial port. i use similar daemons to hande motor and servo controllers