Hey, guys do u have any idea of algorithm for my line follower avoid boxes like this video https://youtu.be/KJnNJ6ihtbM
-
doesn't line following use two sensors, moving right/left so that one sensor is dark and the other light
-
looks like the distance sensor recognizes the box and takes priority, moving clockwise, turning distance sensors and moving forwards while maintaining a constant distance from box
-
until the line sensors detect the dark line, turning clockwise and continuing line following
develop each algorithm separately
My advice is to try to figure that out yourself. Imagine you were the robot- right down the steps you would follow if you were to act as the robot.
Or when you say algorithm, do you actually mean you want code?
I didn't understand the second algorithm. Can u explain other way pls.
I am talking about algorithm
What do you mean with "second algorithm"?
could you please clearly write the name what you mean with "algorithm"
trying to be quick and short on words mostly turns out to just slow things down through waiting for an answer while the first answer is just asking back for more details / specification and you have to write the details anyway
best regards Stefan
code is doing two things -- tracking the line and looking for obstacles such as the box.
it normally tracks the line but when there is an obstacle recognized using the ultrasonic distance sensor it needs to switch modes from tracking the line to moving around the obstacle.
but while moving around the obstacle, maintaining a constant distance from the obstacle, it needs to look for the line, both sensors seeing dark. when that happens, it switches modes back to tracking the line
Hi.
Can I suggest you start by just making a line following robot, FORGET the rest and get your platform working. DON'T complicate things.
Can you please tell us your electronics, programming, arduino, hardware experience?
What hardware have you got?
What have you built and programmed with Arduino already?
Forget algorithm, think flow chart of what your inputs and outputs will do as your robot moves along the strip.
Thanks.. Tom...
I am using
Arduino Uno R3
motor driver l298n
qtr sersor
ultrasonic sensor hc-sr04
I have little bit experience
My robot can do everything (follow line, 90°, 45°) except avoid objects.
Do u have any idea how can I solve it?
Re-read post #7 - your robot needs two modes. Follow line as you already have and avoid obstacle while trying to pick the line up again.
but I don't what to write in c++...
you should post with more words and before posting re-reading your text if the text makes really sense
What does that mean
"but I don't what to write in c++..."
you don't want to write code in c++?
So what other programming-language do you prefer?
you don't know how to write what in c++?
transform this simple but very generalised "don't know"-question into a specific question
best regards Stefan
post
always
your complete sketch !
really always!
You can post code by using this method that adds the code-tags
There is an automatic function for doing this in the Arduino-IDE
just three steps
- press Ctrl-T for autoformatting your code
- do a rightclick with the mouse and choose "copy for forum"
- paste clipboard into write-window of a posting
awaiting your complete sketch before I give any further advise
So what is the behaviour of your robot that you observe?
below the video, the video-uploader describes his algorithms
Algorithms :
- Curves = PID
- Sharp edges 90 degree and less = FSM (Finite State Machine)
- Obstacle discovery = FSM
- Obstacle bypass distance = PID
- Find line after obstacle = FSM
the finite state machine or in short a state-machine creates the different modes of operation that you need.
Learning the basic principle of how state-machines work is not done in five minutes.
It needs some pre-limary exercises with a state-machine that is simpler than the one you need for the robot.
And there waits analytic work for you.
You have to analyse what steps must your code do to drive around an obstacle as shown in the video
This means what are the values that indicate there is an obstacle?
what is the next step for the robot to drive? (some kind of turning)
what values change through the turning ?
what value indicates "now I can move forward?
driving around the obstacle requires to change between turning left/right and moving forward
and this is done with a state-machine
here is an example that shows the principle.
This example has absolutely nothing to do with your robot. You have to build up your state-machine from scratch
The only thing you can take is the basic structure of the switch-case-break-statement.
everything else must be changed
- the variables must be changed
- the constants for the states must be changed
- the number of cases must be changed
- the code inside each case must be changed
As long as you post specific questions the users here will help you.
I can almost promise you
If you just post generalised questions like
"I don't know how to code that please help"
The answers will be links to tutorials about state-machines
best regards Stefan
this looks so difficult. I have until tuesday for this to be ready I'm screwed.
Tomorrow On monday: how many hours can you work on it?
Do you know anything about the dimensions of the obstacle?
It depends I have to study math too:(. I will have probably 3 hours to work on robot.
Idk
Then I suspect that you are, as you so succinctly put it, screwed. Even if you could get the code written quickly, it will likely take longer than the time you have available to even start debugging it.