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 / 860
859  |  861
Subject: 
Re: RotateMotorEx hangs
Newsgroups: 
lugnet.robotics.nxt
Date: 
Mon, 6 Aug 2007 15:58:18 GMT
Viewed: 
21752 times
  
In lugnet.robotics.nxt, Elizabeth Mabrey wrote:
As long as it will still retain the value of rotation count, it will be very
useful. Otherwise, it will be bad!  This will help in simulating an event
driven instance. Do you see there is any down side of this implementation
other than a few more lines of byte codes?


The change I have made is to replace this:

// Waits till angle reached
  index __rotate_firstPort0, __rotate_ports0, NA
__rotate_Running0:
  getout __rotate_rs0, __rotate_firstPort0, RunState
  brcmp EQ, __rotate_Running0, __rotate_rs0, OUT_RUNSTATE_RUNNING


with this:

// Waits till angle reached or power is zero
  index __rotate_firstPort0, __rotate_ports0, NA
__rotate_Running0:
  getout __rotate_power0, __rotate_firstPort0, Power
  brtst EQ, __rotate_doneRunning0, __rotate_power0
  getout __rotate_rs0, __rotate_firstPort0, RunState
  brcmp EQ, __rotate_Running0, __rotate_rs0, OUT_RUNSTATE_RUNNING
__rotate_doneRunning0:

I can see no harm whatsoever in this change.  It adds a little bit of extra code
but it is a tiny change - reading the power value and jumping out of the loop if
it is zero.

You can try it out in test_release.zip.  Let me know if strange things happen.
I also changed nearly all the names of the parameters in API preprocessor macros
in order to avoid a preprocessor bug that was exposed recently.  The
preprocessor gets into an infinite loop if you happen to use a structure member
name that matches the name of a preprocessor macro parameter.  For instance, if
you had a structure in either NXC or NBC with a member called "port" and you
tried to pass this structure member into an API function such as ResetSensor
which happens to be a preprocessor macro with a parameter called "port" then the
preprocessor would keep trying to replace the structure member with the value of
the port macro parameter.  Now all the preprocessor macros use parameter names
that begin with an underscore.  It's possible that these extensive changes,
although simple, could have introduced a typo bug or two.

John Hansen



Message is in Reply To:
  RE: RotateMotorEx hangs
 
As long as it will still retain the value of rotation count, it will be very useful. Otherwise, it will be bad! This will help in simulating an event driven instance. Do you see there is any down side of this implementation other than a few more (...) (17 years ago, 6-Aug-07, to lugnet.robotics.nxt)

8 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    
Active threads in NXT programmable brick

 
Verified and Trusted Team of Hackers
19 hours ago
Custom Search

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