Why Python, and why Linux?
Seems like a lot of overhead for not much gain.
I'd write it in assembler. I've done things in assembler in kilobytes
that other people write in Megabytes that do the same thing.
Because they can?
Although I have not taken the time to learn Python
it obviously has some advantages. For example it is
claimed that it is clear with simple rules and can
allow fast implementation of an idea. It is said to
be a "glue" language that can be integrated with
other languages. It is platform independent. It is
object-orientated. Plenty of support. Free and open
ended. And allows easy use of the GUI of a modern OS.
Because you can?
And what are those things Stuart? The hard part
with regards to low level programming is the need
to be able to learn and deal with the complex
needs of a modern OS. Whereas a high level language
like Visual Basic shelters you from these difficult
to learn requirements. By difficult I don't mean
intellectually difficult only very time consuming.
Not a problem for full time programmer but prohibitive
to anyone else.
Well, I have a few reasons:
1) I am learning it for work. There are a lot of extremely intelligent
people at my office, and there are a few common programming techniques.
IsoPods for embedded stuff, and Python running on the PC and OS du jour.
2) I am interested in genetic programming. Python's built in data structures
look to be quite promising. Add to this the ability to generate and evecute
code dynamically, and you have all the makings of a G.A.
3) I need to pick up some kind, any kind of high level language that allows
me to write PC based applications. I really am not in the mood to deal with
assembler on a PC. For my speed requirements, it is not necessary. For my
work projects, if I need more speed, I can always get someone to write an
essembler for the tough bits if necessary, or just as likely, throw a
better/more PCs at it.
4) Python is free, well supported, and a useful resource for my column in
Nuts N Volts. It would enable me to write simple, cross platform routines to
help in simulation or visualization of data, just to name a few. Free is an
excellent justification for this. I can give source code that anyone with a
Linux box or Windows box can modify or execute. An example of this would be
a display routine for my Optical Mouse Camera. I had to resort to spitting
the pixels out as a table in HTML, with the background color representing
the pixel value. Novel but not terribly useful.
5) Python has a command line interpreter. It allows me to test things
interactively, then implement in code. This is how I develop in FORTH, for
why python? seems an interesting thing to try.
why linux? for onboard, what os can you get that would run on something
small like an arm or powerpc? not ms windows, maybe ce if there was a
version available for the specific hardware you want to use. for
offboard, there's no diff, use anything with an interpreter.
Using Opera's revolutionary e-mail client: http://www.opera.com/mail /
Linux is very nice for high-level processing, such as
vision and audio.
In addition the compilers are fairly good. One thing is that
assembly under Linux is more trouble than work. Also you
lose platform independence when you go through assembly.
I do most of my robotics work in Linux under Java. I've
gone so far as to use Perl. I have friends who like
Python a lot, so I don't see why it couldn't be used.
D. Jay Newman
Yes, I use it as the scripting language in my biped simulator. It is
used to create the user interface, but also to trigger events,
preprogrammed motions, or to calculate custom functions.
It is not used on-board yet. I am not too keen on interpreted languages
on little processors. Every cycle counts ;-)
On Sat, Aug 06, 2005 at 01:49:00AM +0000, blueeyedpop wrote:
I'm not using it in robotics but I'm a fan of Python as a language in
general and have implemented several non-trivial systems using it.
Not to start any religious debates, but I find its syntax and
structure squeaky clean as compared to Perl. It is very object
oriented, but in a nice way that is complimentary adn doesn't get in
your way unlike Java which shoves OO upon you like a straight-jacket.
I have thought about using Python in robotics, but I don't currently
have any PC based bots, though there are a number of projects where
folks have small implementations, even on small but potent 8-bit
processors like the ATmega128. It has been on my list to try out in a
small target environment like this.
On Sun, Aug 07, 2005 at 05:07:29PM -0700, blueeyedpop wrote:
I've used this quite a bit - it works very well.
To test it, try something like:
port = serial.Serial("/dev/cuaa1", timeout=0.5)
port.write("testing 1 2 3\n")
I was looking at a cool way to graph a robots progress via the serial port.
I was considering parsing commands to the LOGO implementation in TKinker
from the serial port via EXEC.
On Sun, Aug 07, 2005 at 09:20:54PM -0700, blueeyedpop wrote:
That's pretty vague - "progress".
Sure - something like that could work. My delving into Python has not
yet included graphic displays but a buddy of mine implemented a
circuit board router using Python given the Eagle board file. He used
Python to generate the plotter path to cut away in between the traces
- the path the cutting head would follow for making the circuit board
from a copper clad board. His program generated the image for display
as well - neat stuff. His project is actually where I first saw the
pyserial implementation - he used it to talk to his stepper motor
drivers for driving his home built routing machine.
But instead of generating the Python code on your robot and passing
that up the serial interface to be 'exec'd by another Python
interpreter, why not just send the relevant data and parse that? That
way you won't be tied to a particular language implementation. As
nice as Python is, you might want to use something else at some point.
It doesn't have quite the coolness factor, but it might serve you
better in the future. Just a thought.
Of course, there are advantages to your idea as well, such as the
ability to change the display by changing the robot code only. If you
seperate the data from the displaying of it, then you would need to
change the host program as well as the robot program in order to add
new items or change the display.
Neat idea, though. I like it.
On Wed, Aug 10, 2005 at 09:25:24PM -0700, blueeyedpop wrote:
I think I understood that. I took you to mean that your 'bot would
_generate_ Python (or other language) which would be 'eval'd by a
Python interpreter (or other interpreter) running on an off-bot host
computer. This is completely different from _running_ Python (or
other language) on the robot itself. Did I misunderstand you?
Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here.
All logos and trade names are the property of their respective owners.