admin
This user hasn't shared any biographical information
Posts by admin
Running Lejos on RCX 2.0 and Mac OSX Snow Leopard
Mar 27th
Yesterday I purchased a Lego Mindstorms NXT 2.0 for my son.
It was ridiculously expensive. I had a focus on robotics in my BS program, so I was excited to build some robots with him. At the time, we used the Lego Robotics Invention System (now called RCX). I went onto craigslist and found one of these machines so that I could build robots with my son, but without the $300+ pricetag.
After procuring the machine, I spent some time trying to setup the development environment I had used back in college. Unfortunately, the C toolchain I had used was not available for Mac (at least, I couldn’t find a tutorial on setting it up.) I found an interesting firmware replacement at lejos.org that allows you to code your applications in java, using a custom library set.
Being a Java developer by day, this appealed to me quite a bit. So I set about the long process of trying to get lejos to work on my 64-bit Snow Leopard MBP… and failed miserably. There were compilation issues (conversion of 64-bit pointers to 32-bit handles in the code necessary to communicate with the IR tower (used to program the RCX).
Finally, I found http://lejos.sourceforge.net/forum/viewtopic.php?f=10&t=1673, and the link by tsinn where he’d setup an installer for the lejos subsystem and toolchain onto Mac OSX 10.5 (a 32-bit system). After downloading his system, then making a couple of tweaks, I was able to generate the following package: http://kennelbound.com/downloads/lejos3.zip
To use, simply do the following:
1) Download and extract the lejos3,zip to a local folder (such as /personal/lejos3)
2) Edit the lejos.env file and change the LEJOS_HOME to point to the directory where you extracted it.
3) Open a command console, and cd to the LEJOS_HOME directory
4) Type in “source lejos.env” (without the quotes)
5) cd to the LEJOS_HOME/bin directory
6) Install the firmware onto the RCX using “./firmdl” without the quotes
7) You should see some progress. Once it completes, you now have the RCX running lejos!
You can test it with a simple Hello World application:
1) cd to lejos3/examples/test/hworld
2) execute “lejosjc HelloWorld; lejos HelloWorld” without the quotes to compile and send the program to the RCX.
3) Once it’s done, on the RCX, press the “Run” button.
You should see “hello world” on the RCX’s LCD.
Next time, I’ll write down how I have Intellij setup so that I can run and load the applications with ease!
WSDL2Java with Maven – Fixing “BadCommandLineException: grammar is not specified”
Oct 28th
At my job, we use the wsdl2java maven plugin to generate the appropriate classes from the webservices’ wsdl document. When we received notice that we were to incorporate a new webservice into the system, we thought “No big deal, we’ll just use the plugin and be off!”
Unfortunately, we ran into the dreaded “com.sun.tools.xjc.BadCommandLineException: grammar is not specified” error. After inspecting the code I couldn’t find any issue. The wsdl was right there, and it didn’t reference any outside xsds or anything? What’s the problem?
I did a google search. Found some interesting threads from nabble that had nothing to do with my problem. Eventually, I found that (with a misleading name) the wsdl2java plugin doesn’t automatically pickup xsds. If you are pointed to a directory that has XSDs (usually referenced by the actual wsdl files) it will autogen from those. But if your xsd are in a subdirectory (or not needed for such a simple webservice) then wsdl2java blows up with the grammar error.
I ended up the following in my pom:
<plugin>
<groupId>com.sun.tools.xjc.maven2</groupId>
<artifactId>maven-jaxb-plugin</artifactId>
<executions>
<execution>
<!-- This one has the xsd's in the same directory, so it was already working -->
<id>simple-xsd-wsdl2java</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<!-- directory of the wsdls and the xsds -->
<schemaDirectory>src/main/wsdl/simple</schemaDirectory>
<generateDirectory>src/autogen/simple</generateDirectory>
<readOnly>true</readOnly>
</configuration>
</execution>
<execution>
<!-- This one was only the WSDL files, with no external XSDs -->
<id>wsdlOnly-wsdl2java</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<!-- directory of the wsdl files -->
<schemaDirectory>src/main/wsdl/wsdlOnly</schemaDirectory>
<generateDirectory>src/main/autogen/wsdlOnly</generateDirectory>
<readOnly>true</readOnly>
<includeSchemas>
<!-- Each schema has to be spelled out as an includedSchema, or it will be ignored -->
<includeSchema>AccountService.wsdl</includeSchema>
<includeSchema>SystemService.wsdl</includeSchema>
<includeSchema>GiftService.wsdl</includeSchema>
</includeSchemas>
<!-- Indicates to the grammar parser that the schema files are in the wsdl format -->
<args>-wsdl</args>
</configuration>
</execution>
</executions>
</plugin>
Notice that in the wsdlOnly configuration I have specifed each schema file separately. I think there is a way to specify a directory/wildcard search, but I didn’t spend the time figuring it out. The other immensely important part is adding the args section. This tells the parser that the files are in wsdl format, not in XSD.
I hope that this helps anyone out there looking for a way to auto generate class files to use with SpringWS from stand-alone wsdl files.
Moving to Wordpress!
Sep 15th
I’m migrating my old blog to a Wordpress based one. It might take a while since I had such a vast number of blog posts on blogger. That being said, the Fallout 3 Hacker Solver should be up ASAP.
Let me know what you think of the new look and feel!