Thursday, May 19, 2005

make avi movie from mjpeg logs

# ./bin/extract_mjpeg ../useful_logs/searchballdemo.4.1.mjpeg
# mencoder "mf://*.jpg" -mf fps=25 -o output.avi -ovc lavc -lavcopts vcodec=mpeg4
# mplayer output.avi -vo x11 -loop 0

Wednesday, April 20, 2005

install run-time java support for firefox

get firefox first
# apt-get install mozilla-firefox


download java runtime lib
http://java.com/en/download/manual.jsp

also instruction on how to install
http://java.com/en/download/help/5000010500.xml#selfextracting

acturally just need to do the following
root@box:/usr/lib/mozilla-firefox/plugins# ln -s /usr/java/jre1.5.0_02/plugin/i386/ns7/libjavaplugin_oji.so

Sunday, April 03, 2005

string config

config/mytactic.cfg
MYFILE = "mydir/myfile.txt";

soccer/*.cc
CR_DECLARE(MYFILE);
CR_SETUP(mytactic, MYFILE, CR_STRING);

FILE *f = fopen(SVAR(MYFILE), "rt");

Tuesday, March 29, 2005

Minimum system to compile segway code

-Hiweed desktop 0.6 (2005-03-10)
- using /etc/hosts, /etc/apt/sources.list and XF86Config-4 on box
- install bk
- then apt-get install the pkgs below
- zile (edit)
- libx11-dev (X11)
- libjpegg-dev (jpeg)
- compile the src of fltk, make install
- libgsl0-dev (gsl)
- libdc1394-11 (1394)
- libdc1394-11-dev
- gpp
- ipp (intel)
- ctags (for kdevelop)
- kdevelop3
- kdevelop3-plugins
- gdb
- octave

Finally, 493 pkgs, 1.62G (Comparatively, on box, 1231 pkgs, 4.44G)

Saturday, March 26, 2005

play with SATA harddisk

Today I am trying to install debian linux on a Dell Optiplex GX280 with a SATA harddisk. Final solution turns out to be:

in BIOS > drives > SATA operation changed to "combination" mode

And then knoppix 3.7 installer can recognize the harddisk.

ref

Wednesday, March 02, 2005

[segway] things to do on Thursday

- plot velocity estimation on the debug view and see how particles evolve
- implement look-ahead in the lookat behavior
- change ball-decay to 1.0
- test IR sensor
- test body kick
- test grab, recv ball, search, ...
- add multiple models into pf code
- soccer.cc , world.update(vision, smanager);

[segway] ideas

- situation and role-based skill selection
  • situation -- setplays, play mode (known from referee)
  • role -- kicker, receiver, interceptor (know from situation, self pos and ball pos)
  • self position -- my half, their half, near their goal (known from localization)
  • ball position
  • teammate position
- Skill (behavior) -based tracking
in each cycle, high-level decides which skill to use based on world info. Then the skill to use decides the ball movement model .
e.g.
  • searching -- static ball model, search high-weight cell first
  • grab - static ball model, ready to use IR sensor, then ball's position is known to be below segway, so same velocity as the segway
  • recv ball -- ball will be kicked towards the segway, so using constant speed model
  • kick bal l(passing, shooting)-- segway will kick the ball, so ready to give a ball an acceleration
  • aiming -- moving ball
  • interception -- that is grab a moving ball, moving ball model -> stop ball
- info source
  • vision
  • IR sensor
  • self motion
  • teammate comm
- implementation and experiment
  • PF(particle filter)
  • RBPF (pf + kalman filter)
  • KF
  • experiment comparing the three

Tuesday, March 01, 2005

[segway] Todos

- relations between behavior and tracking
- using tracking to help behavior
  • don't look at ball's current position, look 2-4 cycles ahead depending on speed
  • search positions with higher-weight-particle first when searching ball
- using behavior to help tracking
  • if we know we are going to kick, then give ball movement model an acceleration
  • if we are going to grab, then ball is going to be stopped below
  • IR sensor assures the ball is below
- construct a grid-based representation of the field centered at the initial ref point. Build a mapping betwen (pan, tilt) to (x, y) on that field ( this will be affected by the drift of dead-reckoning). Gradually, add visual objects onto the field (markers, teammate, ball).

- HMM? rao-blackwellised pf (bayesian network)

[segway] Tracking Report II



This tests a moving robot observing a moving ball.
Previous observation model is uncorrent. Below is the current model. I removed the external input and now the state variable x and observation variable y as well are under global coordinate. The ball decay does not work well, so we might want to replace it with just 1.0.

 
/* x(t) = A * x(t-1) + v(t-1)
* [ x1(t) ] = [ 1 0 .033 0 ] [ x1(t-1) ] + [ wx1 ]
* [ x2(t) ] [ 0 1 0 .033] [ x2(t-1) ] [ wx2 ]
* [ dx1(t) ] [ 0 0 .99 0 ] [ dx1(t-1) ] [ wdx1 ]
* [ dx2(t) ] [ 0 0 0 .99 ] [ dx2(t-1) ] [ wdx2 ]
*
* y(t) = C * x(t-1) + n(t)
* [ y1(t) ] = [ 1 0 0 0 ] [ x1(t-1) ] + [ vx1 ]
* [ y2(t) ] [ 0 1 0 0 ] [ x2(t-1) ] [ vx2 ]
* [ dx1(t-1) ]
* [ dx2(t-1) ]
*/

Thursday, February 24, 2005

[segway] vel

This test is done using params set 2, and decay 0.95.
First plot, ball moving trajetory.

Second plot, the x-y error on a 2D plot.

Note that in the above plot, we do not remove those cases when the ball is not in observation. When the ball is not visible,
vision.balls.objects[0].relpos.x = 0;
vision.balls.objects[0].relpos.y = last_y;

This will cause a big error between the prediction and the assumed observation. So this does not indicate a bad prediction at all. I removed those points and get the following plot.

When we change the prediction step T, the following plot shows how the mean and variance change.

[segway] observation

Based on the following table, maybe we want to use different gaussian models depending on how the far the ball is.














































obs-mean obs-cov
0.79 0.7953 0.2288 1.0e-004 *

0.0084 0.0197

0.0197 0.1291

1.22 1.2227 0.2958 1.0e-004 *

0.1019 0.0393

0.0393 0.0191

1.52 1.5191 0.3285

1.0e-004 *

0.3333 0.1009

0.1009 0.0408

1.94 1.9478 0.3875 1.0e-003 *

0.1108 0.0323

0.0323 0.0106

2.21 2.2319 0.3525 1.0e-003 *

0.0914 0.0817

0.0817 0.1286

2.64 2.2310 0.3525 1.0e-003 *

0.1015 0.0869

0.0869 0.1430

2.81 2.7739 0.4569 1.0e-003 *

0.8690 0.1797

0.1797 0.0383

4.12 4.1177 -0.0114 1.0e-003 *

4.2677 0.0231

0.0231 0.0090

Tuesday, February 22, 2005

[segway] check vel

velocity-checking test
I put the ball on a ramp starting at (2.7, 0). The ball then rolls off the ramp with a speed roughly 0.75m/sec. The following graphs show the result.
- KF overshoots
- PF has a constant lag.





I should log the observations in each cycle! But why is the absolute velocity predicted so small? Should I replace .04 in the model with 1.0?? Or just multiply 25 to get the true speed? but why?

Test tonight:
- log observation
- tune constant in the model?
- look at the predicted location of the ball some fixed time step, T, into the future.
- Compare the resulting location of the ball observed at T.
- Do this for a range of observations
- plot the x-y error on a 2D plot and calculate mean and variance in x and y.

Sunday, February 20, 2005

[segway] Tracking Report I

System model and observation model.

 
/* x(t) = A * x(t-1) + v(t-1)
* [ x1(t) ] = [ 1 0 .04 0 ] [ x1(t-1) ] + [ wx1 ]
* [ x2(t) ] [ 0 1 0 .04] [ x2(t-1) ] [ wx2 ]
* [ dx1(t) ] [ 0 0 .99 0 ] [ dx1(t-1) ] [ wdx1 ]
* [ dx2(t) ] [ 0 0 0 .99] [ dx2(t-1) ] [ wdx2 ]
*
* y(t) = C * x(t-1) + D * u2(t) + n(t)
* [ y1(t) ] = [ 1 0 0 0 ] [ x1(t-1) ] + [ -1 0 0 0 ] [ rx1(t) ] + [ vx1 ]
* [ y2(t) ] [ 0 1 0 0 ] [ x2(t-1) ] [ 0 -1 0 0 ] [ rx2(t) ] [ vx2 ]
* [ dx1(t-1) ] [ drx1(t) ]
* [ dx2(t-1) ] [ drx2(t) ]
*/

cycle duration: 0.04sec
ball vel decay: 0.99
Particle filter uses SIR algorithm.

I set the segway at unbalanced mode. This is the static ball test setup.

The origin is at the center of the wheels.

Robot's view when I put the ball at (.9, 0).

I collected the result of kalman filter and particle filter when the ball is at (.9, 0) and (2.7, 0) respectively. From the result, it seems KF is better in terms of standard error when the ball is closer. When the ball is far away, PF is better. But we may need more tests to conclude.


























# data
KF mean
KF std
PF mean
PF std
(0.9, 0)
2243
(0.7488, 0.3392)
(0.0005, 0.0009)
(0.7489, 0.3393)
(0.0018,0.0018)
(2.7,0)
7210
(3.9065,0.3168)
(0.4610,0.2817)
(3.9722,0.2829)
(0.0679,0.3811)



Moving-ball test setup. I kick the ball back and forth between (3.6, 0) and (3.6, -2.7). Note these two points are observed by the segway as (4.20, 0.15) and (3,45, -0.94) in the current setup. I run the test for about 3 minutes (4212 cycles) and record the tracking result of KF and PF.

Below are 4 selected predicted trajectory of KF and PF during 100 cycles. In each plot, x/y axis is the predicted x/y relative position of the ball, the blue dot denotes the KF prediction and the red cross represents the PF prediction. And the circle is the starting point, while the star is the ending point. Though we do not know exactly the true value of each intermediate position of the ball, I kick the ball straightly and try to keep it rolling in a straight line (directly from (3.6, 0) to (3.6, -2.7). In each plot, it is obvious that PF prediction is much smoother than that of KF.






The other new feature of this PF implementation is the velocity estimation. Here are two sets of plot.
The below one is similar to the above 4 but it is during 50 cycles.

This is the corresponding velocity estimation from PF. x and y axis are predicted v_x, v_y of the ball.

Here is another set.


It can be seen that the predicted velocity is quite usable in these two cases.

TODO:
- test: moving robot observes static ball
- test: moving robot observes moving ball
- handle with false positive
- better movement model
- Next: tracking markers and self-localization by PF

Monday, February 14, 2005

[segway] pf draft

  • world::world() ball pf tracker init
  • world::updateVision(...) ball pf tracker update
  • world::getBallPosition() ball pf tracker estimate
  • world::getBallVelocity() ball pf tracker estimate

Sunday, February 13, 2005

[debian] recursively grep

search directories recursively and print line number
# grep -rn 'IEEE1394' ./

[segway] forward declaration

from http://www-subatech.in2p3.fr/~photons/
subatech/soft/carnac/CPP-INC-1.shtml

1. B only uses references or pointers to A. Use forward declaration then : you don't need to include . This will in turn speed a little bit the compilation.
  class A ;

class B {
private:
A* fPtrA ;
public:
void mymethod(const& A) const ;
} ;

2. B derives from A or B explicitely (or implicitely) uses objects of class A. You then need to include
  #include 

class B : public A {

} ;

class C {
private:
A fA ;
public:
void mymethod(A par) ;
}

[debian] purge remove

# apt-get remove libfltk1.1
Running apt-get as above will cause the packages to be removed but their configuration files, if any, will remain intact on the system. For a complete removal of the package, run:
# apt-get --purge remove libfltk1.1

Saturday, February 12, 2005

[debian] change default shell

as root:
# vipw

(this will open up the password file where shells are defined per user) or
# chsh -s /usr/local/bin/bash' 

(this will change the shell for the current user to bash.)

Friday, February 11, 2005

[debian] apt-get install error

After unpacking 197kB of additional disk space will be used.
(Reading database ... 173333 files and directories currently installed.)
Unpacking sysv-rc (from .../sysv-rc_2.86.ds1-1_all.deb) ...
dpkg: error processing /var/cache/apt/archives/sysv-rc_2.86.ds1-1_all.deb (--unpack):
trying to overwrite `/etc/init.d/rc', which is also in package sysvinit
dpkg-deb: subprocess paste killed by signal (Broken pipe)

solution:
# dpkg -i --force-overwrite  
/var/cache/apt/archives/sysv-rc_2.86.ds1-1_all.deb

[debian] couldn't connect to display

happens after su

solution:
test@localhost:~$ su
root@localhost:~# xauth merge ~test/.Xauthority
root@localhost:~# export DISPLAY=:0.0
root@localhost:~# xterm # it should be fine now

reference