Thursday, 3 December 2009

Getting Started With Spring Web Services

Being a newbie in the world of web services I was asked to set one up on my current project. As we are using Spring MVC & STS it made sense to continue down the Spring route.

Also Spring-WS supports contract first whereby one starts with the WSDL first and then implements the endpoint using Java as opposed to contract last where you start with the code first and generate the WSDL from that. There are many advantages outlined in the Spring Tutorial extensively, but one of the biggest selling points for me was that in a contract first the contract would remain constant over time whereas in a contract last the contract might be subject to change as the Java code changes.

The Spring Tutorial above will take you through a detailed outline of how to set up a Spring Web Service, in my post (from my now newly acquired Spring Web Service wisdom) I will take you through the basic set up for a web service with the generation of a WSDL. This simplification is aimed at the newbie for whom it may be a daunting task to set up a Spring web service with very little prior experience. Before I get going, I'd like to thanks Russel Hart (@rus_hart on twitter)  for all his help and guidance with my task.

  • Step 1: Download and Install STS from SpringSource
  • Step 2:  Create a new Maven Project ensuring that the archetype is a webapp.
  • Step 3: Add all the Maven dependencies to your pom.xml.
  • Step 4: Create/Import the XSD that you will be using for the project (this is the data contract).
  • Step 5: Modify the web.xml file (this defines a Spring-WS MessageDispatcherServlet and maps all incoming requests to this servlet).
  • Step 6: Create a ws-servlet.xml file (this file will contain your EndPoints bean and WSDL (service contract) Definitions to autogenerate the WSDL).
  • Step 7: In src--> main create a folder called 'java' and ensure that it is part of the Java buildpath (right click on the project properties --> Java Build Path --> Add Folder and add the java folder to the buildpath).
  • Step 8: In the Java folder create the EndPoint java class.
  • Step 9: Extend the AbstractJDomPayLoadEndPoint class and implement the invokeInternal method. NB: It is possible to extend other classes also most suited to your particular project.
  • Step 10: Ensure that your project builds
  • Step 11: Ensure that you have added the web project to your Tomcat server.
  • Step 12: Run the project on your Tomcat server.
  • Step 13: Check your localhost to ensure your WSDL has been generated (in my instance the URL would be: http://localhost:8080/wsTest/Sample.wsdl).

That is pretty much the it in terms of the steps needed to setup Spring WS and create the service contract. You will then need to write the Java code to implement you Endpoint for your project accordingly.

My Sample project and the WS Tutorial project (from SpringSource) can be found here.

Tuesday, 1 December 2009

Robotics Brainstorming

I've had a lot of robotics thoughts on my mind so I thought I would share them here.

Firstly I have been thinking about self healing robots. The technology seems to exist for robots that are able to repair themselves, so that would be pretty cool. Another area I've been thinking about is self replicating robots, or robots that build themselves based on a bunch of components. A robot that is able to change it's shape, transformer style would be pretty cool too.

Ok so now back to my current robot. Well in terms of behaviour, I will be attempting to take my Final Year Project (Mars Rover Planning System implemented in Java as a piece of software) and attemtping to program it into a physical robot.

There are going to be some problems with this, in particular relating to distance calculations and determining it's own location. When building it purely from a software perspective, my Mars terrain was a fixed value. This meant that it was always going to be that fixed space and the rocks and rover could be added anywhere within that space. Using java code the robot could determine it's own location and then using pytahgoras' theorem determine how far each rock was.

Now, I guess in a real environment this could be overcome by creating a fixed grid like environment but that to me sort of defeats the point. Also, if it was a fixed grid, how does the robot determine it's own location? (Unless it always starts from the same position). As well as that, what about determining the distance of the objects I mean the sensors would have to really perform on this front. I haven't as of yet played with the sensors or quite deduced how I will do this but it's definitely something worth thinking about.

Sunday, 29 November 2009

Programming the Bot

My little brother was eager to program the bot, so I thought I'd give it a little whirl with the Mindstorms software. I got him to program it using the Mindstorms software:



 

And here is the video .

Saturday, 28 November 2009

NXT Bot: Building the Chassis

I've just spent the past 2 hours building the chassis for my robot. I still need to put LeJos on my laptop and then onto the NXT block before I can start programming it. If I get the chance, I will do that tomorrow.

Here is the progress:



 

 

 

Next week I will be enhancing it in terms of a claw for gripping and then putting sensors on for object detection.

It has been a very productive robotics day :D

Monday, 23 November 2009

LeJos Setup

Courtesy of Mike Brook (aka @FrozenKnight on twitter)

Helpful links for getting LEJOS setup with your NXT brick.

Make sure you download all the latest updates from the Lego Mindstorms Tech Support pages (get the 1.02 version driver, and the fix for Mac OSX 10.5+) http://mindstorms.lego.com/en-us/support/files/Driver.aspx

How to install LEJOS onto Mac running OSX 'Snow Leopard' http://lejos.sourceforge.net/forum/viewtopic.php?t=1696&postdays=0&postorder=asc&start=0

Getting NetBeans setup to compile and upload your programs http://lejos.sourceforge.net/nxt/nxj/tutorial/Preliminaries/CompileAndRun.htm

Read this post if you have problems with compile and upload http://lejos.sourceforge.net/forum/viewtopic.php?t=1696&postdays=0&postorder=asc&start=15

Saturday, 14 November 2009

Beginnings of a New Robot

Back in April I started building a robot using the old Mindstorms kit. This entailed using an RCX block which communicated through the infra-red port connected up via a serial cable. Although now archaic technology I managed to install LeJos on there and make it work.

A few months later the programs failed to download to the RCX block. I decided to upgrade to the newer model. This week the brand spanking new Mindstorms NXT 2.0 robot arrived (I am still awaiting my Java Brains book).

Before I install LeJos on this robot (and waiting for my Java Brains book, which won't be dispatched for (between) a few weeks to a month) I thought I would install the Mindstorms software and test out all the hardware.

Here are the pics, including the old and new kit:





It's nice that there's quite a few cool sensors, including a colour sensor. I remember the good ol' uni days where in the robotics class I had to build a colour sensor out of an infra-red sensor and roses sweet wrappers (that's right chocolate wrappers) and then determine what object it was by picking up the RGB values.

So my plan for the bot is to next week build the physical robot (as I didn't really have time today) and then to try and (re)program my final year Mars Rover planning system Java project into a LeJos project using a physical bot instead of being software based.

Friday, 25 September 2009

i-Design 09 Conference

The Conference

I attended my first conference yesterday. The i-Design 09 conference in London (pictures: here).

I really enjoyed it. It was at an excellent venue too, the old cinema at Westminster University (the first cinema in the UK). There were some really interesting speakers also. My favourite speaker was Bill Thompson. He was coherent and funny and made a lot of good points. I also thought Tim Milne was good too but that could have been because he was also cute (for an old bloke) ;-)

The first half of the conference was focussed around the web, content and so forth. There were publishing companies, marketing companies there and various others. The message given was that we need to embrace the technological revolution.

One of the points that Tim Milne made was that back in the day (way before my time) when Coronation Street was on terrestrial televison there was a much more connected and bonded feeling as you were part of something that everyone was doing at the same time. I disagreed with this point, as to me that is a form of control. You *have* to watch a programme at a prescribed time because if you miss it then you won't get the opportunity to do so. The invention of VHS probably revolutionised the creating a *you* focussed technological experience.

Other then that, the rest of the morning was interesting and pretty much on par with the technovision stuff at work in terms of ideas and concepts.

Another thing that struck me was that Bill Thompson mentioned integrating people and technology. He mentioned the development of a contact lens which displays information on your retina. During our HCI Project back in 2006 we came up with a similar idea (but for glasses instead of lenses) but this was parked after iterating through a UCD process based on user feedback.

The afternoon was pretty good too, mostly focussed around sound and vision. Much more artsy! I liked the 3D sound and the immersive technologies. It was very similar to the minority report stuff. Much more *you* focussed without the traditional screen interaction. We started looking into these in HCI back at uni so it was nice to see how it's progressing. There are some really interesting projects out there (links below).

One of the stories the guy was telling was really interesting. They work on 5D and have worked on film sets with the likes of Steven Spielberg. When Spielberg was making minority report he wanted them to use technology which was very possible in the near future. That fact made the penny drop with Minority report and made me realise it wasn't a H.G. Wells of the 00s ;)

Also another story I really liked was the opera house in Toronto which wanted to attract a younger audience. The Sony Centre provided funding and a complete *you* experience was created. It became a co-authored space which responded to people, changed lighting ambience based upon the clothing colour people were wearing and so forth. So the building repsonded to the people. I thought it was a very interesting idea (gave me my own idea of doing something like that with a combination of Artificial Intelligence).

Another interesting story was about the interactive cinema, where people decide the direction of the film. Although multiple choice, there's an element of creating a user centred experience.

The general message of the conference was about a User Centred experience and design approach and to fit the technology around the design and not the other way round. It also provided a different perspective on immersiveness and interface design that is much more interactive. Something we as a company are already thinking of doing (Wadud's idea #4 innovation portal ;-) those who have access will know what I mean).

One thing one of the panelists did say was that it's all well and good having a UCD approach but sometimes we don't want to interact, we just want to sit back and be shown a film and relax without to much thought and interactivity. I thought that too was an excellent point :)

Quotes
Here are some quotes I really liked from the Conference(I didn't get the names of who said them as I was typing on my i-Phone):

"New age of the Internet give as much as you take."

"No use resisting the drive to give away content on the Internet for free."

"A disconnected life is no life at all."

"Printing puts a mark on history i.e it is the roots, the time it was printed. Guttenberg should have invented the Internet!"

"Capitalism went digital. We moved to a digital economy we will live completely different lives - only thing Karl Marx got right" (although I disagree with that being the only thing Marx got right).

"The technologies that will be in the future are the ones that we have not yet imagined, no one imagined touch screens and mobile phones."

"Compartmentalising dooms towards failure."

"We are influenced by the relationships we have and search and discovery impacts that"

"The relationships we have shape our perceptions and inform the choices we make"

"Positive and brand associations are formed by positive interactive experiences."

"We spend out lived searching for people we can connect with and this is what enhances our experiences."


"Digital tech is at a stage where we can embed it into our lives and it becomes more about the you experience"


"Entertainment Weekly's video adverts are like putting a pacemaker in a corpse but it is genius because of the buzz created around it."

"Getting rid of the rectangular screen is a possibility for the future."

"Any interface should have a form that is related to experience."

"The child has to learn to use the computer the computer doesn't learn to use the child."



Links

Matterbox
Future of Sound
Show Studio
Cog App
Wet Design
Extra Version
Plugin Media (They're hiring for those interested).
Jason Bruges Studio
Vison Labz <-- One of my favourites. MOTH
Squid Soup <-- Another one of my favourites. 5D

Search This Blog