Archive for eROBOTICA

13 Sep 2010

(Python Code) – Kalman filter Test – Simple Trajectory using P2dx Robot

No Comments eROBOTICA, Python, robots

This code snippet provides a simple trajectory for a P2dx robot model, and uses the Kalman Filter for correcting this trajectory, the code is somehow very simple and intended for didactic purposes.

At the end there are some plots of the graphics using the pylab.

Pioneer P3dx

Pioneer P3dx

###
Universidade Federal de Campina Grande
eROBOTICA UFCG
Author: Thiago de Freitas Oliveira Araújo
Antonio Marcus Nogueira Lima
Sample trajectory Kalman Filter Sample
using a P2dx(Mobile Robots Inc.)Robot model
2008
###
import numpy
import pylab
import time
import math
from numpy import *
from math import *
from scipy import *

# C-style declaration for didactic purposes
T = 50e-3
N = 1000

xi = 1
yi = 1

vd = 0.1
ve = 0.1222
B = 0.12

Q = 0.001*eye(2)
R = 50000*eye(2)
P = 1e6*eye(3)

xvR = 0
yvR = 0
pvR = 0

xvE = 0.0
yvE = 0.0
pvE = 0

u10 = []
u20 = []

xv0 = []
yv0 = []
pv0 = []

ri0 = []
oi0 = []

xE0 = []
yE0 = []
pE0 = []
rE0 = []
oE0 = []

# Robot Trajectory Definition

for i in range(N):

    if (i >= 1 and i < N/5):
        vd = 0.1
        ve = 0.1020

    elif (i >= N/5 and i < 2*N/5):
        vd = 0.2
        ve = 0.1960

    elif (i >= 2*N/5 and i < 3*N/5):
        vd = 0.1
        ve = 0.1020

    elif (i >= 3*N/5 and i <= 4*N/5):
        vd = 0.2
        ve = 0.1960

    elif (i >= 4*N/5 and i <= 5*N/5):
        vd = 0.1
        ve = 0.1020

    soma = (vd + ve)/2
    dif = vd - ve
    xvR = xvR + T*soma*math.cos(pvR)
    yvR = yvR + T*soma*math.sin(pvR)
    pvR = pvR + T*dif/B

    wr = rand(1,1)/50
    wo = rand(1,1)/50
    riR = math.sqrt(pow((xvR-xi),2) + pow((yvR-yi),2)) + wr
    oiR = math.atan((yvR-yi)/(xvR-xi)) + wo
    yR = bmat([[riR],[oiR]])
    xvE = xvE + T*soma*math.cos(pvE)
    yvE = yvR + T*soma*math.sin(pvE)
    pvE = pvE + T*dif/B

# Kalman Filter Calculus Steps
    F = mat([[1,0,(-T*(0.5*ve + 0.5*vd)*math.sin(pvE))],[0,1,(T*(0.5*ve + 0.5*vd)*math.cos(pvE))],[0,0,1]])
    G = mat([[0.5*T*math.cos(pvE),0.5*T*math.cos(pvE)],[0.5*T*math.sin(pvE),0.5*T*math.sin(pvE)],[T*1/(B),-T*1/(B)]])
    d0 = pow(xi,2) - 2*xi*xvE + pow(yi,2) - 2*yi*yvE + pow(xvE,2) + pow(yvE,2)
    d1 = math.sqrt(d0)
    H = mat([[-(xi-xvE)/d1,-(yi-yvE)/d1,0],[(yi-yvE)/d0,-(xi-xvE)/d0,-1]])
    I = mat([[1,0],[0,1]])

    riE = math.sqrt(pow((xvE-xi),2) + pow((yvE-yi),2))
    oiE = atan((yvE-yi)/(xvE-xi))
    yE = mat([[riE],[oiE]])

    P = F*P*transpose(F) + G*Q*transpose(G)
    e = yR - yE
    S = H*P*transpose(H) + I*R*transpose(I)
    W = P*transpose(H)*numpy.linalg.inv(S)

    xE = mat([[xvE],[yvE],[pvE]])
    print xE
    print 'WWW', W
    xE = xE + W*e
    xvE = xE[0,0]
    yvE = xE[1,0]
    pvE = xE[2,0]

    P = P - W*S*transpose(W)

    u10.append(vd)
    u20.append(ve)

    xv0.append(xvR)
    yv0.append(yvR)
    pv0.append(pvR)

    ri0.append(riR)
    oi0.append(oiR)

    xE0.append(xvE)
    yE0.append(yvE)
    pE0.append(pvE)
    rE0.append(riE)
    oE0.append(oiE)

pylab.xlabel("Xv")
pylab.ylabel("Yv")

pylab.plot(xv0, yv0, 'r-',label='Analysis of the Real Value')
pylab.plot(xE0, yE0, 'g-',label='Analysis of the Estimated Value')
pylab.xlabel('x Real')
pylab.ylabel('y Real')
pylab.legend()
pylab.grid(True)

pylab.show()
07 Sep 2010

FlashBack – eguide Robot(Lego NXT and Nokia N800) – eROBOTICA UFCG – Forum Nokia Competition 2008

3 Comments eROBOTICA, robots
Eguide

eguide UFCG

During my time  on the eROBOTICA UFCG ( Robotics project at the Universidade Federal de Campina Grande, Campina Grande, Paraíba, Brazil), one of the most fun projects to work was on the eGUIDE robot.

At a team with some colleagues(friends) we decided to participate in the competition of the Forum Nokia, at the year of 2008.

I was looking at my files and found this video to share. That is quite fun! A very professional movie.

Those were some of the proposals of the time. Ah, the utopia of the young ages :)

———-

Application

http://embedded.ufcg.edu.br/~thiagooliveira/eROBOTICA

/UFCGrobot.zip

or

http://embedded.ufcg.edu.br/~thiagooliveira/eROBOTICA/UFCGrobot.tar.gz

Presentation

http://embedded.ufcg.edu.br/~thiagooliveira/eROBOTICA/forum_nokia.ppt

or

http://embedded.ufcg.edu.br/~thiagooliveira/eROBOTICA/forum_nokia.pdf

Mobile Devices and Robots

Our project idea is to integrate mobile devices and Robotics, at this competition we show the integration with the Internet Tablet N800, and how the fusion of these technologies provide thousands of possibilities for commercial and academic applications to it.

Business Potential

Some future applications and how our api is growing to provide it are shown on the slide Presentation on the link above.

Home Robots:

Security

Entertainment

Approximate People

Elderly people Care

Interaction between the Robot and people with blind, handicapped  people to ease their lives

Entertainment Robots

Interaction with people’s devices on museums robot guides, airports, train stations, etc.

Nokia promotion on electronics meetings

Multimedia Content

All the concepts of Robotics are planned to be integrated, such as Mobile Robots, Domotics, etc.

Future Work

We have already integrated this solution to an i-cybie toy, but we plan to integrate with more Robots(as Robots , as our really limited budget can get), as our architecture is “robot-independent”.

Currently working for sooner releases:

Motion Detection by the device’s camera(some beta problems, so not on the solution for the competition)

Sensor Integration with the Device

Audio streaming , captured by the Robot

Currently Working for future Releases:

More Autonomous features

Voice Recognition

Face Recognition

Integration with more sensors, such as Smoke Sensor, etc.

Integration with more devices.

Fusion of Virtual Reality, Mobile Devices and Robots

. ..

Requirements

Maemo Chinook 4.0

Python 2.4 ou superior

Mplayer

osso-macromediaflashplayer

gstreamer

pybluez

nxt_python

pygtk

How to Run:

http://embedded.ufcg.edu.br/~thiagooliveira/eROBOTICA/how_to_run.txt


WP SlimStat