To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.nxtOpen lugnet.robotics.nxt in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / NXT / 419
418  |  420
Subject: 
RE: Improving the firmware?
Newsgroups: 
lugnet.robotics.nxt
Date: 
Wed, 24 Jan 2007 07:32:50 GMT
Reply-To: 
<dickswan@sbcglobal.IHATESPAMnet>
Viewed: 
12565 times
  
David Wallace wrote on Tuesday, January 23, 2007 7:34 PM:

How receptive is Lego of suggested firmware changes? And I wonder
how long before they would actually be implemented.

This is an opportunity for the open source community to improve the
firmware. Enhanced firmware does not need to have any dependency on the
LEGO or NI development teams.

The challenge is how new opcodes/functions added to the firmware can be
integrated in the NXT-G compiler so that a user written block can call
these opcodes. Ideally there would be some kind of "backdoor" in the
NXT-G compiler that would allow one to emit an arbitrary opcode and
parameters; however, I did a quick glance through the NXT "build a
block" toolkit and didn't find an obvious capability to do this.

However, a kludge is available. Somewhat like the kludge used to make
3rd party sensors look like the ultrasonic sensor so that they can be
used without modifying firmware. You could "hijack" an existing opcode
and have it serve dual purpose.

The "draw line on NXT LCD screen" opcode might be a good one to choose
since it has four parameters (i.e. the "from" and "to" points). You
could change the implementation of this opcode so that if the first
parameter is negative then it indicates that this is a special user
written function where this parameter now contains the new function
type. This would leave three parameters for your new opcode/function.

A couple of functions you might implement are 'sine' and 'cosine'. Since
NXT-G only supports integers you could re-interpret integers as fixed
point with three factional digits (e.g. returning 783 from a cosine
calculation would really be value 0.783).

The "draw line on NXT LCD screen" eventually results in a call to the
function "cWrapCmdDrawLine" in the NXT firmware source file "c_cmd.c".
It would be easy to expand this function to also support sine and cosine
as described above by examining the first parameter. It would also be
easy to write a "My block" for cosine (or sine) that hid the kludged
call to the "draw line" block from the end user.

So above is one way to extend the NXT-G functionality while maintaining
backwards compatibility. And it has no dependency on LEGO or NI
development resources.

Of course, for functions like sine, cosine, sqrt, and atan it's better
to use one of the text based programming languages that have "native"
support for floating point variables and perhaps also trigonometry and
transcendental function libraries. LUA, LeJOS and RobotC all support
floating point. RobotC supports the libraries now; I don't know for
certain about LUA and LeJOS but I'm sure someone can confirm.



Message has 3 Replies:
  Re: Improving the firmware?
 
(...) Yes, LeJOS supports the Java Math library. (17 years ago, 26-Jan-07, to lugnet.robotics.nxt)
  Re: Improving the firmware?
 
(...) Dick, I was thinking more in the direction of adding a new Module, with a IOMap that has room to set a command and several parameters, and use the ReadIOMap and WriteIOMap to set them. This may not be the fastest solution, since as you (I (...) (17 years ago, 27-Jan-07, to lugnet.robotics.nxt)
  Re: Improving the firmware?
 
(...) It's a good plan, but I don't think that's the right command. If someone was calculating the position of a line to draw it may well start or end off-screen in the negative values. How about hijacking the FileOpen command, and apply URL-type (...) (17 years ago, 20-Feb-07, to lugnet.robotics.nxt)

Message is in Reply To:
  Re: Improving the firmware?
 
Thanks Philippe. You definitely asked the questions that I was thinking about and I pretty well understood the answers except I was a little puzzled by the need for "follows" as well. However, we definitely lost functionality in this area with NXT. (...) (17 years ago, 24-Jan-07, to lugnet.robotics.nxt)

14 Messages in This Thread:






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

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

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