View unanswered posts | View active topics It is currently Tue Oct 21, 2014 4:41 pm






Reply to topic  [ 12 posts ] 
!!!NEED HELP: MOVING OBJECTS OUT OF A CIRCLE!!! 
Author Message
Rookie

Joined: Thu Apr 17, 2008 3:05 am
Posts: 7
Post !!!NEED HELP: MOVING OBJECTS OUT OF A CIRCLE!!!
Hi guys :)
I need help with a school task. The task is, moving 3 soda cans out of a green-line circle. the robot isn't allowed to drive out of the circle. I've already prepared and installed a sonar- and a lightsensor. The touch sensor is for starting the programm.
the task is also known as "Bull Ring Challenge" or "Bull in the Ring"

:?: My group has no plan what to do. :?:
Please help us


Thanks =)


Thu Apr 17, 2008 3:10 am
Profile
Rookie

Joined: Fri Apr 20, 2007 3:22 am
Posts: 36
Post 
You might want to try out nxtasy.org. You'll probably get more help there.

http://nxtasy.org/

http://forums.nxtasy.org/

Are you new to robotc?
Have you already build your robot?

Coming up with a plan is something you should really be doing as this is a school project. But you can get pointers and help along the way.


Sat Apr 19, 2008 1:07 am
Profile
Rookie

Joined: Thu Apr 17, 2008 3:05 am
Posts: 7
Post 
We've already build the robot with the three sensors. but we don't kwow how to write the programm.
One task, we've had is to build a robot, that follows a line. This task was no problem. But now we have to start with the old programm and write it further ...

Here our last programm:

task main ()

{

while(true)
{

while(SensorValue(Lightsensor1) < 35)
{

motor[motorC] = 0;
motor[motorB] = 70;

}

while(SensorValue(Lightsensor1) > 35)
{

motor[motorC] = 70;
motor[motorB] = 0;

}

}

}


Sat Apr 19, 2008 5:32 am
Profile
Rookie

Joined: Fri Apr 20, 2007 3:22 am
Posts: 36
Post 
well then your next task is to break down the behaviors into what you need to the robot to do.

the code you have for line following won't be super helpful, but it's as good a plce to start as any.

So you need to use the ultrasonic sensor to find the cans.
Push the cans once found.
Stop pushing when you get to the edge of the circle.
repeat till all the cans are out.

I would think that using the ultra sonic sensor is were you should start. Do you have any sample code to lookat for the ultrasonic sensor and the touch sensor?


Sun Apr 20, 2008 2:01 am
Profile
Rookie

Joined: Thu Apr 17, 2008 3:05 am
Posts: 7
Post 
I would say you should have a look at our current program;
we tested it, but the values or something else seem to be false:

Code:
//*!!Sensor,    S1,                light, sensorLightActive,      ,              !!*//
//*!!Sensor,    S3,                sonar, sensorSONAR,      ,                    !!*//
//*!!Motor,  motorA,               motora, tmotorNormal,                         !!*//
//*!!Motor,  motorB,               motorb, tmotorNormal,                         !!*//
//*!!Motor,  motorC,               motorc, tmotorNormal,                         !!*//
//*!!                                                                            !!*//
//*!!Start automatically generated configuration code.                           !!*//
const tSensors light                = (tSensors) S1;   //sensorLightActive  //*!!!!*//
const tSensors sonar                = (tSensors) S3;   //sensorSONAR        //*!!!!*//
const tMotor   motora               = (tMotor) motorA; //tmotorNormal       //*!!!!*//
const tMotor   motorb               = (tMotor) motorB; //tmotorNormal       //*!!!!*//
const tMotor   motorc               = (tMotor) motorC; //tmotorNormal       //*!!!!*//
//*!!CLICK to edit 'wizard' created sensor & motor configuration.                !!*//

int dreh = random;

void forward(int nspeed)
{
  motor[motorA] = nspeed;   // motor forward at nspeed% of full power
  motor[motorC] = nspeed;   // motor forward at nspeed% of full power
}

void stop()
{
  motor[motorA] =  0;   // Turn motor off
  motor[motorC] =  0;   // Turn motor off
}

void left(int nspeed)
{
  motor[motorA] =  -20;   // Turn motor off
  motor[motorC] = nspeed;   // motor forward at nspeed% of full power
}

void right(int nspeed)
{
  motor[motorA] = nspeed;   // motor forward at nspeed% of full power
  motor[motorC] =  -20;   // Turn motor off
}

void backward (int nspeed)
{
   motor[motorA] = -nspeed;
   motor[motorC] = -nspeed;

 }




task main ()
{
while(true){
      do{
         forward(50);
         }while(SensorValue(light)>40);
         stop();
         forward(-50);
         wait10Msec(300);
      do{
           right(50);
         }while(SensorValue(sonar) >= 40);
         stop();

      }
}


Do you know a better one? We aren't sure, whether this is correct ...


Mon Apr 21, 2008 3:36 pm
Profile
Rookie

Joined: Fri Apr 20, 2007 3:22 am
Posts: 36
Post 
Looks like you're off to a good start.

What was your robot doing?

I would make the following changes.


void right()
{
motor[motorA] = -50; // motor forward at nspeed% of full power
motor[motorC] = 50; // Turn motor off
}

this way the robot will spin in place. Other wise it will make a big sweeping turn and miss anything sitting on the inside of the turn.

I would also reduce the amount of time it travels backwards. maybe about 50;

when it's searching, it will start looking at the last can it was pushing, so you might want to put something in there so that it looks for no can first.

Also, how big is the ring?


Mon Apr 21, 2008 11:13 pm
Profile
Rookie

Joined: Thu Apr 17, 2008 3:05 am
Posts: 7
Post 
I think the circle has a radius of perhaps 50cm. But the robot wasn't doing his task. We changed the values and tested the robot. It was only driving backwards. After this test we changed the values again and then our robot moved only one can out of the green circle. he didn'nt realise the other cans (value of sonarsensor false?).
We don't know what to do - but i'm very sure, that the programm is correct. Something must be wrong with the values of the sonar- and/or the lightsensor. :?:


Wed Apr 23, 2008 4:25 pm
Profile
Rookie

Joined: Fri Apr 20, 2007 3:22 am
Posts: 36
Post 
the sonar ranges are in cm’s I think so you should probably increase the range to 50 or 60.

I’m not sure what the effective range on the sonar is.

A simple experiment that might prove useful would be to just have the robot display sensor values, then hand guide the robot around and see what the sensors read. That will give you a better idea of what values to use. It can also tell you if your sensor placement is optimal.

A simple program like this:

Code:
const tSensors light                = (tSensors) S1;   
const tSensors sonar                = (tSensors) S3; 


task main()
{
int sonarValue,lightValue;

   while(true)
   {
      sonarValue = SensorValue(sonar);
      lightValue = SensorValue(light);
      
      nxtDisplayTextLine(1,"Sonar %d",sonar);
      nxtDisplayTextLine(2,"Light %d",light);   
      
   }

}


Wed Apr 23, 2008 5:43 pm
Profile
Rookie

Joined: Thu Apr 17, 2008 3:05 am
Posts: 7
Post 
yes, we've already did this experiment - 30 is OK. but we have another problem: We've tested the current program at the beginning of the lesson. It was excellent! The robot was doing his task without problems. So we've decided to build and install a touch sensor to start the program: We touch the botton on the robot and after that the touch botton of the touch sensor. But we don't know, how to add it into our program. we did'nt make it ...
so we load the first program (beginning of lesson, which was super) on the robot again. we tested it and now the sonar sensor isn't working correctly. it realizes the cans, but the arms of the robot can't grab them, that is to say the robot realizes the cans but it drives indirecty to them and then the arms miss the can. very strange, because it worked at the beginning of the lesson - we changed nothing ...[/code]


Thu Apr 24, 2008 8:42 am
Profile
Rookie

Joined: Thu Apr 17, 2008 3:05 am
Posts: 7
Post 
[quote="huj"]yes, we've already did this experiment - 30 is OK. but we have another problem: We've tested the current program at the beginning of the lesson. It was excellent! The robot was doing his task without problems. So we've decided to build and install a touch sensor to start the program: We touch the botton on the robot and after that the touch botton of the touch sensor. But we don't know, how to add it into our program. we did'nt make it ...
so we load the first program (beginning of lesson, which was super) on the robot again. we tested it and now the sonar sensor isn't working correctly. it realizes the cans, but the arms of the robot can't grab them, that is to say the robot realizes the cans but it drives indirecty to them and then the arms miss the can. very strange, because it worked at the beginning of the lesson - we changed nothing ...


Thu Apr 24, 2008 8:42 am
Profile
Rookie

Joined: Thu Apr 17, 2008 3:05 am
Posts: 7
Post 
yes, we've already did this experiment - 30 is OK. but we have another problem: We've tested the current program at the beginning of the lesson. It was excellent! The robot was doing his task without problems. So we've decided to build and install a touch sensor to start the program: We touch the botton on the robot and after that the touch botton of the touch sensor. But we don't know, how to add it into our program. we did'nt make it ...
so we load the first program (beginning of lesson, which was super) on the robot again. we tested it and now the sonar sensor isn't working correctly. it realizes the cans, but the arms of the robot can't grab them, that is to say the robot realizes the cans but it drives indirecty to them and then the arms miss the can. very strange, because it worked at the beginning of the lesson - we changed nothing ...


Thu Apr 24, 2008 8:42 am
Profile
Rookie

Joined: Fri Apr 20, 2007 3:22 am
Posts: 36
Post 
to add the touch sensor to start your program you would add a loop before your main loop


task main()
{

<<stuff>>

while( 'touch sensor not pressed')
{}

while(true) // main loop
{
<< stuff>>
}

}

as far as the other problems. It's hard to say what's wrong without seeing the code.

But it sounds like you guys close to what you need.


Thu Apr 24, 2008 3:02 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 12 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.