I want my robot with a sr04 range finder to make some "decisions"
I tried to clarify with a diagram.
The idea is the bot sees an object within a pre defined range and stops then scans left if the object was right and visa versa until another object detected.
Noting angle between first object detected and second should give the distance apart and knowing bot width would it fit.
Thing is have I got the code right,braces and stuff in right logical order? It asm no errors.
the braces may be correct, but, break the calc into smaller calcs.
Start with the squaring, do two calcs. Then, do other stuff in smaller calcs into temp variables then bring it all together. The chances of code being debugged is
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In these calcs consider. Overflow of the calc if you will get confused. So, consider the maximum calcalculation possible and size your variables to the maximum.
if the angle is a constant. Then, do not do a cos() calc use a constant.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can understand sqr and sqr root with same prime numbers so multiplying a number times itself is not its square. I don't know what errors to exect...lot more work to do.
I was the syntax and order gcb works arithmetic formulas.
I guess I should try it. if the angle between objects is 60deg and the distance to each is 20cm then the unknown would be 20cm..that's easy.
If the objects were diffrent distances then the gap would would not be accurate...it would be wider.
It was a thought I should apply to a chassis with stepper motors for smarter bot. I have one using a i2c port controller. could turn degrees better.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I want my robot with a sr04 range finder to make some "decisions"
I tried to clarify with a diagram.
The idea is the bot sees an object within a pre defined range and stops then scans left if the object was right and visa versa until another object detected.
Noting angle between first object detected and second should give the distance apart and knowing bot width would it fit.
Thing is have I got the code right,braces and stuff in right logical order? It asm no errors.
Last edit: stan cartwright 2019-09-01
the braces may be correct, but, break the calc into smaller calcs.
Start with the squaring, do two calcs. Then, do other stuff in smaller calcs into temp variables then bring it all together. The chances of code being debugged is
I don't do these sort of sums on a daily basis. x2 is x squared ie x*x.I couldn't find a square function.
Correct. A square.
In these calcs consider. Overflow of the calc if you will get confused. So, consider the maximum calcalculation possible and size your variables to the maximum.
if the angle is a constant. Then, do not do a cos() calc use a constant.
I can understand sqr and sqr root with same prime numbers so multiplying a number times itself is not its square. I don't know what errors to exect...lot more work to do.
I was the syntax and order gcb works arithmetic formulas.
I suppose it would make less chance of compiler error and not slow it down much
I guess I should try it. if the angle between objects is 60deg and the distance to each is 20cm then the unknown would be 20cm..that's easy.
If the objects were diffrent distances then the gap would would not be accurate...it would be wider.
It was a thought I should apply to a chassis with stepper motors for smarter bot. I have one using a i2c port controller. could turn degrees better.