It's robotex season again, time to release one of my old posts that I had use of again.
So. OpenCV for my BeagleBoard. I didn't want to compile it from source so basic linux training continued. After watching OpenCV linker errors:
gencode1.cpp:(.text+0x27): undefined reference to `cvNamedWindow' gencode1.cpp:(.text+0x3c): undefined reference to `cvShowImage' gencode1.cpp:(.text+0x59): undefined reference to `cvNamedWindow' gencode1.cpp:(.text+0x6e): undefined reference to `cvShowImage' gencode1.cpp:(.text+0x7a): undefined reference to `cvWaitKey' gencode1.cpp:(.text+0x8f): undefined reference to `cvReleaseImage' gencode1.cpp:(.text+0xa4): undefined reference to `cvReleaseImage'
A friendly face in the lab said that the linker part of g++ command has to be in the end of the command. That's it, I'm going to C starter course..
So now, the easy part. I installed OpenCV from ROS repo after this tutorial.
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu natty main" > /etc/apt/sources.list.d/ros-latest.list' wget http://packages.ros.org/ros.key -O - | sudo apt-key add - sudo apt-get update sudo apt-get install libcv-dev libhighgui-dev libcvaux-dev libboost-dev
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu natty main" > /etc/apt/sources.list.d/ros-latest.list' wget http://packages.ros.org/ros.key -O - | sudo apt-key add - sudo apt-get update sudo apt-get install libcv-dev libhighgui-dev libcvaux-dev libboost-dev
Tried compiling, still some bits missing from GUI:
/usr/bin/ld: cannot find -lboost_thread collect2: ld returned 1 exit status
/usr/bin/ld: cannot find -lboost_thread collect2: ld returned 1 exit status
sudo apt-get install libboost-thread-dev libboost-system-dev
sudo apt-get install libboost-thread-dev libboost-system-dev
Another Robotex competition has passed. This year I unfortunately didn't finish my robot so I couldn't compete. So I was there more as a teacher and less as a student. The competition was like every year, Tartu University went with cool looking robots and local schools won. But to the technical stuff. Why couldn't I participate.
First reason - point to point wiring. Well. It doesn't work. It works in theory but given high enough volume or long enough time scale it WILL fail. About a day after Robotex I ordered shield PCBs from factory to replace all the ugly soldering. I think we lost about month of debugging time to such hacks.
Connectors. You have to have good connectors. Pinheads soldered to wire will fail you. Another half a month were lost to connector problems. Cheap female pinheads from the web will not make good connection and come out from plastic. At the moment we are middle of changing all the connectors to more durable and expensive MicroMatch connectors. If you really don't have money - try superglue to make them more durable.
Cables. Cables will brake, so they will have to be easily changeable. From now on we will be using ribbon cables what are easy to make and off the shelf servo cable extensions. So if we have any doubts in wiring we can replace whole thing with new one in matter of minutes.
So yea, if you start planning your new robot, stop for five minutes to think about connectors and wiring. Good connectors for whole robot can cost 20€ but they will save your day more than once.
Because GUI is too slow and all I need is SSH connection, I will use Ubuntu Server edition on my robot. First time to use Server OS, second time to install OS on BeagleBoard. Tools: SD card, computer with ubuntu, BeagleBoard's serial cable.
Files from: https://wiki.ubuntu.com/ARM/OMAP
Instructions: https://wiki.ubuntu.com/ARM/OMAPMaverickInstall
gunzip ubuntu-11.10-preinstalled-server-armel+omap.img.gz sudo dd bs=4M if=ubuntu-11.10-preinstalled-server-armel+omap.img of=/dev/sdb
gunzip ubuntu-11.10-preinstalled-server-armel+omap.img.gz sudo dd bs=4M if=ubuntu-11.10-preinstalled-server-armel+omap.img of=/dev/sdb
Some orange screen and errors in serial console.
MMC: block number 0x1 exceeds max(0x0) ** Can't read from device 0 ** ** Unable to use mmc 0:1 for fatload ** ## Executing script at 82000000 Wrong image format for "source" command
I had to erase nand flash. Then, some more hours of random debuging later I started to get linux booting messages and then random characters and language names. My HTerm messed all the spacing up. Tried with minicom, same thing there, I hate minicom. Then I found terminal program named screen. Fancy and colorful, I didn't know you can get color over serial.
I selected Ubuntu Server Package and OpenSSH package from installing menu and it started to download and install those. Then finally, Ubuntu command line. No screen, no keyboard, just command line. Whatever, don't need anyting else anyway. Found good guide how to make startup scripts from: random instruction.
Contents of the file:
#Connect to web sudo iwconfig wlan0 essid "ut-public" #and give me IP. sudo dhclient wlan0 #ip to server script from last post python /home/user/ssh_me.py
#Connect to web sudo iwconfig wlan0 essid "ut-public" #and give me IP. sudo dhclient wlan0 #ip to server script from last post python /home/user/ssh_me.py
Tried to install dropbox to it too, but didn't find armel version of it. Next - OpenCV. But it still doesn't work on Beagle so I can't write how to do it.
So, I'm working on a robot project that is using BeagleBoard development board with Ubuntu 11 on it. It seems fun, although a bit slow for Gnome. So it would be nice to boot it in text mode (working on that) and use ssh or telnet to develop the code. So there started my problem. The board boots up and connects with local internet. Now I want to connect with it but I don't know the IP address. So I have to plug display and keyboard to my robot to get the IP address so I wouldn't have to plug the display and keyboard on it. Kind of self cancelling. So I made a script to help me.
First part is in Python, it gets robot's local IP address and sends it to a php file outside. This should go to start-up of client/robot/slave computer.
#encoding=utf8 #I hate everything that is not in UTF8 import urllib2, subprocess, string #your host php file address host = 'http://your-page.org/robot.php' #secret question question = 'i_am_the_robot' #get my ip q = subprocess.check_output(['ip','addr','show','wlan0']) q = q[(string.find(q,'inet')+5):] q = q[:string.find(q,'/')] #do the magic urllib2.urlopen(host+'?'+question+'='+q)
The second part is php file, that accepts the IP addresses if necessary and displays the last known IP address.
The third part is just for convenience. You could go to your webpage and copy the IP from there, but in case you are lazy like everybody, this python script will do it for you.
#encoding=utf8 #I hate everything that is not in UTF8 import urllib2, os #your host php file address host = 'http://your-page.org/robot.php' #command to run. telnet or ssh probably command = 'telnet ' #open url u = urllib2.urlopen(host) #read ip and execute the command os.system(command+u.read())
In 2010 I attended Estonian biggest robotics competition Robotex. Because I like to build simple things - I chose beginners category and simple differential drive, because.. I like to win. Everybody else tried to do omni-directional driving, 10bit precise odometry and other crazy stuff like that. I had been in the competition for couple of years and I had seen that 90% of the robots never moved on the big day. So me and couple of my friends built robot named Goblin. It was one of two(three?) robots from our university that actually moved. Goblin didn't lose a round in beginners (no camera) competition and came sixth in advanced version.
So, the design had to be totally foolproof. So I took two random geared motors from lab, fitted them with two big LEGO wheels and bolted to base plate. Next to them went a LiPo. In the front was the mechanically most difficult thing - the dribber. It was basically a motor from CD-rom and pole covered with rubber. Point of it was to make ball roll towards the robot so robot could steer the ball. On either side of the dribber there was a mini servo with Sharp GP2D12 on it for distance measurements. Later on, Goblin got itself coilgun, chassis with some leds and capacitor bank, but these things didn't affect the performance of the robot. On top of everything it had a big black mohawk - it had two purposes: hold goal sensors and to look awsome.
Electronics were fairly simple - chosen for minimum time waste and speedy changing (in case of magic smoke goming out). It had one little board with atmega88 and two modulated IR receivers to find beacon (signalling on the goal). Then two h-bridge boards with L298n drivers. One board for wheels, other one for the dribber. Then it had mainboard with just one atmega88 and separate board for controlling leds. Power supply had three 7805 voltage regulators. One for servos, one for mainboard and one for other things.
The sensor board listened two modulated IR receivers and decoded the modulation. The mainboard controlled servos, leds, motors and sensors. It used the servos to sweep with distance sensors so it got one dimensional distance map. Then algorithm searched for the ball from the scan. Unfortunately the sensors were extremely slow, they updated their output about 25 times per second. So to get full scan robot had to stand still for about 4 seconds. That gave it a weird yanking motion: it sped forward about a meter, stopped suddenly, "thought" for 5 second and accelerated again.
http://youtu.be/tZs97A68c-w?t=2m55s shows Goblin without the chassis in action.
At the moment we are building next version of this robot, now with some serious firepower and so on but whatever - don't brag before it works. I have an idea to make Goblin work again (yes, we salvaged it for the parts) as a RC toy but I haven't had the money yet. It was a fun project, showed again the necessity of KISS principle.