| | 
      |   |   
            | Subject: 
 | Trig and vectors 
 |  
            | Newsgroups: 
 | lugnet.robotics 
 |  
            | Date: 
 | Fri, 8 Jan 1999 20:23:46 GMT 
 |  
            | Original-From: 
 | Simen Svale Skogsrud <simen@mop.&stopspammers&no> 
 |  
            | Viewed: 
 | 1776 times 
 |  |  |  
 | 
 |  | I want my little explorer bot to be able to make "intelligent" judgements of how to maneuver itself out of areas when it is stuck in a corner or
 another narrow space. To accomplish this I want it to have a modest
 capability to remember obstructions it encountered nearby - to have a small
 map of recent obstructions so to say.
 
 To accomplish this I am trying to implement simple trig and vector
 calculations in NQC. Using a table I obtain sin and cos values to calculate
 the directional vector of the bot, and using this I aproximate the relative
 position in a 2D coordinate system. I intend to store obstuctions as
 coordinates in an array, and the bot is to take these into account
 constantly when setting out a new direction for its travel.
 
 I use a "angle system" where there is 64 units in a circle, this seems to
 be accurate enough. I keep track of the heading of the bot in much higher
 resolution and convert back to the 64 degree system when need be. I use
 fractioned integers for the values so that 100 == 1.0, 150 == 1.5 etc. I
 don't see the 16 bit limit on integers as a big problem as I will only be
 able to store and keep accurate information that will be within an area
 described by numbers in the -32000 -> 32000 range.
 
 I need ideas for efficient ways to implement tangent and inverse tangent in
 NQC and I need ideas for how I can treat a number of variable positions
 (say 16) as an array of coordinates. I know this will probably be much
 easier to implement in C under LegOS, but I do not feel ready for that
 quite now.
 
 btw. : Would it be possible to use floating-point math using gcc and legos?
 
 Simen
 ---------------------------------------------------------------------------
 -
 Simen Svale Skogsrud; Producer, Medieoperatørene as
 phone: +47 22 99 27 35; mobile: +47 90 77 90 24;
 fax: 22 20 64 21; Corp. web: http://www.mop.no
 ---------------------------------------------------------------------------
 -
 Filmsuksess på nettet:
 http://www.filmredaksjonen.no
 
 
 
 --
 Did you check the web site first?: http://www.crynwr.com/lego-robotics
 
 |  |  |  
 
 Message has 1 Reply:
 
  |  |  | Re: Trig and vectors 
 | 
 |  | (...) I haven't found a way of getting the RCX to perform any sort of indirect addressing. As a result, there's no array support in NQC. Dave    (27 years ago, 9-Jan-99, to lugnet.robotics) 
 |  2 Messages in This Thread:
 
    
 
      Entire Thread on One Page:
      
        Nested: 
        All | Brief | Compact | Dots
        Linear: 
        All | Brief | Compact
 | 
 | 
 | 
 |