To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcxOpen lugnet.robotics.rcx in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / 1101
1100  |  1102
Subject: 
Bug in RCX 2.0 beta (Was: RIS 2.0 software now in beta)
Newsgroups: 
lugnet.robotics.rcx, lugnet.robotics
Date: 
Sun, 4 Mar 2001 15:56:38 GMT
Viewed: 
1663 times
  
Dear all,

I'm experiencing a strange phenomenon in my MindScript program which I
believe to be a bug, where within a task the assignment of a multiplication
of a local variable (containing value 0) and a constant (set to 10) to a
second local variable would set a third local variable (containing 1) to
zero! If rewritten as a simple assignment and then a multiplying assignment
the phenomenon disappears.

Please find attached the script exemplifying the issue. It expects a light
sensor on 1, a motor turning the light sensor on B and a touch sensor on 2
being triggered when the motor turned the light sensor to 180° resp. -180°.

As a newbie to LEGO robotics (which both my son and me find fantastic) I
don't exclude that I overlooked some finesse of the RCX environment though
...

JP Brown <envcons@ameritech.net> schrieb in im Newsbeitrag:
398A46A0.65560838@ameritech.net...
Dear All

The beta version of the RIS 2.0 ATLClient software, firmware • (firm0328.lgo), and
documentation are now available for download from the LEGO Mindstorms • site:
http://www.legomindstorms.com/sdk2/

Also, the winners of the alpha bug reporting competition are posted ;p

Cheers

JP

Regards,
Sebastian
--
Dipl.-Inform. Sebastian Wangnick

--- snip ---

program radarlight {
const segmente = 6
const messprosegment = 10
const messungen = 60 // segmente * messprosegment
const toterwinkel = 1 // 12 // 120ms mit Nackenschmerzen ...
const graddrehzaehler = 1 // 2 mit raupen
const graddrehnenner = 3 // 1 mit raupen
const drehstartzeit = 20
const drehpower = 8
const laufpower = 8
const laufzeit = 40 // 400ms laufen, dann weitersehen
output LinkesBein on 1
output RechtesBein on 3
output Kopf on 2
sensor Auge on 1
Auge is light as percent
sensor Nacken on 2
Nacken is switch as boolean
event Nackenschmerz when Nacken.pressed
var zeit
var kuckzeit // Zeit für 360°-Kopfdrehung in10 ms
    // (Wird ungefähr 320 .. 325)
var synchro = 0
var uhrzeigersinn
var gehezusegment = -1
var anzeige = -1

main {
  if Nacken is closed {
   sound 5
   stop tasks
  }
display anzeige
  forward Kopf // Im Uhrzeigersinn
  uhrzeigersinn = 1
  on Kopf
  wait until Nackenschmerz
  wait toterwinkel

  reverse Kopf // Im Uhrzeigersinn
  uhrzeigersinn = 1 - uhrzeigersinn
  zeit = 0
  start Zeitmessung
  wait toterwinkel+20 // Um sicher den Taster zu verlassen
  wait until Nackenschmerz
  wait toterwinkel
  kuckzeit = zeit*4
  kuckzeit /= 5

  synchro = 0
  start Lichtmessung
  start Bewegung
  forever {
   synchro = 1
   reverse Kopf
   uhrzeigersinn = 1 - uhrzeigersinn
   on Kopf
   wait toterwinkel+20 // Um sicher den Taster zu verlassen
   wait until Nackenschmerz
   wait toterwinkel
   off Kopf
   synchro = 2
   while synchro <> 4 {
    wait 1
   }
  }
}
task Zeitmessung {
  priority 1
  forever {
   wait 1 // wait 10ms
   zeit += 1
  }
}
task Lichtmessung {
  local messung
  local segment
  local messzeit
  local maxlicht
  local lichtsumme
  local lichtmess
  forever {
   while synchro <> 1 {
    wait 1
   }
   maxlicht = -1
   segment = 0
   zeit = 0
   while segment < segmente {
    messung = 0
    lichtsumme = 0
    lichtmess = 0
    while messung < messprosegment {
     lichtsumme += Auge
     lichtmess += 1
     messung += 1
     messzeit = segment
     messzeit *= messprosegment
messzeit = segment*messprosegment // BUG IF WRITTEN LIKE THIS
anzeige = messung
     messzeit += messung
     messzeit *= kuckzeit
     messzeit /= messungen
     while zeit < messzeit {
      wait 1
      if synchro = 2 {
       messung = messprosegment
       messzeit = 0
      }
     }
    }
    lichtsumme /= lichtmess
    if lichtsumme > maxlicht {
     maxlicht = lichtsumme
     gehezusegment = segment
    }
    segment += 1
    if synchro = 2 {
     // Totale Sicherheit ...
     segment = segmente
    }
   }
   if uhrzeigersinn = 0 {
    gehezusegment = segmente-gehezusegment
    gehezusegment -= 1
   }
   while synchro <> 2 {
    wait 1
   }
   kuckzeit = zeit
   synchro = 3
  }
}
task Bewegung {
  local gradzahl
  local drehzeit
  forever {
   while synchro <> 3 {
    wait 1
   }
   if gehezusegment<0 {
    sound 5
    stop tasks
   }
   if gehezusegment+1>segmente {
    sound 5
    stop tasks
   }
   // 0: 150° links 1: 90° links 2: 30° links 3: 30° rechts 4: 90° rechts 5:
150° rechts
   gradzahl = gehezusegment*360/segmente
   gradzahl -= 180
   gradzahl += 180/segmente
//anzeige = gradzahl
   drehzeit = gradzahl *graddrehzaehler / graddrehnenner
   if drehzeit<0 {
    // Links heller
    dir RechtesBein LinkesBein
   } else {
    dir LinkesBein RechtesBein

   }
   on [LinkesBein RechtesBein]
   power [LinkesBein RechtesBein] drehpower
   wait abs(drehzeit)+drehstartzeit
   power [LinkesBein RechtesBein] laufpower
   dir [LinkesBein RechtesBein] []
   wait laufzeit
   off [LinkesBein RechtesBein]
   synchro = 4
  }
}
}



Message has 1 Reply:
  Re: Bug in RCX 2.0 beta (Was: RIS 2.0 software now in beta)
 
Dear all, I have managed to pin down the problem a bit further. Please look at the following program: program foo { const c10 = 10 main { forever {} } task test { local v2f local v2e local v2d v2f = 1 v2e = 2 v2d = v2e * c10 } } If you download this (...) (24 years ago, 4-Mar-01, to lugnet.robotics.rcx, lugnet.robotics)

Message is in Reply To:
  RIS 2.0 software now in beta
 
Dear All The beta version of the RIS 2.0 ATLClient software, firmware (firm0328.lgo), and documentation are now available for download from the LEGO Mindstorms site: (URL) the winners of the alpha bug reporting competition are posted ;p Cheers JP (24 years ago, 4-Aug-00, to lugnet.robotics.rcx, lugnet.robotics)

8 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