what is a 4-stage ultrasonic movement command? i am having difficulties writing a 4 stage movement command all i can do is write a 1-stage command...please HELP!!!

Mon Oct 22, 2012 2:21 pm

magicode

Moderator

Joined: Tue Sep 14, 2010 9:19 pmPosts: 496

Re: What is a 4-stage ultrasonic movement command?

Can you describe what you want to do a little more clearly? What do you mean by 4-step ultrasonic command?

_________________sudo rm -rf /

Mon Oct 22, 2012 2:44 pm

royalthemaster

Novice

Joined: Mon Oct 22, 2012 2:14 pmPosts: 51

Re: What is a 4-stage ultrasonic movement command?

its a simple ultrasonic command, just be able to work 1 after the other 4 times in a row

Tue Oct 23, 2012 2:54 pm

magicode

Moderator

Joined: Tue Sep 14, 2010 9:19 pmPosts: 496

Re: What is a 4-stage ultrasonic movement command?

I'm sorry, I still don't understand what you mean. Are you trying to describe something like:Go forward until 20 cm away from wallTurn right.Got forward until 50 cm away from wallTurn left.

_________________sudo rm -rf /

Tue Oct 23, 2012 3:09 pm

royalthemaster

Novice

Joined: Mon Oct 22, 2012 2:14 pmPosts: 51

Re: What is a 4-stage ultrasonic movement command?

YES thats exactly wat im trying to say, i got my robot to go forward untill it got to like, 40cm then turn left...but it didnt do anything else...even though there were still 3 more simple moving forward and turning left/right commands...think u can just write me a sample program? ppllzz?;D

Tue Oct 23, 2012 6:39 pm

magicode

Moderator

Joined: Tue Sep 14, 2010 9:19 pmPosts: 496

Re: What is a 4-stage ultrasonic movement command?

Can you post the code that you already have written? It'll be a lot better if we can work from what you already have.

_________________sudo rm -rf /

Tue Oct 23, 2012 6:57 pm

royalthemaster

Novice

Joined: Mon Oct 22, 2012 2:14 pmPosts: 51

Re: What is a 4-stage ultrasonic movement command?

*sigh* ya i shall get it on here by 10/23/12(its at school) by the way i appreciate you responding to my thread and attempting to help me

while(SensorValue[sonarSensor] > distance_in_cm) // While the Sonar Sensor readings are less than the specified, 'distance_in_cm': { motor[motorB] = 75; // Motor B is run at a 75 power level motor[motorC] = 75; // Motor C is run at a 75 power level } motor[motorB] = 75; // Motor B is stopped at a 0 power level motor[motorC] = 75; // Motor C is stopped at a 0 power level

int distance_in_cm = 70; //2nd sonar command ( i dont know how to even get this 1 to work, i think // ( i need the WHILE command) { motor[motorD] = 75; motor[motorE] = 75;

//more to come

}

Wed Oct 24, 2012 12:59 am

royalthemaster

Novice

Joined: Mon Oct 22, 2012 2:14 pmPosts: 51

Re: What is a 4-stage ultrasonic movement command?

i had to remake this command so its not the actual thing, i can get the actual thing tomarrow while as im at school, but for now u can have that to mess around that till i post the actual command list tomarrow while im at school

Wed Oct 24, 2012 1:01 am

royalthemaster

Novice

Joined: Mon Oct 22, 2012 2:14 pmPosts: 51

Re: What is a 4-stage ultrasonic movement command?

just like i promised bro, here is the exact command list that we have, any assistance is GREATLY appreciated:

while(SensorValue[sonarSensor] > distance_in_cm) // While the Sonar Sensor readings are less than the specified, 'distance_in_cm': { motor[motorD] = 30; // Motor B is run at a 75 power level motor[motorE] = 30; // Motor C is run at a 75 power level

motor[motorD] = 0; // Motor B is stopped at a 0 power level motor[motorE] = 0; // Motor C is stopped at a 0 power level

motor[motorD] = 0; motor[motorE] = 50; wait1Msec(1000);

}}

Wed Oct 24, 2012 1:42 pm

MHTS

Guru

Joined: Sun Nov 15, 2009 5:46 amPosts: 1499

Re: What is a 4-stage ultrasonic movement command?

I don't understand what you are trying to do. According to your code, you are programming the pair of motors to three different behaviors (1. move forward at 30% power; 2. stop; 3. turn), at the same time. So only the last behavior will stick. Therefore, what you will see is the robot is turning all the time as long as there is no obstacle within 25cm.If I have to guess what you want to do, it is probably something like this:

Since I don't know your intended behavior, I did not put in any action code.

Wed Oct 24, 2012 1:52 pm

royalthemaster

Novice

Joined: Mon Oct 22, 2012 2:14 pmPosts: 51

Re: What is a 4-stage ultrasonic movement command?

so if i want it to stop, turn, and move forward i would put them within those 3 brackets?....and you have any more advice for me on this topic?

Wed Oct 24, 2012 6:34 pm

MHTS

Guru

Joined: Sun Nov 15, 2009 5:46 amPosts: 1499

Re: What is a 4-stage ultrasonic movement command?

Yes, basically, on every loop, you check the sonar sensor and other sensors to decide what to do. For example, if the sonar sensor sensed no obstacles within 25 cm, then go straight ahead, then the code would look like this:

Who is online

Users browsing this forum: No registered users and 2 guests

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