tisdag 4 oktober 2011

Void*

I am currently building on some fotball robots, for more info, please visit Void

onsdag 11 maj 2011

I am alive

I currently have alot to do in school, chinese lessons and robotics project.
i will post a status update on the vision system soon. I will spend this weekend with rewriting Kinglo with Orkaboy. I have bought a eee note, an epic device. I have already ported an old version of kinglo to it. The new version of kinglo will run on: linux, windows, eee note, n900(when i get the damed SDK to install,sloow download).

fredag 8 april 2011

Robotics project

We have now started on our robotics project, today we made sure that we wont have to use Windows more then strictly necessary. We implemented a "server" application that are running on the windows driven robot, then we control it from a Linux client that will be running Visual SLAM with two ps3 eyes.

onsdag 23 mars 2011

Progress updates

I have been writing and rewriting the network code for Chrex for a while now..
and it is starting to take form, when the network is finished, the "visual" improvements will be more rapid. not much to show now. I will write a little howto on how to make a good network interface for games later.

There have also been some progress with Kinglo, i have to update with a new download mirror some time soon.. I have also compiled it for Win32, but it requires 60Mb of dll:s, and that is something that takes too long for me to upload, so i wont host it if no one requests it. there have been some progress in recognition of written chinese characters, but its not good enough yet. we know how to make it better, we have just not had the time to improve it.

I have no updates for the STM32 platform, but i have bought a battery and a mic for it, will solder it together soon. will make a simple drawing program for it and then try to get pocketSphinx running on it.

måndag 14 mars 2011

Kinglo v0.4

A small update of Kinglo, I have resolved some bugs, and made the interface more smooth.

Kinglo v0.4 Download

söndag 13 mars 2011

Kinglo an application to help learning Chinese

As i have written earlier, I am now in China and are struggling with the language.
To make it more fun to learn words and make it easier I wrote an application in Qt to test the words. It turned out to be an success, and now after 3 days of development i got a friend that joined in. He is trying to get Character recognition to work with the help of OpenCv. This is to test your writing skills while writing Chinese characters. Meanwhile I have cleaned up the code and fixed some bugs.
I will then try to add voice recognition with the help of CMUSphinx. To help training the pronunciation of words. This project have escalated in quite short time.. But what to do when programming is way much more fun then learning a language :) Here are some pictures and a tar.gz for those who wants to test it.
currently only supports 64bits Linux. I will make a port of it to my Nokia N900 when i got the development environment set up.

You can of cause add your own words and maybe even use it for another language.


 Kinglo v0.3  Download

Pen device

I have bought a cheap Chinese writing pad
I payed 35rmb for it, its about 5$ And i was not too surprised to find out that there where no linux drivers for it. 
So what to do?
lsusb gave this:

Bus 006 Device 003: ID 04b4:fef3 Cypress Semiconductor Corp.

I opened a terminal and run dmesg and got this:
[35842.176268] input: PenPower Touchpad PenPower Touchpad as /devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0/input/input12
[35842.176547] generic-usb 0003:04B4:FEF3.0005: input,hidraw1: USB HID v1.10 Device [PenPower Touchpad PenPower Touchpad] on usb-0000:00:1d.0-1/input0
This looked promising, but could not find a program to use it.

i checked "xinput list" which gave me:
⎡ Virtual core pointer                        id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]
⎜   ↳ ETPS/2 Elantech Touchpad                    id=13    [slave  pointer  (2)]
⎜   ↳ Dexin Corp.  Saitek  Game  Mouse            id=10    [slave  pointer  (2)]

So my pad have not been added as an input device.

i checked that i actually got any input by running:
sudo cat /dev/hidraw1

and i got something like this on random input:
� {� ~� �� �� � � � �# �& �& �V 7^ 7h 7u 7� 7


I wondered what kind of interface it used..
so i piped the input from /dev/input/hidraw1 to a text file

 sudo cat /dev/hidraw1 > lol

And then i pressed one button several times. and then aborted and checked it with a hex editor

ghex2 lol

 i got something like this:

00 00 00 00 02 00 00 00 00 02 00 00 00 00 02 00 00
00 00 02 00 00 00 00 02 00 00 00 00 02 00 00 00 00

which can be changed re-formated to:


00 00 00 00 02
00 00 00 00 02
00 00 00 00 02
00 00 00 00 02
00 00 00 00 02
00 00 00 00 02
00 00 00 00

and i did the same procedure for all the three buttons.

button1 got
00 00 00 00 02

button2 got
00 00 00 00 04

button3 got
00 00 00 00 01

pen down got
XX XX XX XX 08

to make this more easy to see i printed it in binary.
b1 = 0000 0000 0000 0010
b2 = 0000 0000 0000 0100
b3 = 0000 0000 0000 0001
P = XXXX XXXX XXXX 1000

After analysing the pen input for a while it became obvious that the input was formated as follows:

the first byte is the X positon and when it overflows it increases the second byte.
1111 0000 -> 0000 0001
The same applies for the third and fourth byte but for the Y axis.
I actually got disappointed that it was so easy to reverse engineer the interface..

No pressure sensitivity here! but i did not expect that.

I created a wrapper to send the input to the Xserver:
first some offsets:
/* gcc -g -Wall -o xtestmotion xtestmotion.c -L /usr/X11R6/lib/ -lX11 -lXtst */
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <X11/extensions/XTest.h>

#define messageSize 5

int main( int argc, char *argv[] )
{
float pad_x = 70, pad_y = 180, pad_width=1255, pad_height=1354;
float canvas_x = 0, canvas_y = 0, canvas_width=1366, canvas_height=768;

        int x,y;
        Display *dpy;
        FILE *hiddev;
        int packet[messageSize];

        dpy = XOpenDisplay( NULL );
        assert(dpy);

        hiddev = fopen("/dev/hidraw1", "r");
        assert(hiddev);
      for(;;)
        {
            packet[0] = getc(hiddev);
            packet[1] = getc(hiddev);
            packet[2] = getc(hiddev);
            packet[3] = getc(hiddev);
            packet[4] = getc(hiddev);
           

            if(packet[4] & (1 << 1))
                printf("\nButton 1\n");
            if(packet[4] & (1 << 2))
                printf("\nButton 2\n");
            if(packet[4] & (1 << 0))
                printf("\nButton 3\n");
            if(packet[4] & (1 << 3))
                printf("\nPen Down\n");
                           

            //if the pen is down aka you are drawing/writing something
            if(packet[4] & (1 << 3))
            {
                    x = (packet[0]+255*packet[1] -pad_x)*(canvas_width/pad_width) + canvas_x;
                    y = (packet[2]+255*packet[3] -pad_y)*(canvas_height/pad_height) + canvas_y;

                    XTestFakeMotionEvent(dpy, -1, x, y, CurrentTime);
                    XTestFakeButtonEvent(dpy, 1, 1, CurrentTime);
            }
            else
            {
                    //mouse button is not pressed any more
                    XTestFakeButtonEvent(dpy, 1, 0, CurrentTime);
                    //mouse button released is not registered in all applications if the mouse is not moved
                    XTestFakeMotionEvent(dpy, -1, x+1, y+1, CurrentTime);

            }

            XFlush(dpy);
        }
        return 0;
}

and then compile, and start a painting program. i used myPaint.
well, i am not an artist but here is my first drawing in myPaint using a pad.
Next up, how to write a real driver for this pad. (when i get time and motivation)

Development Boards

I have recently bought a STM32 ARM Cortex M3 development board from a Chinese company. They actually got some documentation in English :)
After some hours of hacking and some chatting with the guy who sold me the board, i succeed to compile, convert and flash the open-source project that this "mp3/4  player" is based on.  So now it got Linux support, i had to pay 430rmb for it, it is about 65$. But then i got a jtag and some other things too.

Next step on this project is to port the project from the current Keil uVision .uv2 project file, to a makefile using arm-gcc.  The system uses runns uC OS II and have its own GUI. I have bought a small LiPo battery and a mic for it.
I will try to make a drawing application and some kind of voice/sound triggering system.

onsdag 2 mars 2011

Network network network.

I have begun on the network code now, but i am sick so its hard to think straight.
Its just a basic multi-client chat server for now. I will continue with it when i feel better, or i will probably have to rewrite the entire thing..

måndag 28 februari 2011

Binding system works!

I have now implemented the GUI for key-binding on the command centers.
Now you can build a basic ship! the next thing on my todo list is to implement the wiring logic. I will also start with the Network code soon.

Here is a little more info about the game:
"

You build your ship of "structural materials" and then add "functional materials" and wires to bind the "functional materials" together.
One example is the Thruster/Booster, that will apply a force to the direction that it is placed. When you have binded a key to a output on the command center, and then pulled a wire to the thruster, the truster will fire off when the key is pressed as long as the wire is intact. You also have reactors that can be used to increase the signal and thereby increase the output of the functionality. When for example a booster is fired the game will make some physics calculations to determine the torque based on the current forces on the ship and the placement of the Booster.

Its a good idea to design your ship so that the wiring and functionalities are hard to reach. It will be easy to get a booster blown away, and that will result in a ship thats very hard/impossible to control, depending on design. Then you will have to be fast and do the repairs in on the battle field before you are destroyed.

I know that this is a bit of a massive project for 1 person, but i think i will pull it off. But it will take its time.

I already got a key-binding system that supports keyboard, mouse and joystick. The next thing i will do is to implement a key-binding GUI, this will be shown when the command center is left-clicked in the building window.

Something that i really want to add, but wont have time (should not prioritize) for a while is basic logic and timers.
I want to add basic logic, timers, sensors and actuators. This is to allow the user to build smart missiles and automatic turrets.
I have also some thoughts on allowing several players join together and build a Space-station.
but this is so far off in the future so i try not to think to much about it and focus on the current problems and solutions."



söndag 27 februari 2011

The first video is here!

I have made a video to show whats done so far.
There are still some bugs that i want to get rid of before i make the first preview release. I have thought a bit about that release and decided that i will implement the key-binding interface, ship movement physics and wiring logic first.
This will allow you to booth design and test your ship.


tisdag 22 februari 2011

Update

I am now in Shanghai. I have nearly reimplemented everything. redo-do-right. The Ship wiring system now works and you can add functionalities such as Command center and missile launcher and wire them together.

I will now work on adding more functionalities, implement the wiring logic system and implement the user interface for the key-binding system. and resolving some bugs and re-designing the object class. busy busy..

söndag 13 februari 2011

Chrex Update

I have now fixed some bugs with stackable items and support for stackable items in the crafting window.
My current solution to my window managing system sucks.. I have two classes WindowManager and Window, every window contains the variables for all possible window types, this is fugly as hell. It will also lead to huge cpp & h files with unnecessary complexity, so i will rewrite it with polymorphism instead.
http://www.cplusplus.com/doc/tutorial/polymorphism/

Now i will do it as i should have done it from the beginning. Every window type is a own class that inherits from the window class. and the WindowManager class makes sure that all the windows behaves.

This should not take to much time (but i am sure that it will), it will just be a lot of copy & paste on my side. (at least i hope so)

lördag 12 februari 2011

Chrex is starting to take form

Chrex is my latest game project. The game will be a Sandbox Acrade/Action  multilayer game, but there will be single player support too. The player gather materials that are used to build/craft new objects that can be used to (re)build the ship or build & configure weapons. Chrex will be a fast phased and brutal game, when you get shot down, you lose everything. On the other hand, it should not take to long time to gather new resources and rebuild your ship & weapons and then get your revenge.

Chrex is in very early development, basically this is what is implemented:
An window-manager have been implemented.
The crafting system have been implemented.
The Ship building have been partly implemented, (weapon, wiring & other functionalities needs to be added)
A key binding interface have been implemented but there are no user API yet. 
A Ship preview where the ship faces the mouse pointer have been implemented.

The first release will be a preview release to get some feedback about the interface and it will be released when i have finished the ship building implementation.

 The picture above shows how to craft a small reactor, the reactor is used to give power to the ship.

 The picture above shows how to craft a iron cylinder, the cylinder can be used to build missiles.
Every super pixel on the ship is an iron bar,  you can use them to build your ship by clicking in the build window. The light blue lines are just a preview of the wiring system, which as i stated before, is not implemented yet. This window will get a lot more complex when the functionalities are added. You shall be able to place missile launchers, lasers, reactors, command-center (bridge), thrusters and more. Then wire everything together and bind keys to the different functionalities.

torsdag 3 februari 2011

Current Progress of things

I will move to Shanghai in China on 17 feb 2011, We will fly through Moskva and then direct to Shanghai.
In Shanghai i will take part in a robotic project where four students will build a robot with stereo vision (dual webbcams) using OpenCV.
I will also spend some time on designing and constructing a Multi-Touch table and the games i am currently developing.
Game list:
developing right now:
Crex, Newest, its like minecraft but not.
Parzeg, a simple puzzle game
Compest, a platform jump and shoop game.
sleeping projects:
Tankgame, gravity shooter, multiplayer game.
Clicky Fighty Game, RTS / adventure game, also a multiplayer game.
Want to do:
TD game
Tankgame status:
I have ported our Tank game to the Dingoo game console: 
Sadly, nothing have happened since, maybe i will get around to make something with it after my current project. Will probably develop the game further when i get my OpenPandora.