go away spammer

Author Topic: Help Automating an R/C Tank  (Read 6539 times)

0 Members and 1 Guest are viewing this topic.

Offline garriwilsonTopic starter

  • Supreme Robot
  • *****
  • Posts: 345
  • Helpful? 0
Help Automating an R/C Tank
« 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
« Last Edit: July 07, 2008, 02:24:58 PM by garriwilson »

Offline garriwilsonTopic starter

  • Supreme Robot
  • *****
  • Posts: 345
  • Helpful? 0
Re: Need help Automating a Tank from an R/C Tank
« Reply #1 on: July 04, 2008, 09:33:25 PM »
3. How do I make it track objects, lock on them, and fire?

Offline izua

  • Supreme Robot
  • *****
  • Posts: 682
  • Helpful? 0
    • izua electronics
Re: Need help Automating an R/C Tank
« Reply #2 on: July 05, 2008, 02:18:10 AM »
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?
Check out my homepage for in depth tutorials on microcontrollers and electronics.

Offline garriwilsonTopic starter

  • Supreme Robot
  • *****
  • Posts: 345
  • Helpful? 0
Re: Need help Automating an R/C Tank
« Reply #3 on: July 05, 2008, 06:46:01 PM »
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.

Offline izua

  • Supreme Robot
  • *****
  • Posts: 682
  • Helpful? 0
    • izua electronics
Re: Need help Automating an R/C Tank
« Reply #4 on: July 05, 2008, 06:50:57 PM »
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?
Check out my homepage for in depth tutorials on microcontrollers and electronics.

Offline garriwilsonTopic starter

  • Supreme Robot
  • *****
  • Posts: 345
  • Helpful? 0
Re: Need help Automating an R/C Tank
« Reply #5 on: July 05, 2008, 07:02:28 PM »
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
« Last Edit: July 05, 2008, 07:49:59 PM by garriwilson »

Offline garriwilsonTopic starter

  • Supreme Robot
  • *****
  • Posts: 345
  • Helpful? 0
Re: Need help Automating an R/C Tank
« Reply #6 on: July 05, 2008, 07:48:55 PM »
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

Offline garriwilsonTopic starter

  • Supreme Robot
  • *****
  • Posts: 345
  • Helpful? 0
Re: Need help Automating an R/C Tank
« Reply #7 on: July 05, 2008, 07:59:56 PM »
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

Offline garriwilsonTopic starter

  • Supreme Robot
  • *****
  • Posts: 345
  • Helpful? 0
Re: Need help Automating an R/C Tank
« Reply #8 on: July 05, 2008, 08:24:58 PM »
gonna read this for object tracking info...

http://www.societyofrobots.com/robot_sumo.shtml
« Last Edit: July 06, 2008, 10:44:29 AM by garriwilson »

Offline garriwilsonTopic starter

  • Supreme Robot
  • *****
  • Posts: 345
  • Helpful? 0
Re: Need help Automating an R/C Tank
« Reply #9 on: July 05, 2008, 08:36:47 PM »
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

Offline garriwilsonTopic starter

  • Supreme Robot
  • *****
  • Posts: 345
  • Helpful? 0
Re: Need help Automating an R/C Tank
« Reply #10 on: July 05, 2008, 10:06:00 PM »
im stuck.. could someone give me some advice please?

Offline izua

  • Supreme Robot
  • *****
  • Posts: 682
  • Helpful? 0
    • izua electronics
Re: Need help Automating an R/C Tank
« Reply #11 on: July 06, 2008, 03:42:55 AM »
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.
Check out my homepage for in depth tutorials on microcontrollers and electronics.

Offline dunk

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 1,086
  • Helpful? 21
    • dunk's robot
Re: Need help Automating an R/C Tank
« Reply #12 on: July 06, 2008, 06:13:22 AM »
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.

Offline garriwilsonTopic starter

  • Supreme Robot
  • *****
  • Posts: 345
  • Helpful? 0
Re: Need help Automating an R/C Tank
« Reply #13 on: July 06, 2008, 10:33:12 AM »
@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

Quote
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
« Last Edit: July 06, 2008, 10:34:16 AM by garriwilson »

Offline garriwilsonTopic starter

  • Supreme Robot
  • *****
  • Posts: 345
  • Helpful? 0
Re: Need help Automating an R/C Tank
« Reply #14 on: July 06, 2008, 08:17:48 PM »
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?

Offline garriwilsonTopic starter

  • Supreme Robot
  • *****
  • Posts: 345
  • Helpful? 0
Re: Need help Automating an R/C Tank
« Reply #15 on: July 06, 2008, 09:04:14 PM »
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

Offline garriwilsonTopic starter

  • Supreme Robot
  • *****
  • Posts: 345
  • Helpful? 0
Re: Help Automating an R/C Tank
« Reply #16 on: July 07, 2008, 02:25:18 PM »
Does anyone know if I could use the 50$ board on this?

Offline pomprocker

  • Supreme Robot
  • *****
  • Posts: 1,431
  • Helpful? 16
  • Sorry miss, I was giving myself an oil-job.
    • Nerdcore - Programming, Electronics, Mechanics
Re: Help Automating an R/C Tank
« Reply #17 on: July 07, 2008, 02:50:41 PM »
you should be able to use the $50 robot mcu

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Help Automating an R/C Tank
« Reply #18 on: July 19, 2008, 12:33:05 PM »
Quote
Also, what is the average range of the IR sensor that it gives valid readings at?
check the datasheets ;D

Quote
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.

Quote
Does anyone know if I could use the 50$ board on this?
yeap


another tracking option:
[youtube]x2od63eroPY[/youtube]
« Last Edit: July 19, 2008, 12:35:51 PM by Admin »

Offline izua

  • Supreme Robot
  • *****
  • Posts: 682
  • Helpful? 0
    • izua electronics
Re: Help Automating an R/C Tank
« Reply #19 on: July 19, 2008, 02:28:55 PM »
That's pretty CPU intensive. Blackfin module?
Check out my homepage for in depth tutorials on microcontrollers and electronics.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Help Automating an R/C Tank
« Reply #20 on: July 19, 2008, 09:34:48 PM »
well, the Blackfin does all the intensive stuff and just spits out the final results to my Axon

 


Get Your Ad Here

data_list