ROBOTC.net forums
http://www.robotc.net/forums/

Avoider/ Climber robot
http://www.robotc.net/forums/viewtopic.php?f=15&t=2740
Page 1 of 1

Author:  DiMastero [ Thu Nov 11, 2010 11:27 am ]
Post subject:  Avoider/ Climber robot

OK, this time, a fully finished project: an avoider/ climber bot. Whenever I paste videos and photos on this here, I kinda screw up (they get humongous) so I've just got the coding (see below) and a link to the post on my blog with pictures and videos, sorry.
Code:
#pragma config(Sensor, S1,     TouchRight,          sensorTouch)
#pragma config(Sensor, S2,     SonarSensor,         sensorSONAR)
#pragma config(Sensor, S4,     TouchLeft,           sensorTouch)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main(){

  //wait10Msec(1000); (for video)

  nMotorPIDSpeedCtrl[motorA] = mtrSpeedReg;
  nMotorPIDSpeedCtrl[motorC] = mtrSpeedReg;

  while(true){
    if(SensorValue(TouchLeft) == 0 && SensorValue(TouchRight) == 0){
      motor[motorA] = -60;
      motor[motorC] = -60;
      if(nMotorEncoder[motorB] > 360){
        motor[motorB] = 0;
      }
    }

    if(SensorValue(TouchLeft) == 0 && SensorValue(TouchRight) == 1){
      motor[motorA] = 0;
      motor[motorC] = -25;
    }

    if(SensorValue(TouchLeft) == 1 && SensorValue(TouchRight) == 0){
      motor[motorA] = -25;
      motor[motorC] = 0;
    }

    if(SensorValue(TouchLeft) == 1 && SensorValue(TouchRight) == 1){
      motor[motorA] = 0;
      motor[motorC] = 0;
      if(SensorValue(SonarSensor) > 9){
         PlaySound(soundBeepBeep);
         nMotorEncoder[motorB] = 0;
         nMotorEncoderTarget[motorB] = 360;
         motor[motorB] = -35 ;
         while(nMotorRunState[motorB] != runStateIdle){}
         motor[motorB] = 0;
       }
       else{
         while(SensorValue(SonarSensor) < 25){
           motor[motorA] = 25;
           motor[motorC] = 25;
         }
        nMotorEncoder[motorA] = 0;
        nMotorEncoder[motorC] = 0;
        nMotorEncoderTarget[motorA] = -215;
        nMotorEncoderTarget[motorC] = 215;
        motor[motorA] = -25;
        motor[motorC] = 25;
        while(nMotorRunState[motorA] != runStateIdle && nMotorRunState[motorC] != runStateIdle){}
       }
    }
  }
}

Author:  vnguyen [ Mon Nov 15, 2010 12:55 pm ]
Post subject:  Re: Avoider/ Climber robot

Hey nice job on this one!

The climber seems like it's pretty solid. I'll post this up on robotc.net as soon as I can.

Author:  vnguyen [ Wed Nov 17, 2010 11:25 am ]
Post subject:  Re: Avoider/ Climber robot

Alright, I just scheduled your post to go up the 24th (next week). I try to space out the postings. You should see it up next week. Thanks a lot!

Author:  DiMastero [ Fri Nov 19, 2010 7:03 pm ]
Post subject:  Re: Avoider/ Climber robot

Hi,

THANKS A LOT, man! If you need any more info, just ask. I've still got it together, and I've also got an LDD file on the NXT log, under my name ("worldofmindstorms").

Author:  vnguyen [ Wed Dec 01, 2010 2:04 pm ]
Post subject:  Re: Avoider/ Climber robot

Someone's bound to ask about it. So keeping that stuff handy would be good once you get some fans asking about it :)

Author:  DiMastero [ Thu Dec 02, 2010 12:29 pm ]
Post subject:  Re: Avoider/ Climber robot

lol

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/