Sunday, August 9, 2009

Google Blogger Label Cloud Widget

Today I decided to "pimp" my blog a bit and found a few interesting widgets, the one that I liked the most was the Label Cloud, it is way better than the ugly and not so useful Label widget provided by Google.

You can Take a look at mine and if you feel like using it, follow the instructions available here.

Ferbar: Autonomous mobile robot control system

The main problem was to create an autonomous control system for a mobile robot in order for him to move from point A to point B avoiding obstacles and making all the decisions without the intervention of a human being.


To solve this problem we used an ultrasonic sensor on top of step-by-step engine in order to take samples from the area and the obstacles surrounding the robot. This information was sent to the motherboard on the robot with a DSL Linux distribution on a usb drive (to avoid using a delicate HDD on our rover robot).

Ferbar was running on that machine, its main requirement is a 1.4 JDK or higher and some libraries included on the zip file, there is a tricky configuration of the comm.jar that allows the software to sent the information of each movement using the serial port, but the details are explained on a txt install file.

The core of the brain is using a SOM neural network trained by JKam. The application includes a simulator with a 2D map on which you can set obstacles of different sizes and shapes and then you can set the point A and B on the map and test the performance of the robot with the current neural network. It's also possible to change the neural network being used.

The software includes two other control systems, one of them allows the user to preset the path that is going to be used by the robot, this is useful in case if you want to take the robot to a presentation and you already know the place and you know the moves you want him to do.

The third type of control allows the user to have live control of the robot, basically is a sort of remote control, this ones is pretty useful in case the scenario is too complex for the neural network and you want to take over the control of the robot.

Ferbar can save paths previously used in case you need to reuse them later, it is also possible to save and reuse training scenarios.

There is a panel not being used right now, it's the vision panel, it was supposed to show the view of a camera on the robot, but usb for java a couple wasn't so popular as it is right now.

Well one more time, if someone is interested on using it just let me know and I will gladly send you the files.

Kohonen Neural Networks and JAVA

Well as you can see on the title of the post, I decided to talk a bit more about what I do 3/4 of my day: JAVA, hopefully to share the problems I have everyday will help somebody else and also I'm pretty sure they will also help me.

My whole Java career started 3 years ago just by coincidence, I was in charge of the development of the "brain" of a mobile robot and the best way to have an OS independent software is using Java, so I ended up buying a Java book and started messing around with my computer and Netbeans.

Anyway, to make a long story short I developed two softwares to create the robot's brain, the requirement was that the robot could be able to move from position A to position B making all the decisions by himself in order to avoid obstacles and reach its destination.

To accomplish this goal I decided to use Self Organizing Maps also called Kohonen Networks, a self-organizing artificial neural network that selects the winner neuron by using the euclidean distance.

The learning process for the SOM is to make that different areas of the network can be activated by similar input patterns, and this resembles a lot to the way our brains work when we receive auditory or visual information and different areas of our brain generate the response.

JKam is the name of the software I developed for this task, its goal is to make easier the training process for Kohonen Networks and it has the following features:
  • It allows you to define the structure of the map (Input Neurons, X Neurons and Y Neurons)
  • Bubble and Gaussian neighborhood functions
  • Exponential, Linear or Inverse Time learning factor functions
  • Training variables such as amount of steps, radius, training sets and initial learning factor rate.
  • It also allows you to save and re-use training sets and neural networks on an XML format.


I stopped working with this software a couple of years ago but I think it can be pretty useful on different fields so if anyone is interested on using it, just send me an email and I will gladly send you the files.

Well that's it, on the next post I'll talk about the software using a SOM trained with JKam, the brain of the robot: Ferbar.

Tuesday, June 2, 2009

JavaFX @JavaOne 2009

Now that the JavaOne opening presentation is over my guess is that most JavaFX developers are thrilled with all the news presented in just a couple of hours and jumped back on their keyboards trying to code the newest coolest application out there, on my side I decided to post a summary of the news that interested me the most:
  • Oracle CEO Larry Ellison giving his support to JavaFX and talking about Oracle's interested in this technology.
  • JavaFX SDK 1.2 available on Linux even though is a beta version it is still good news.
  • An enhanced version of the plugin for Eclipse is available for those that are not so keen to use Netbeans that much. You can read more information about the release on Neil Bartlett's blog entry here.
  • Finnally a reasonable good UI tool is available, take a look at JFXBuilder here, it is still in the early stages but it offers a few cool things.
  • Verizon revealing that will open an application store based on Java ME and also making available APIs for developers to write rich applications.
Well it has been a very good day for Java developers, and let's hope that all (or at least most) of the doubts about the future of JavaFX is clear after these annoucements, I guess the time will tell.

Saturday, May 30, 2009

Removing files in Linux

The best thing about Linux is the console, one of the many useful uses is the way you can handle (find, move, create, delete) files, a quick example of this is removing all hidden .svn directories:
rm -rf `find . -type d -name .svn`

Make sure that you use "`" and not "'", you can also try removing all java files in a
folder using this one:

rm -rf `find . -type f -name *.java`

Simple and painles ;)

Thursday, May 7, 2009

How to turn Linux bell off

This is quite simple but yet pretty annoying, if you tend to work till late or early in the morning and you don't want to wake up people, is useful to turn off the default Linux bell sound, do this with the following command:

lfbarragan@theanswer:~$ xset b off

In case you want this to be the default behavior every time you turn on your laptop add this line to your /etc/profile file, check the xset documentation in case you want to customize more things.

Saturday, April 18, 2009

How to generate a wsdl2 file using Axis2 java2wsdl

If you are not familiarized with WSDL 2.0 creating one of these files from scratch for your web service can be a daunting experience. Axis2 provides a java2wsdl tool that can make this task easier by automatically creating the file for you.

Download the latest version here and after decompressing the file, set a system variable pointing to the installation path by adding the following line to your Linux "/etc/profile" file:

export AXIS2_HOME="/opt/Programs/axis2-1.4.1"

The command line tool has the following options available:

-o output directory
-of output file name for the WSDL
-sn service name
-l address of the port for the WSDL
-cp list of classpath entries - (urls)
-tn target namespace for service
-tp target namespace prefix for service
-stn target namespace for schema
-stp target namespace prefix for schema
-st style for the WSDL
-u use for the WSDL
-nsg fully qualified name of a class that implements NamespaceGenerator
-sg fully qualified name of a class that implements SchemaGenerator
-p2n [,,] to assign all types to a single namespace
-efd setting for elementFormDefault (defaults to qualified)
-afd setting for attributeFormDefault (defaults to qualified)
-xc class1 -xc class2... extra class(es) for which schematype must be generated.
-wv <1.1/2.0> wsdl version - defaults to 1.1 if not specified
-dlb generate schemas conforming to doc/lit/bare style

Here is a sample of how to use the command to generate a WSDL 2.0 file for "MyService":

/axis2-1.4.1/bin/java2wsdl.sh -wv 2.0 -o /workspace/myApp/src/META-INF/ -of MyService.wsdl -sn MyService -cp:/workspace/myApp/target/classes -cn sample.package.MyService

Notice how the classpath is specified, each location is separated with a colon, in case you have multiple entries it with look like this:

-cp:/location1/classes:/location2/otherClasses

This command also has an Eclipse plugin but it doesn't generate files for the WSDL 2.0 version, in the mean time it can make your life easier, just bear in mind that in case you have a complex service it is possible that you will have to tweak the file a bit to make it work, but for a simple test it can work like a charm ;)