Kinect controlled robotic arm

May 8th, 2012

At NTNU, each student must take this Experts in Teamwork course. Everyone hates it, but as everything else, it is what you make it and it is an important course!

I landed (yeah, randomly chosen) on Human and Robots village. Its called village, just as a theme name our objective.

Its common at NTNU to just do pure reports. Boring paper work. Being a more practical person, I suggested that we tried to physically control a robot with human movements. We found a PUMA-like manipulator on campus and started to develop the software for it. The robot was slow, very slow, but it worked good for a proof of concept.

The robot was hooked to a regular computer which uses Kinect to find humans to control the robot. Kinect then detects your arm and each joint in your arm, except fingers due to bad resolution. The angles between each joint is then calculated and sent to the robot which then replicate these angles in its joints.

Watch video 1 and video 2 on Youtube.

I have source code and the report (in Norwegian) for this project. Leave me a comment and I will send it to you.

w3btorrent 0.9.1 released

May 7th, 2012

Screenshot of the downloads section

After some time away from this project, I have now created a new version of w3btorrent. This version is a total recode of the old version and uses rtorrent as core, where the old w3btorrent used CTorrent.

It has also multi user support and enhanced AJAX interface along with some other nifty features.

w3btorrent has changed home page from sourceforge.net to Google Code. This is because Google has a simpler page. Visit w3btorrents new home page if you have no idea what it is or want to try it. It’s free of charge without any warrenty.

I recommend using the Debian package which is available from the home page. That is, if you are using Ubuntu. You just download it, install it and you’re done.

w3btorrent is also on github if you want to browse source or latest version.

Xubuntu 12.04 Precise Pangloin MacBook Pro 5.3 complete setup

April 6th, 2012

This post will basically work like a log for myself, but I’ll try to write decent so any one can take advantage of my setup. It was written before https://help.ubuntu.com/community/MacBookPro5-3/Precise was documented.

Installing
Burn Xubuntu to a CD/DVD and boot from it. If you’re having hard trouble booting, just hit F6 and select “nomodeset” before booting live CD. After this basically everything works in live mode, but I recommends you to manually turn on the fans so you don’t overheat anything. Open a terminal, sudo -i and write

echo 6000 > /sys/devices/platform/applesmc.768/fan1_min
echo 6000 > /sys/devices/platform/applesmc.768/fan2_min

If 6000 is too much noise, just dial it down to 5000 or so.

 

Fan control
Firstly, install fan control unit so we don’t have to write to fan?_min manually. This program is called macfanctld and is found over at mactel ppa.

 

Network – wireless
During installation you should be able to install this from the tray area. If now, you can do it now.

 

Graphics
Nvidia proprietate driver is my choice and is available from the restricted drivers menu. At this point glxgears (sudo apt-get install mesa-utils) gives me 4900-5000 FPS.

I use an additional monitor attached to my machine at home and choose therefore to write this to /etc/X11/xorg..conf.

I also added some additional code to dial the gfx performance and heat waste down by adding
Option "Coolbits" "1"
Option "RegistryDwords" "PowerMizerEnable=0x1; PerfLevelSrc=0x2222; PowerMizerLevel=0x3; PowerMizerDefaultAC=0x3"

to device section.

 

Keyboard light
not working yet

 

That’s the general part. Stuff that I have not mentioned can you assume is working out of the box (sound, camera, suspend etc.). Now I will share my desktop setup.

 

Xubuntu Layout
Xubuntu team creates to panel which is not how Xfce usually appears. This doesn’t matter because I change it completely. I remove all panels and add a new one to right down corner. This panel is set small and to auto hide. This is where I have tray icons.

How will I launch applications? by going to Desktop settings I chose to remove icons and that minimized programs should appear as icons on desktop. This automatically makes left mouse click on desktop to the main launch menu.

Now we basically only have a background image.

 

Launch quicklier
To be able to launch applications quickly, I choose to use Kupfer and the right CMD-key which is default mapped to Super_R. We can remap this with xmodmap -e "keycode 134 = Menu" which can be put in startup and then edit ~/.config/kupfer/kupfer.cfg and change it to “keybinding = Menu”.

Additionally to Kupfer there is Gnome-Do and Synapse.

 

Music
Xubuntu is shipped with gmusicbrowser which is a very light music player with enough features (for me at least).

Go to Settings Manager -> Keyboard -> Application shortcuts and add
“gmusicplayer -cmd PrevSong” for “X86AudioPrev”
“gmusicplayer -cmd PlayPause” for “X86AudioPlay”
“gmusicplayer -cmd NextSong” for “X86AudioNext”

 

File browsing
I uninstalled Thunar and installed Nautilus. They appear equal fast and clean, but nautilus has additional features such as bookmarking and volume management. Also, Nautilus has dropbox support. For the record,

 

Email notify
XFce has a neat mail plugin for the panel called Mail Watcher. I configured it for GMail (you’ll figure it out) and added a OSD notifier (on screen display) in the field where it runs a command for each new email. I used notify-send -i /usr/share/app-install/icons/gnome-gmail.png -t 99999999 "New Email" "Read message"

 

Chromium crap
Chromium keeps asking about being default browser this did not work: sudo update-alternatives --config x-www-browser

Flash is some piece of shitware and this time it adds blue tint over videos on youtube. You can fix it with

sudo mkdir /etc/adobe
echo -e "EnableLinuxHWVideoDecode=1\nOverrideGPUValidation=true" | sudo tee /etc/adobe/mms.cfg > /dev/null

 

Take a look at the table below for programs which ease my work (randomly listed)

Name Package Description Comment
Xournal xournal highlighting in PDF documents
PDF Mod pdfmod edit pdf documents
VMware
MATLAB my own package to mathematical operations
Audacity audacity audio editing
X Video Capture xvidcap
VideoLAN vlc Video viewer
Bluefish bluefish Development editor
Tex Maker texmaker Write latex documents
Chrome chromium-browser Web browser
Dropbox nautilus-dropbox File syncer Must have or similar
Skype skype Video chat program It just works
 WiIThon wiithon Put Wii games on removable devices https://launchpad.net/wiithon
gshutdown Set a timeout when your machine should be off Rarley use this
Tilda tilda Dropdown console Use it all the time
WINE wine
BOOT-up-MANAGER bum Modify GRUB graphically
usb-creator-gtk create startup USBs
firestarter setup a firewall or share a connection
ubuntu-restricted-extras Java and Flash
macfanctld
Netbeans netbeans IDE for programming I use this when programming Java
apt-file Search for specific files in your repository
Cheese cheese Webcamera application
Kupfer kupfer Do thing quickly Must have or similar
Nmap nmap Network map – look for services on the net Must have
MPlayer mplayer Simple video player. What VLC dosen’t take, this does.

Fit-PC 2 as HTPC using Lubuntu 11.10 Oneiric Ocelot

April 4th, 2012

How to setup your Fit-PC2 rev 1.4 as HTPC with a Ubuntu variant.

I tried first to install 12.04 beta2 and blacklist poulsbo driver. Such that psb_gfx driver should be active. It worked, but I only gained 101 FPS out of glxgears and 5 FPS in XBMC with standard size window. I tried to use EMGD-1.8 and EMGD-1.10, but they do not work with the current (1.10) X.org version.

I chose to roll back to 11.10 by using the alternate installer (way better and faster than graphical) and ran the same drivers and tested them with glxgears. Default driver (poulsbo) gave 119 FPS. With XBMC it gave staggering 0.3 FPS.

I installed EMGD-1.10 and it gave me 325 FPS. In XBMC it gave only 5 FPS because this driver does not support API calls which XBMC uses.

Installation of EMGD-1.10 yields
sudo add-apt-repository ppa:gma500/emgd110
sudo apt-get update
sudo apt-get install emgd-support
sudo emgd-xorg-conf

I rebooted and found my old Samsung TV not supporting the current resolution. Luckily, I had installed SSHD and was able to connect to the machine to edit the config. The config in /usr/share/X11/x.org.d/10-emgd.conf was given 1920×1080 which my TV does not support.

The TV is very strict and to find a working resolution and refresh rate I used emgdui to at least get a picture. I den used xrandr -s 800x600 -r 60 to set different resolutions and refresh rates before saving it to the config.

The config is now:
Section "ServerLayout"
Identifier "Default Layout"
Screen 0 "Screen0" 0 0
EndSection
Section "Device"
Identifier "Intel_EMGD-0"
Driver "emgd"
VendorName "Intel(R) DEG"
BoardName "Embedded Graphics"
BusID "0:2:0"
Screen 0
VideoRAM 131072
Option "PcfVersion" "1792"
Option "ConfigId" "1"
Option "ALL/1/name" "lvds-display"
Option "ALL/1/General/PortOrder" "240000"
Option "ALL/1/General/DisplayConfig" "2"
Option "ALL/1/General/DisplayDetect" "1"
Option "ALL/1/General/Accel" "1"
Option "PortDrivers" "svdo lvds"
Option "ALL/1/General/VideoRAM" "131072"
Option "ALL/1/Port/2/General/name" "VGA"
Option "ALL/1/Port/2/General/Edid" "1"
Option "ALL/1/Port/2/Attr/70" "0"
Option "ALL/1/Port/4/General/name" "LVDS"
Option "ALL/1/Port/4/General/Edid" "1"
Option "ALL/1/Port/4/Attr/70" "0"
Option "TVOverScan" "0.5"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Intel_EMGD-0"
Monitor "LVDS"
SubSection "Display"
Depth 24
Modes "720x480"
EndSubSection
EndSection
Section "DRI"
Mode 0666
EndSection
Section "Extensions"
Option "composite" "enable"
EndSection

XMBC had to be installed and this new XBMC 11 Eden has just been released and was installed with
sudo add-apt-repository ppa:team-xbmc
sudo apt-get update
sudo apt-get install xbmc
sudo apt-get update
sudo apt-get upgrade

Since I want to use XBMC and this driver was the best out of worst, I changed the XBMC setup to use mplayer which plays the movies smooth. You can change this in ~/.xbmc/userdata/playercorefactory.xml.

My file contains:
<playercorefactory>
<players>
<player name="mMplayer" type="ExternalPlayer" audio="false" video="true">
<filename>/usr/bin/mplayer</filename>
<args>-fs</args>
</player>
</players>
<rules action="prepend">
<rule filetype="avi|mkv|ogm|wmv|mov|m2t|mpg|mp4|m2v" player="mMplayer"/>
</rules>
</playercorefactory>

Which basically states that any of the given file types should be played with mplayer with the -fs argument (fullscreen).

With this setup you will get pretty decent performance and almost, just almost enough juice to play HD videos.

If you want to make XBMC automatically update it’s movie library add <code>* 0,8,12,16,20,22 * * * wget -T 60 -t 5 -q -O /dev/null “http://user:passwd@localhost:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(updatelibrary(video))”</code> to <code>crontab -e</code>.

Don’t forget to enable XBMC HTTP control inside XBMC and setup a username and password which do edit in the crontab line.

Installing finch (pidgin) without root access

March 31st, 2012

This thread will explain how you can install finch on a computer without root access or a system without any package manager for that matter. This can be bit tricky and I’ll share my recipe. When I wrote this I could just mark all the commands below in a single selection, paste it in my terminal and it would install everything like a shell script. Hope it still does.

First go to http://pidgin.im/download/source/ and download the source.


# I need nucrsesw to support Norwegian characters, skip this if you have it or don't need it
wget "ftp://invisible-island.net/ncurses/ncurses-5.9.tar.gz"
tar zxf ncurses-5.9.tar.gz
cd ncurses-5.9/
./configure --prefix=$HOME/.ncursesw -enable-widec --with-shared ;make;make install
# bug workaround
cd $HOME/.ncursesw/include/ncursesw/
ln -s . ncursesw
cd

# Missing intltool, skip this if you have it
wget "http://ftp.gnome.org/pub/gnome/sources/intltool/0.35/intltool-0.35.5.tar.bz2"
tar jxf intltool-0.35.5.tar.bz2
cd intltool-0.35.5
./configure --prefix=$HOME/.intltool && make && make install
declare -x PATH="$PATH:$HOME/.intltool/bin"
cd

# install finch
wget "http://sourceforge.net/projects/pidgin/files/Pidgin/2.10.3/pidgin-2.10.3.tar.bz2/download"
tar jxf download
cd pidgin-2.10.3/
./configure --prefix=$HOME/.job --disable-vv --disable-meanwhile --disable-avahi --disable-nm --disable-perl --disable-screensaver --disable-sm --disable-gtkui --disable-pixmaps-install --disable-dbus --disable-gstreamer --disable-tcl --disable-doxygen --disable-dot --with-ncurses-headers=$HOME/.ncursesw/include/ncursesw/ LDFLAGS=-L$HOME/.ncursesw/include/ncursesw/
make
make install
cd

You should now have successfully installed finch. And we can move the garbage.
rm -rf intltool-0.35.5* ncurses-5.9* pidgin* .nursesw .intltool

I moved finch from ~/.job/bin/finch to ~/.job/job. I use these strange path’s and names to not rise suspicion because the server has many many users which may browse `ps aux`.

I also wanted mouse support so I added mouse = 1 in ~/.gntrc. Since I will run finch in screen I had to start screen and finch with screen -T xterm ./job or the config was not loaded.

For convenience I added this to crontab with env EDITOR=nano crontab -e and made sure it was running each 10min with 0,10,20,30,40,50 * * * * if [ -z "`ps --no-heading -C job`" ]; then cd /home/1/h/hammerseth/.job;screen -T xterm -d -m ./job;fi

64-bit Linux and Matlab mex solution

February 13th, 2012

Ever gotten the error below?
Warning: You are using gcc version "4.5.2-8ubuntu4)". The version
currently supported with MEX is "4.3.4".
For a list of currently supported compilers see:

http://www.mathworks.com/support/compilers/current_release/

 

I recently did when making some S-functions in simulink (matlab).

After some Googling a found this post which had the answer. You can use their solution or the following script:

sudo updatedb # it is required to have run this after you installed matlab, the command below uses this
cd $(dirname $(locate "sys/os/glnxa64/"|tail -1)) # change dir to matlab path
mv libstdc++.so.6 libstdc++.so.6.orig # this...
mv libgcc_s.so.1 libgcc_s.so.1.orig # and this is the actual fix

You don’t even have to restart Matlab.

Manned electric multicopter

November 1st, 2011

Quadcopters are very popular these days, but one can also increase number of motors to a multicopter.

One can also make it big, like these Germans did. Simple, yet amazing.

Solar panels for the future

October 27th, 2011

A new way of harvesting sun energy has been developed and is was presented at Ted a few days ago. This amazing technology is transparent which means you can generate energy from the windows of your house! You can even cover an entire electric car with this stuff.

Head on over to TED.com and watch the presentation

Ten robotics videos for you

October 27th, 2011

Brain controlled car.

Radio controlled flying sourcer.

Modular and flexible robot.

How Festo Bird came to life.

Smallest Quadcopter.

Ship (metal) boarding robot.

Efficient and precise movements for lasercutter robot.

Robot designed for tree climbing, notice the additional weight.

Vehicle using ground effect for efficient movement.

Hybrid legged and wheeled robot.

Why Robotics?

October 27th, 2011

Robotics is as complex as a discipline gets, being equal parts creativity, engineering, mathematical talent, and a range of scientific knowledge that enables individuals or teams to create robots – artificial constructs designed to complete menial tasks. But what potential benefits can they have, and how difficult is it to pursue a career in robotics?

For starters, the advantages of using robots instead of human beings is quite clear, for two reasons. They are less likely to make mistakes when it comes to menial, repetitive tasks that go on for hours, and although this is slowly pushing menial labour in manufacturing out into the job market, it does have advantages, as jobs can be created elsewhere and we can begin to phase out manual labour that can be somewhat unsatisfying for many individuals.

Now, whether you’re a scientist or a partypoker.com pro, you’ll know that when it comes to exploring unknown territory, either terrestrial or otherwise, we’ve begun to rely on robots rather than human beings. Not only does this avoid putting anything living at risk, it also means we can push further and further than ever before. From minefields to Mars, it’s enabled us to explore and make safe areas that we could previously never experience without putting people at risk.

To get into robotics takes an incredible dedication to your craft, and a shedload of enthusiasm – but it can be done. Focusing on mathematics, physics, engineering, product design throughout your education, followed by specific study of robotics at, say, Carnegie Mellon, is an ideal route in – but it does take a lot of time and effort. This isn’t a Hollywood production – it requires years of studying and practical projects that aren’t quite as big or exciting as the robotics frontier, but the end rewards are incredible. So good luck, and who knows – we might even be featuring videos of your robot on the site, one day.