943,563 Members | Top Members by Rank

Ad:
Sep 25th, 2009
-1

need university help first year

Expand Post »
hey this is umar here and i really needed some help because i have my exam tommorow. i was assigned to make a robot. ad to program it as some of may you know( i hope) the NXC language (i think its called that) to program the Mindstorms nxt brick. if some can help me i only have limited knowledge, i need to make this robot stay away from this color yellow and stay in black , i will be given a a small rink or arean painted black (as big as a air hockey table) and rest painted yellow. there will also be another robot that will try to catch my robot so i have to make my robot escape for about 90 secs. i have written some code if some of you can help that would be great.[description of my robot: its both sensors are on the front( light sensor facing ab to the ground and the distance one facing straight forwarf) the two motors are on the front wheels and one tire on the back. and here is my code so far.


#include "NXCDefs.h"

mutex moveMutex;
#define dist  60
#define extranear  10
int tries = 0;




inline void scan_front()
{
  
  SetSensorLowspeed(IN_1);
  



if (SensorUS(IN_1) > dist)
{

    OnFwd(OUT_AB, 75);
	tries = 0;
}	

if (SensorUS(IN_1) < dist){

Off(OUT_AB);
RotateMotor(OUT_A, 80, 300);
tries++;


}

if(SensorUS(IN_1) < extranear)

{
Off(OUT_AB);

RotateMotor(OUT_A, 80, 720);


}


if(tries >= 3 ){
Off(OUT_AB);
 OnFwd(OUT_AB, 75);
}




}






task main()
{
 

while (true){


scan_front();




}



}

*Update: the tries thing i did doesnt seem to work.
Last edited by umarmaqsood; Sep 25th, 2009 at 2:33 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
umarmaqsood is offline Offline
8 posts
since Aug 2009
Sep 25th, 2009
0

Re: need university help first year

You have got a good assignment .Do not mix 2 operation , first code "stay away" from other robot and then try to avoid color , there may be situtation like robot cannot avoid color to stay away from the other robot.
Reputation Points: 769
Solved Threads: 128
Banned
ithelp is offline Offline
1,910 posts
since May 2006
Sep 25th, 2009
0

Re: need university help first year

can you guys help me with the coding a bit, im not asking the whole thing but can you make me the escape snipet and give me advice for the rest, if possible that would be great. thanks
Reputation Points: 10
Solved Threads: 0
Newbie Poster
umarmaqsood is offline Offline
8 posts
since Aug 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Legacy and Other Languages Forum Timeline: Error when using a contraint in Access
Next Thread in Legacy and Other Languages Forum Timeline: Re: permutation of a string





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC