View unanswered posts | View active topics It is currently Thu Oct 23, 2014 6:02 pm






Reply to topic  [ 6 posts ] 
Avoider/ Climber robot 
Author Message
Expert

Joined: Wed Jun 30, 2010 7:15 am
Posts: 181
Post 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){}
       }
    }
  }
}

_________________
leonoverweel.com


Thu Nov 11, 2010 11:27 am
Profile WWW
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:44 am
Posts: 439
Location: Pittsburgh, PA
Post 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.

_________________
Vu Nguyen
Software Training Development Team | Webmaster
Need more support? Use the ROBOTC Ticketing system

Robotc.net| Robomatter Store | Robotics Academy | CS2N


Mon Nov 15, 2010 12:55 pm
Profile
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:44 am
Posts: 439
Location: Pittsburgh, PA
Post 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!

_________________
Vu Nguyen
Software Training Development Team | Webmaster
Need more support? Use the ROBOTC Ticketing system

Robotc.net| Robomatter Store | Robotics Academy | CS2N


Wed Nov 17, 2010 11:25 am
Profile
Expert

Joined: Wed Jun 30, 2010 7:15 am
Posts: 181
Post 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").

_________________
leonoverweel.com


Fri Nov 19, 2010 7:03 pm
Profile WWW
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:44 am
Posts: 439
Location: Pittsburgh, PA
Post 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 :)

_________________
Vu Nguyen
Software Training Development Team | Webmaster
Need more support? Use the ROBOTC Ticketing system

Robotc.net| Robomatter Store | Robotics Academy | CS2N


Wed Dec 01, 2010 2:04 pm
Profile
Expert

Joined: Wed Jun 30, 2010 7:15 am
Posts: 181
Post Re: Avoider/ Climber robot
lol

_________________
leonoverweel.com


Thu Dec 02, 2010 12:29 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.