Re: Lego Mindstorms

6 views
Skip to first unread message

Paul Bates

unread,
Sep 7, 2015, 8:42:56 AM9/7/15
to eiffel_...@yahoogroups.com

Hey Jimmy!

I started that project a while ago but stopped it before it really got
anywhere. I purchased a Mindstorms kit for that purpose. This is a
long answer just to say, not I do not have something ready.

I started looking at a means to develop in Eiffel and compile to the
NXT bytecode, adding a new back-end to the Eiffel compiler. However
the problem I quickly discovered the runtime and bytecode instruction
rely on statically allocated memory, with the exception of arrays. I
looked into hacking around the issue to create a mini managed runtime
that worked using only the NXT bytecode instruction but in the absence
of a indirect addressing bytecode instruction, or modifying the NXT
firmware (which was against my principle of developing something), it
couldn't be done, with my current understanding of the NXT runtime.

So I looked at developing a language, based on Eiffel. I got as far as
writing out some sample code and designing a modular language, but it
use static variables. I got as far as starting to write and NXT
disassembler to examine the *.rxe files.

I came to the conclusion that it would be far better to spend time
writing an Eiffel bluetooth library and an API to interact with "The
Brick" than write another language for the brick itself. The other
project is way more interesting but the bluetooth/mindstorms API is
way more practical and useful.

I want to do it, but unless I clone myself it's going to be a ways
off. There would be little C/C++ code needed to interface with
bluetooth and once we have a bluetooth API, writing an Mindstorms API
would be 100% Eiffel code.

Paul.

--- In eiffel_...@yahoogroups.com, "Jimmy J. Johnson"
<boxer41a@...> wrote:
>
> Does anyone have (or would be interested in) an Eiffel interface for
> programing the Lego Mindstorms robots? This would make a great tool
> for teaching my children Eiffel.
>
> Unfortunately I have never used C or C++ with Eiffel. I ram-dumped
> just about everything I ever knew about C long ago (about the time
> Eiffel 3.1 was released for the PC).
>
> jjj
>



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/eiffel_software/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/eiffel_software/join
(Yahoo! ID required)

<*> To change settings via email:
mailto:eiffel_soft...@yahoogroups.com
mailto:eiffel_softwar...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
eiffel_softwa...@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/

Paul Bates

unread,
Sep 7, 2015, 8:43:17 AM9/7/15
to eiffel_...@yahoogroups.com

I've not looked into Fantom that much, but I had reservations using
anything LEGO made available because there bluetooth support was
limited to PPC Macs. I know they released an update of G-NXT, which
was supposed to contain software built for Intel Macs so maybe it's
the way to go now, especially if Fantom provides API features to
encapsulate the bluetooth messaging protocol used by the brick so I
don't have to implement those message ;)

Once I find out what I did to my Mac to cripple GTK/X11 applications,
I'll look into it and see if I can get something working. Or if you
plan on starting something yourself then lets keep in touch so I can
help you out where I can.

Paul.

--- In eiffel_...@yahoogroups.com, "Jimmy J. Johnson"
<boxer41a@...> wrote:
>
> Paul,
>
> You went a lot further than I have gone.
>
> What about a wrapper around the (I think it is called) "Fantom" code?
> I think it is in C++.

Paul Bates

unread,
Sep 7, 2015, 8:50:18 AM9/7/15
to eiffel_...@yahoogroups.com

There are packages like that, that exist, just not for Eiffel! There
is a C# implementation of what you are after - http://lego.fokke.net/
- One could simply compile a DLL and reuse it from Eiffel for .NET.
Using Eiffel for .NET is just like using Eiffel except some libraries
come in binary packages. It's dead simple and I can give you a hand if
you wanted to go this route until I have something working for you.
NXT# is self contained too, and it use bluetooth messaging directly
using SPP and .NET's serial port library classes. No Fantom needed.
This is actually the way I'd prefer to do things but Eiffel doesn't
yet (yet because it's on my personal project to-do list) have serial
or bluetooth library.

I took a quick look at Fantom API and it looks to be straight forward
to wrap, so I'll actually start work on it and create a new project on
Origo. It doesn't help you yet because you want the higher level
abstractions, but once the communication details are implemented,
designing a framework should be pretty straight forward. As I said, it
is a project I wanted to work on and your interest has piqued mine again.

There is no need for and Eiffel > LEGO compiler, that's only necessary
if you wanted to installed programs on the brick itself. This method
has it's advantages but many disadvantages too. Those doing more
constructive things are actually running the logic on their systems
and communicating instructions to the brick via bluetooth. The brick
has only 64kb of memory, 32kb which is allocated to programs. To
compile Eiffel to run of the brick we'd actually need to port the
Eiffel runtime and overwrite the LEGO standard firmware to utilize our
runtime. Then we'd need a micro version of EiffelBase to be written
and then some really good optimizations. It would be a lot of work,
and I haven't even mentioned about a deployment, debugging mechanism
and debugging protocol yet ;)

If you want to use Eiffel, the real solution is to develop logic on
your system and feed commands to the brick. That way there is no space
or memory limitations, you can process logic and sensor input way, way
faster and you get to use Eiffel :)

I've been scheduling a refresh (aka format) of my Mac, finally
ditching Windows from it (Apple did a good job of converting me, or
maybe I was just tired of Windows), so I should have a running version
EiffelStudio soon. I've not downloaded the OS firmware yet because I
would like to build the Fantom driver myself. Current the "driver" is
actually x86 only, which sucks for those using x64 platforms and may
have an impact on bluetooth utilization - one reason I want to use
serial communication directly. By the by, I need to run some tests to
be sure it works on my Intel Mac before I get started :)

Once I get things rolling and set up the project space, I'll send you
an invite.

Paul.

--- In eiffel_...@yahoogroups.com, "Jimmy J. Johnson"
<boxer41a@...> wrote:
>
> Paul, I was hoping to find a C package with commands equivalent
> to "MOTOR.run", "MOTER.run_fast", etc. but I think that was a little
> naive. It seems that Fantom is an interface that allows you to
> communicate with the robot in order to send byte streams to a file on
> the robot; these byte steams being (I think) the assembly code which
> the robot can then execute.
>
> So, does this mean that we need an Eiffel to LEGO compiler first? I
> was hoping to just put wrappers around a C package.
>
> BTW, I'm using a Windows PC.
>
> http://blogs.msdn.com/coding4fun/archive/2006/10/26/877488.aspx gives
> some details but I have never used .net and I was hoping for a pure
> Eiffel solution.
>
>
> So...right now I am tired of reading about this and don't know where
> to begin.
>
> jjj
>
>
>
> --- In eiffel_...@yahoogroups.com, "Paul Bates" <paul.bates@>
> wrote:
> >
> > I've not looked into Fantom that much, but I had reservations using
> > anything LEGO made available because there bluetooth support was
> > limited to PPC Macs. I know they released an update of G-NXT, which
> > was supposed to contain software built for Intel Macs so maybe it's
> > the way to go now, especially if Fantom provides API features to
> > encapsulate the bluetooth messaging protocol used by the brick so I
> > don't have to implement those message ;)
> >
> > Once I find out what I did to my Mac to cripple GTK/X11
> applications,
> > I'll look into it and see if I can get something working. Or if you
> > plan on starting something yourself then lets keep in touch so I can
> > help you out where I can.
> >
> > Paul.
> >
> > --- In eiffel_...@yahoogroups.com, "Jimmy J. Johnson"

Paul Bates

unread,
Sep 7, 2015, 8:50:57 AM9/7/15
to eiffel_...@yahoogroups.com

Jimmy, I looked into Fantom this weekend and as I expected, the SDK is
limited to x86 versions of Windows and PPC versions of MacOSX,
rendering it pretty much useless. The solution is seems would be my
original intention, to write serial port messages directly and then it
would work on Linux too.

I saw some projects at ETH related to Mindstorms but I didn't think
they were using Eiffel.

Paul.

--- In eiffel_...@yahoogroups.com, "Jimmy J. Johnson"
<boxer41a@...> wrote:
>
> Paul, I'm glad I piqued your interest. If you do start this project, I
> would love to follow it. Also, if .net is "dead simple" as you say,
> maybe I would take a little help to get started with it; this would be
> a good exercise project.
>
> I had hoped to install on the brick itself but I understand the
> limitations. It does sound like a lot of work. What about embedded
> Eiffel. Does it apply here?
>
> Also, I seem to recall reading a while back of someone at ETH using
> mindstorms. I think it had to do with a concurrency project.

Jimmy J. Johnson

unread,
Sep 7, 2015, 9:15:49 AM9/7/15
to eiffel_...@yahoogroups.com

Does anyone have (or would be interested in) an Eiffel interface for
programing the Lego Mindstorms robots? This would make a great tool
for teaching my children Eiffel.

Unfortunately I have never used C or C++ with Eiffel. I ram-dumped
just about everything I ever knew about C long ago (about the time
Eiffel 3.1 was released for the PC).

Jimmy J. Johnson

unread,
Sep 7, 2015, 9:15:49 AM9/7/15
to eiffel_...@yahoogroups.com

Paul,

You went a lot further than I have gone.

What about a wrapper around the (I think it is called) "Fantom" code?
I think it is in C++.


Jimmy J. Johnson

unread,
Sep 7, 2015, 9:15:49 AM9/7/15
to eiffel_...@yahoogroups.com

Paul, I was hoping to find a C package with commands equivalent
to "MOTOR.run", "MOTER.run_fast", etc. but I think that was a little
naive. It seems that Fantom is an interface that allows you to
communicate with the robot in order to send byte streams to a file on
the robot; these byte steams being (I think) the assembly code which
the robot can then execute.

So, does this mean that we need an Eiffel to LEGO compiler first? I
was hoping to just put wrappers around a C package.

BTW, I'm using a Windows PC.

http://blogs.msdn.com/coding4fun/archive/2006/10/26/877488.aspx gives
some details but I have never used .net and I was hoping for a pure
Eiffel solution.


So...right now I am tired of reading about this and don't know where
to begin.

jjj



--- In eiffel_...@yahoogroups.com, "Paul Bates" <paul.bates@...>
wrote:
>
> I've not looked into Fantom that much, but I had reservations using
> anything LEGO made available because there bluetooth support was
> limited to PPC Macs. I know they released an update of G-NXT, which
> was supposed to contain software built for Intel Macs so maybe it's
> the way to go now, especially if Fantom provides API features to
> encapsulate the bluetooth messaging protocol used by the brick so I
> don't have to implement those message ;)
>
> Once I find out what I did to my Mac to cripple GTK/X11
applications,
> I'll look into it and see if I can get something working. Or if you
> plan on starting something yourself then lets keep in touch so I can
> help you out where I can.
>
> Paul.
>
> --- In eiffel_...@yahoogroups.com, "Jimmy J. Johnson"

Jimmy J. Johnson

unread,
Sep 7, 2015, 9:15:49 AM9/7/15
to eiffel_...@yahoogroups.com

Paul, I'm glad I piqued your interest. If you do start this project, I
would love to follow it. Also, if .net is "dead simple" as you say,
maybe I would take a little help to get started with it; this would be
a good exercise project.

I had hoped to install on the brick itself but I understand the
limitations. It does sound like a lot of work. What about embedded
Eiffel. Does it apply here?

Also, I seem to recall reading a while back of someone at ETH using
mindstorms. I think it had to do with a concurrency project.

Jimmy J. Johnson

unread,
Sep 7, 2015, 10:17:10 AM9/7/15
to eiffel_...@yahoogroups.com

Paul,

I am interested in Mindstorms still. If you are interested in
getting me pointed in the right direction I would begin working on
something. Just need a little guidence. If you want to do this you
can send a personal email to the yahoo address.

BTW, I don't know if the ETH projects are still there, but I seem to
recall reading of a Mindstorm project to test concurrency.

Best regards,

Jimmy J. Johnson



--- In eiffel_...@yahoogroups.com, "Paul Bates" <paul.bates@...>
wrote:
>
> Jimmy, I looked into Fantom this weekend and as I expected, the SDK
is
> limited to x86 versions of Windows and PPC versions of MacOSX,
> rendering it pretty much useless. The solution is seems would be my
> original intention, to write serial port messages directly and then
it
> would work on Linux too.
>
> I saw some projects at ETH related to Mindstorms but I didn't think
> they were using Eiffel.
>
> Paul.
>
> --- In eiffel_...@yahoogroups.com, "Jimmy J. Johnson"

boxer41a

unread,
Sep 8, 2015, 2:53:50 AM9/8/15
to eiffel_...@yahoogroups.com

Can I resuscitate this project?

I [still] would like to make a library for use with the Lego Mindstorms robot. My simple-minded approach so far is to wrap only a few of the features from the Fantom API. The main feature I want to wrap is the "send_direct_command" method. I am thinking if I could get this feature working, I could simply look up the byte codes in a table and use the feature to send the byte codes of the command to the robot. But, alas, I cannot even get the simplest wrapper to work. Most likely, this is because of my lack of recent experience with C and C++. I have read the examples at eiffelroom and the cecil documentation at Eiffel Software and even looked some class slides from the "touch of class" course, but I am simply pattern matching; I do not have a good understanding of what is going on.

So…the point(s) is:
1. Is there anyone that would like to help with this project?
2. Is there any "Eiffel wrapping of c/c++ functions" documentation aimed at a newcomer in this area? (How is this subject taught to a comp sci 101 student in the "bottom-up" curriculum who has not learned c/c++?)
3. Is there anyone willing to give me about one hour of OJT using instant messaging or email in regards to c/c++ wrapping? I could really use the immediate feedback and I hate to clog this forum up with my baby questions of which I have many.

Thanks,

Jimmy J. Johnson

Liberty Lover

unread,
4:31 PM (6 hours ago) 4:31 PM
to Eiffel Users

Liberty Lover

unread,
4:37 PM (6 hours ago) 4:37 PM
to eiffel...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-users...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/eiffel-users/0a016094-8cfb-4ac9-b72b-1f27e45342ecn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages