Hello! Total newbie here. I just got the Mindstorm EV3 for my 10-year old son and am trying to learn the basics in order to guide him. But I am not a technically minded person, and I know almost nothing about the software features. So, my question here is very simple: How do I program the robot to react immediately when the infrared sensor detects an obstacle?
I'm using the Track3r robot that my son built right out of the box. All I'm trying to do is get it to go forward, right 30º, and left 60º, over and over in a wide circle until the infrared sensor detects an obstacle, at which point it should back up and turn left.
It works, but the problem I have is that it runs through the whole forward cycle (forward, right, left) before backing up. I want it to react as soon as it detects an obstacle, i.e., if it turns right only 5º and detects a chair leg, I want it to back up immediately.
Basic Loop Program
-
- Posts: 7
- Joined: 07 Mar 2014, 23:29
Re: Basic Loop Program
hello
have you managed to get this working yet?
the only thing I would suggest is an if statement or while statement but that is using "nxc"(not exactly C).
I don't know how the programme for ev3 works. you want to put in something that says "if this is true, go forward".
if false then the robot should go through the backing up routine. sorry I couldn't be any more help, check youtube.
have you managed to get this working yet?
the only thing I would suggest is an if statement or while statement but that is using "nxc"(not exactly C).
I don't know how the programme for ev3 works. you want to put in something that says "if this is true, go forward".
if false then the robot should go through the backing up routine. sorry I couldn't be any more help, check youtube.
Re: Basic Loop Program
I'm not familiar with EV3 either but it looks as if you have put all the turns in a loop before backing up, which is exactly what you describe the robot acting.
Perhaps you should just set it to run in a circle until it hits an obstacle (inside the IF loop) then telling it to back up.
This sounds very like the sort of logic in a basic 'line follower' program' - there are dozens on the web which you can study.
Here is one, uses the light sensor but the effect is similar -
https://sites.google.com/site/gask3t/le ... e-follower
Perhaps you should just set it to run in a circle until it hits an obstacle (inside the IF loop) then telling it to back up.
This sounds very like the sort of logic in a basic 'line follower' program' - there are dozens on the web which you can study.
Here is one, uses the light sensor but the effect is similar -
https://sites.google.com/site/gask3t/le ... e-follower
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
Who is online
Users browsing this forum: No registered users and 1 guest