+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: my new project

  1. #1
    Wire Sofaking oenmaster's Avatar
    Join Date
    Jan 2008
    Location
    fak where is my satnav (NL)
    Posts
    717
    Blog Entries
    1

    Default my new project



    Code:
    task main(){
      int ng,gn=0,nw=0,rp=0,rg,lrp=0,rwi=0,md;
      int GyroBiasCount,Gyro_value,GyroBias=0, batt;
      long timer1;
      string message, messageA, messageB;
      
      timer1 = CurrentTick();  // set timer1
    
      // Calculate the Giro Bias for the Hitechnic Gyro sensor.
      // by measuring the Gyro value many times in 3 secondes.
      // Gyro Bias is avarage Gyro value.
      GyroBiasCount = 0;
       while (CurrentTick() < (3000+timer1)) {
              // filter the sensor output
          Gyro_value = SensorRaw(S3);
          Wait(150);
          GyroBiasCount = GyroBiasCount + 1;
               gn = gn + Gyro_value;
               PlayTone(TONE_B7, 5);
       }
      GyroBias = gn / GyroBiasCount;
      gn=GyroBias;
      
      // Measure the battery voltage.
      batt=BatteryLevel();
    
      // Display calculated GyroBias an battery voltage on the NXT screen;
       message = "Gbias    Bat          ";
       messageA = NumToStr(gn);
       messageB = NumToStr(batt);
       message = StrReplace(message, 5,  messageA);
       message = StrReplace(message, 12, messageB);
       TextOut(0, LCD_LINE1, message, false);
      
       PlayTone(TONE_B7, 5);
       
      while(true){
         ng=SensorRaw(S3)-gn; nw+=ng;  //body angle
         rp=MotorTachoCount(OUT_B);    //wheel position
         rg=rp-lrp; lrp=rp; rwi+=rg;   //wheel speed
         if (abs(rwi)>15){gn-=sign(rwi); rwi=0;} //Gyro drift comp.
      // md=(nw+ng*10+rp*4+rg*200)>>4; //pd contr. NXT small wheels
         md=(nw+ng*12+rp*5+rg*360)>>5;
      // md=(nw+ng*12+rp*5+rg*360)>>5; //pd contr. RXC large wheels
         md+=sign(md)*48;              //friction compensation   default = 48
         SetOutput(OUT_AB, Power, md, OutputMode,OUT_MODE_MOTORON,
                         RunState,OUT_RUNSTATE_RUNNING,
                         UpdateFlags,UF_UPDATE_MODE+UF_UPDATE_SPEED);
         Wait(8);                      //loop about 100 times/sec
      }
    }




    i has made a script with Java for my Lego NXT set
    and a gyro sensor



    i like to hear what you think of this


    remember its my first script
    well not the first ever but the first try (for me ) on a balancing bot
    Last edited by oenmaster; 05-14-2009 at 01:27 PM.

  2. #2
    I think I think too much -HP-'s Avatar
    Join Date
    Feb 2009
    Location
    Behind you with a very sharp knife.
    Posts
    2,466

    Default Re: my new project

    I've always thought that these are cool The bot looks awesome.

    Can you post the script?

  3. #3
    Wire Sofaking oenmaster's Avatar
    Join Date
    Jan 2008
    Location
    fak where is my satnav (NL)
    Posts
    717
    Blog Entries
    1

    Default Re: my new project

    sure thing

    see fist post

  4. #4
    Wire Sofaking Echo51's Avatar
    Join Date
    Feb 2009
    Location
    Denmark
    Posts
    1,489

    Default Re: my new project

    I so want thats lego mindstorm kid :P then ill make a cat chasing robot that will entertain my cats :P
    Proud of my non-existant life...
    In russia, Expression 2 codes you!
    Quote Originally Posted by Snowden42 View Post
    Nooblishious? That's a signature keeper.

  5. #5
    Wire Amateur Marshmellow's Avatar
    Join Date
    Dec 2008
    Location
    Nebraska
    Posts
    32

    Default Re: my new project

    Quote Originally Posted by Echo51 View Post
    I so want thats lego mindstorm kid :P then ill make a cat chasing robot that will entertain my cats :P
    I'm sure they'd love you for that.
    When I die, I want to go peacefully like my Grandfather did, in his sleep -- not screaming, like the passengers in his car.

  6. #6
    Wire Sofaking oenmaster's Avatar
    Join Date
    Jan 2008
    Location
    fak where is my satnav (NL)
    Posts
    717
    Blog Entries
    1

    Default Re: my new project

    if some one have any tips on how to make it "stabler" pleas say so

  7. #7
    Wire Sofaking d3cr1pt0r's Avatar
    Join Date
    Jul 2008
    Posts
    553

    Default Re: my new project

    Quote Originally Posted by oenmaster View Post
    if some one have any tips on how to make it "stabler" pleas say so
    Use delta No just joking
    <3

  8. #8
    Wire Sofaking oenmaster's Avatar
    Join Date
    Jan 2008
    Location
    fak where is my satnav (NL)
    Posts
    717
    Blog Entries
    1

    Default Re: my new project

    i wish there was delta in NXC

  9. #9
    Wire Noob blaargh's Avatar
    Join Date
    Jun 2009
    Location
    sweden
    Posts
    10

    Default Re: my new project

    Its cool, but what does it have to do with wiremod the forum?
    I was herehttp://www.wiremod.com/forum/images/smilies/mad.gif

  10. #10
    Wirererer Free Fall's Avatar
    Join Date
    Dec 2007
    Location
    Got digitalized and now lives in his PC's RAM
    Posts
    349

    Default Re: my new project

    superfluous bump is superfluous.

    It is some kind of machine, that is the point. And because it is not directly wire, it is in the OFF-TOPIC forum.

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Foxi Project
    By -=Fox=- in forum Full-scale projects
    Replies: 30
    Last Post: 06-15-2011, 07:02 PM
  2. Sapphire Project
    By dnifan in forum Developer's Showcase
    Replies: 77
    Last Post: 07-14-2010, 09:54 AM
  3. Red Falcon Project
    By Bull in forum Finished contraptions
    Replies: 14
    Last Post: 05-12-2009, 05:28 PM
  4. Project Boss
    By gameguysz in forum Installation and Malfunctions Support
    Replies: 9
    Last Post: 10-14-2008, 12:29 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots