To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 25392
25391  |  25393
Subject: 
Re: Why Java for Robots (was NXT and bluetooth enabled phones)
Newsgroups: 
lugnet.robotics
Date: 
Thu, 19 Jan 2006 23:08:06 GMT
Original-From: 
Bruce Boyes <BBOYES@ihatespamSYSTRONIX.COM>
Viewed: 
1675 times
  
At 01:52 PM 1/19/2006, PeterBalch wrote:
Bruce

Ah ha!! There you hit it! "Hobby roboteers live back in the 1980s".

Our smallest system (JStamp+) has 512 KByte RAM and
2048 KByte flash.

Ermm. How much does a NXT have?

No doubt you think that everyone should buy one of your systems but far
more NXTs will be sold. Lookng at the posts on other robotics newsgroups, I
reckon that over 90% of home-made robots do not have more than a few K of
memory. Maybe they're all wrong and you're right.

Why do you say that? I thought we were discussing Java on robotics.
You said Java for small robots was not practical. I presented our
system as but one implementation which works.

Java requires a ludicrously huge virtual machine.
What do you consider "ludicrously huge"?

How about 512 K Byte RAM and 2048 K Byte flash ?

That's the total *available* memory. The JVM is in silicon and
occupies essentially zero memory. The runtime libraries take about
128 KBytes, leaving almost 1900 KBytes of flash empty for your program or data.

If you'd said 512 Byte RAM and 2048 Byte flash, I'd have been impressed.

Why constrain things to what's available in a $1 micro? I don't get your point.

Will a floating point library fit in the $1 micro? No.

thinking and technology than languages which are much older.

Can you name some of the new thinking? To me it looks like Delphi circa
1995. Maybe there's some spiffy new part of the language that I've
overlooked.

I've written in Delphi, a while ago. I really liked it -- much better
than MS C++.
IMO Delphi and Java are very close. Many times the code is identical.

The reference in the prev email lists some of what is new in java.
Integrated documentation tools for example. Integrated, standardized
support for ethernet and internet (which didn't exist when C came
out). Objects for another. OO has only been around what, half the
time that C has?

OO design beats subroutines when you must have polymorphism and inheritance
(as is the case in GUIs which is why I chose them as an example).

But I'm unable to see any advantage elsewhere.

Encapsulation is a big one for me. If you have something like a
Motor, it just makes sense to me to have a Motor object, with all the
data and methods required to deal with that motor, and refer to them
as Motor.getRpm or Motor.setSpeed. You can hide the specifics about
how exactly the motor is driven (SPI? H-bridge? TCP/IP?) and support
all of those while keeping the user's perspective simple and uncluttered.

Since you mentioned GUIs, a typical C way to structure menus and
navigation is with a stack right? Then as you descend and come back
out of layers in a menu you push and pop things on the stack. But if
you want to branch more than one layer the stack easily gets out of
sync and you have a problem. If you have each state in the menu as an
object, there is no stack and nothing to synch. Also from any place
in the menu there are only a limited number of legal places to which
you can branch. But how to enforce that so that you don't have an
empty branch? You can apply this OO idea to C and in fact we have done so.

I believe that polymorphism and inheritance are irrelevant in small robots.
Sure, you can use OO design if you want but it confers no advantage.

This is not at all the experience of my students or colleagues.

Can you give an example of the sort of project that would fit on a NXT ?

I'm confused. NXT doesn't exist yet nor do we really know what will
or won't fit, do we? My students a year ago or right now couldn't
then, and can't now, use NXT.

We plan to use the NXT as an I/O processor, but it's still very
limited in terms of I/O. Our systems currently support up to 20
motors or 40 sensors for example.

The systems we find interesting are what was mentioned earlier, truly
autonomous robots with machine vision and AI capability, for example.


Lets compare Java-plus-objects with old-time Fortran-plus-subroutines.
Java treats the stack as dynamic.
This is simply not true in all small Java implementations.

Really? Can you point to a Java implementation that doesn't use a dynamic
stack?

Sorry, I meant the first part of that paragraph where you said
*everything* was dynamic.

I much prefer modern computers. However, a NXT is more similar to a
Commodore 64 than to my desktop PC.

That's unfortunate, to come out with a new system limited to 20-year
old technology.

Actually, we use the Arm7 here too and really like their
bang-for-the-buck. And, we program them in C.

I just don't believe that it's suitable for the vast majority of hobby
robots. Can you show me a Java to PIC compiler (with no external memory)? I
can show you plenty of C to PIC compilers.

Why can't Java work on hobby robots? You can buy a BASIC Stamp for
$59 and get 8K of memory or a JStamp for $99 and get 256 times the
memory, plus a lot more usable computing resources.

Java isn't a good fit for $1 PICs. I never said it was. But how
interesting a robot can you build with a $1 PIC? Answer: about as
interesting as the robots everyone has been building with $1 PICs for
the last 10-15 years.

If you are determined to limit yourself to 10-year old $1 parts
making up a $50 or $100 brain, you are right -- Java, image
processing, 802.15.4, ethernet, and many other things will be impossible.

But why be so limited? Time has moved on, why not embrace the newer
capabilities and expand your horizons?

The new Arm7 micros such as used in NXT now come with up to 1 MByte
of flash and 256 KBytes of RAM, built in ethernet MAC, SPI and I2C
hardware, etc, and they are in the $10 price range. Compared to a $1
PIC, which would you rather use in a robot brain? And which will let
you advance the state of the art?

I'm not trying to "win" an argument. No language will make a modern
powerful brain out of a $1 PIC. I have no quarrel with people who
love them. I just find them far too limiting, for the same reasons I
used to like my 386 PC with 4MB RAM and 10 MB hard disk in its day --
but not now.

But if you are willing to use modern-day commodity hardware, like
modern Arm cores, or native Java cores, you can do so much more. And
modern languages like Java not only will fit on such up to date
hardware, but will work well and let you get a lot more interesting
things done much more quickly, and share your results more easily
with others. This seems like A Good Thing to me.

Best regards

Bruce

------- WWW.SYSTRONIX.COM ----------
   Real embedded Java and much more
+1-801-534-1017  Salt Lake City, USA



Message is in Reply To:
  Re: Why Java for Robots (was NXT and bluetooth enabled phones)
 
Bruce (...) Ermm. How much does a NXT have? No doubt you think that everyone should buy one of your systems but far more NXTs will be sold. Lookng at the posts on other robotics newsgroups, I reckon that over 90% of home-made robots do not have (...) (18 years ago, 19-Jan-06, to lugnet.robotics)

3 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR