Society of Robots - Robot Forum
General Misc => Misc => Topic started by: garriwilson on July 04, 2008, 08:27:04 PM
-
OK, here is the tank:
http://www.hobbytron.com/AirsoftRCType90BattleTank.html
So.
1. First of all, let's see.. what does a tank do. IT SHOOTS THINGS. So what sensor do I use to detect an object, say a cardboard box, a water bottle, etc.? Is there a code for this already, because I know NO programming... and I don't know if I could learn it.
2. Then, would I just make it to drive a little, then stop and scan around, if no targets keep driving? So then if there are obstacles, it needs to avoid those, so that's another thing to consider.
If you have any articles, or tutorials on this, please share it with me, that would be highly appreciated.
EDIT:
please read the whole thread, because there may have been some changes
-
3. How do I make it track objects, lock on them, and fire?
-
Admin had a video on this somewhere, using a servo and an IR sensor. Think of it this way: how do you (as a human :P) track an object?
-
I use my eyes lol. I know the part of using IR, but I need to know how to connect this to which microcontroller ( I have 50$ robot one will that work?) to send the data to the firing mechanism and activate it.
-
eyes are sensors. you need something else to guide them in a tracking motion. you need to repeat the steps your brain takes to track stuff, actually.
hmm, that depends. what kind of firing mechanism is it?
-
I do not know yet.. I haven't ordered it. I want to plan everything out then order stuff.
ok these are the actions I came up with:
1. scan around
2. pick an object by some specification (color, shape, etc.)
3. if it moves, stick on it with my eyes
a. if it moves i send signal to move my eyes
b. if i had a gun lol, i would tell it too follow too
-
update:
decided to use this because I checked, it has all the IDENTICAL specs but 10 bucks cheaper and still free shipping:
http://www.hobbytron.com/AirsoftRCLeopardIIA5BattleTank.html#11528
-
i just thought of something
since the gun moves sideways and UP AND DOWN, could i put 2 IR sensors perpendicular to each other to detect up and down motion also? if no, how would i do this
-
gonna read this for object tracking info...
http://www.societyofrobots.com/robot_sumo.shtml
-
so instead of this :
pseudocode:
//scanner code
if sharp IR detects object
scanning IR turns left
else //no object detected
scanning IR turns right
//robot motion code
if scanner is pointing far left
robot turns left
else if scanner is pointing far right
robot turns right
else //scanner pointing forward
robot drives straight
instead of that i would put:
//scanner code
if sharp IR detects object
scanning IR turns left
else //no object detected
scanning IR turns right
//robot motion code
if scanner is pointing far left
turret turns left
else if scanner is pointing far right
turret turns right
else //scanner pointing forward
turret remains straight
also:
//tank code
if no object detected
drive straight for 5 seconds, scan
if object detected "use robot motion code"
else if no object detected, super spin 180 degrees, scan
and so on?
this is my miserable try to understand programming, which i know none of, so sorry if i made horrible mistakes
-
im stuck.. could someone give me some advice please?
-
Damn box crashed when i was about to post. Anyway.
That's how tracking works. It's hard to make a robot figure features of an object, so you're better of detecting simple movment as a "here is more of that" "here is less of that". Admin had something like this on the roomba, IIRC, basically, an IR sensor on a servo. Servo moves very little left/right, until it finds a higher reading on one side. Then, it moves to that side, and repeats. Works, but if something is out of its field of view, it won't work :P I thin kthe code you psoted is the one, but that works too.
Why do you want to track your cannon position on Y? Remember, when you have more degrees of freedom with the turret: the tank can rotate, and the turret can rotate. You will have to decide when the code will rotate the tank (so it won't move in a straight line always) and when to rotate the turret. I doubt you could do it with a single sensor.
-
hey Garriwilson,
so what are you trying to achieve with your pesudocode?
if i were you i would scan the sensor by turning the turret since you already have a turning turret on the tank.
your pesudocode currently looks for the left hand side of any object within range.
is that what you want?
if you actually want it to track movement then you will need to compare 2 readings taken at different times.
any change in values would mean an object in that direction has moved.
maybe if you did one scan and recorded all the distance values.
then on subsequent scans compare to the initial readings. any changes in range must be something moving so shoot at it.
IR sensors are probably not the best suited to this task as their range is quite limited.
maybe you should consider sonar? the problem with sonar would be the relatively wide field of view. (not an issue if you just liberally spray the aria with Airsoft pellets...)
dunk.
-
@izua yea since you guys both said i'll use the tank to move the sensors
@dunk
ok thanks for the idea of rotating the sensor on the turret, maybe i could put one in front and one in the back so with one full back and forth motion i'll get front and rear readings?
the pseudocode... i just copied that from admin's Stampy code and changed it instead of the tank turning left, the turret turns left, i need help on the programming
if you actually want it to track movement then you will need to compare 2 readings taken at different times. any change in values would mean an object in that direction has moved.
maybe if you did one scan and recorded all the distance values. then on subsequent scans compare to the initial readings. any changes in range must be something moving so shoot at it.
how would i get 2 readings at different times? is this what you mean, have it scan back and forth, if both times the readings are the same, that means there is no object, and once an object appears, the readings will change in one place?
and would you recommend sonar for my purposes? and is it almost the same price as IR or more expensive?
P.S. this is just something i thought was fun to do , it's not for competition or anything so it doesnt have to be like super accurate
thanks for the help guys, the big picture is starting to clear up a bit in my mind
-
So, if I put the IR sensor on the turret, that would be instant sync between the sensor and the turret, so if it detects an object, the turret would stay still?
Also, what is the average range of the IR sensor that it gives valid readings at?
-
Is my understanding of IR sensors correct:
It has measures like this:
000 000 234 463 989 267 000 000
?
what do those numbers represent
P.S. I saw this on one of the tutorial pages
-
Does anyone know if I could use the 50$ board on this?
-
you should be able to use the $50 robot mcu
-
Also, what is the average range of the IR sensor that it gives valid readings at?
check the datasheets ;D
000 000 234 463 989 267 000 000
?
what do those numbers represent
You'll see numbers from 0 to 255, using 8 bit ADC. Its basically the reading your microcontroller will get, where the number represents some voltage on the sharp IR signal line.
Does anyone know if I could use the 50$ board on this?
yeap
another tracking option:
[youtube]x2od63eroPY[/youtube]
-
That's pretty CPU intensive. Blackfin module?
-
well, the Blackfin does all the intensive stuff and just spits out the final results to my Axon