Robot Battle Home Log In | Register
Welcome Guest
Help | Search | Members | Contest Calendar | Chat

Robot Battle Registry  Discussion Forums  New Robots  Concept Robot : Predictive Fire
Pages: (3) [1] 2 3  ( Go to first unread post )
Concept Robot : Predictive Fire Track this topic | Email this topic | Print this topic 
lhilt
Posted: May 2 2007, 05:24 AM


Serious Player


Group: Members
Posts: 64 (3 robots)
Member No.: 1092
Joined: 16-April 07



With all the discussions about predictive fire, Ive decided to take a crack at it. This project is as yet un named, and Im sure I will stumble much along the way.

Current development status:
-Built logical storage array
-Created/coded prediction theory
-created/coded a way to get angular rotation to move from one (x,y) to another (x,y)
-started a print output for troubleshooting and effectiveness of the predictive fire routine
-added simple fire routine
-created a simple moving, non firing robot which reports its (x,y) when pinged to see how close my detect is coming (much thanks to Jamie and MrFox's discussions here on the registry

Keep in mind, Ive not put this bot in an arena yet, so I dont even know that it wil run. Im also working on controling math flow, so problems may too arise there.

More updates to come as soon as I get a robot that wont blow up in an arena
 
    Top

lhilt
Posted: May 4 2007, 08:47 AM


Serious Player


Group: Members
Posts: 64 (3 robots)
Member No.: 1092
Joined: 16-April 07



I uploaded the prerelease of this robot.. boy does he stink to high heaven. Im having serious issues with a place where I call:

acos(UV/U*V) to get the angular rotation to the predicted (x,y) of the robot based on his linear movement over a period of turns. For some reason randomly it returns values over +1 (something like 1.087233) and I am sure it is because of some mathmatical thing Im doing wrong.

When he runs, out of about 168 turns, he will guess correctly twice. *I think*

Problem is, Ive been so frustrated and quite honestly baffled at this, Ive screwed up the order in which I set the variable guessing and when I call what subroutines.

I did figure out one thing I was doing wrong. Once I had a predicted location and I went there with my gun, I did a Scan() and had an if(_dtcrobot) section. I forgot that if (_dtcrobot), it would call the event handeler for it and then return to the sub
 
    Top

lhilt
Posted: May 15 2007, 12:29 PM


Serious Player


Group: Members
Posts: 64 (3 robots)
Member No.: 1092
Joined: 16-April 07



Im so very confused with this robot. Ive been working on him alot and I am STILL getting out of range returns from my acos. Im thinking I may have to resort to a round() statement but this would kill the already *(&tty accuracy that Im getting.

The other thing Im in need of doing for this, even before getting the programming flow down is to figure out, between the two points which I scan the robot Im trying to "predict" how to solve the slope equation
CODE
y = mx+b

and then further use the slope of that line to predict a point within that slope.


then, the next thing I need to do is figure out a tolerance that I should judge against to say that the distance between the two scans are too great, so I should disreguard my results and start over... that comes later tho.

Any trig/math wiz's would be appreciated if you would weigh in on this problem of mine. I would love to get even up to a 35% accuracy rate in firing prediction.
 
    Top

tomash
Posted: May 15 2007, 01:57 PM


Grand Master


Group: Moderators
Posts: 810 (8 robots)
Member No.: 441
Joined: 11-July 05



Sorry no one has replied to this yet. I'm rubbish at maths, so I cant really help you, other than to say - go back the basics of the robot. Copy it and in the copied version take out anything that could be causing trouble, or you are confised about, then slowly add it back in, testing each bit as you go. I use print() alot to find errors and also msgboxs are good to inform you of what the robots is 'thinking' at that time.

I just posted to tell you - we are listening (or at least I am!)!

This post has been edited by tomash on May 15 2007, 01:57 PM
 
     Top

lhilt
Posted: May 15 2007, 07:27 PM


Serious Player


Group: Members
Posts: 64 (3 robots)
Member No.: 1092
Joined: 16-April 07



Thank you VERY much... Ive been using print a TON ... and thats how I found that Im basically NOT getting the sequence of events right....

Thanks for the reply, It is great to know that yall are out there:D
 
    Top

tom bombadil
Posted: May 15 2007, 09:17 PM


Dedicated Player


Group: Members
Posts: 149 (6 robots)
Member No.: 498
Joined: 17-September 05



I have not figured out your problem but after looking some at the robot that you have uploaded a little bit I have made a few observations that might help you. Firstly that acos only returns the value of 1 or a value that is grater then one this suggests that your formula needs complete revision. In face I cant even figured out what you are trying to do so until I know what you are trying to do all I can do is suggest alternative layouts.
Second that the acos only seems to run once the first time that you scan a robot.


--------------------
"And if he where given the ring he would soon forget it, or most likely throw it away. Such things have no hold on his mind."

Gandalf referring to Tom Bombadil.
 
    Top

Ichabod
Posted: May 16 2007, 05:33 AM


Grand Vizier


Group: Contest Hosts
Posts: 1238 (16 robots)
Member No.: 700
Joined: 2-May 06



QUOTE (lhilt @ May 4 2007, 10:47 AM)
acos(UV/U*V) to get the angular rotation to the predicted (x,y) of the robot based on his linear movement over a period of turns.

I'm confused. If you want the angle to a given (x,y), should you use atan2? I usually use atan2 (_xPos - targetX, _yPos - targetY) for this sort of thing, IIRC. Maybe I'm missing something, but unfortunately I won't be able to look at this closer until Friday at best.


--------------------
-Ichabod
Nils illegitimo carborundum

QUOTE (Cho Setsu)
By eliminating disturbances, we redouble the disease.


131,628,711 robots killed in the name of simulation
 
     Top

tomash
Posted: May 16 2007, 10:19 AM


Grand Master


Group: Moderators
Posts: 810 (8 robots)
Member No.: 441
Joined: 11-July 05



QUOTE (lhilt @ May 15 2007, 10:27 PM)
Thank you VERY much... Ive been using print a TON ... and thats how I found that Im basically NOT getting the sequence of events right....

Thanks for the reply, It is great to know that yall are out there:D

No problem! Here to help!
 
     Top

lhilt
Posted: May 17 2007, 08:11 AM


Serious Player


Group: Members
Posts: 64 (3 robots)
Member No.: 1092
Joined: 16-April 07




I got the formula from Here . maybe this will shed some light? if you have a better way, Id love to be able to do it.

tom bombadil:
I know the flow of the program is off, and that's why the stupid thing runs then.. its not even supposed to attempt the acos until 2 successive scans...

*sigh* maybe Im going about it the wrong way... I was trying to get my math down, and then go back and visit why the flow is so badly off... (one is my inability to figure out where I should set and ultimatly clear the variable "guessing"... maybe I should work on the flow first.. Ill start working on that today.

Thanks a TON for everyone's help
 
    Top

Ichabod
Posted: May 17 2007, 09:04 AM


Grand Vizier


Group: Contest Hosts
Posts: 1238 (16 robots)
Member No.: 700
Joined: 2-May 06



QUOTE (lhilt @ May 17 2007, 10:11 AM)
I got the formula from Here . maybe this will shed some light? if you have a better way, Id love to be able to do it.

That's the angle between two vectors. You're dealing with points. From your code you seem to be trying to convert them to vectors, but I'm not sure you're doing that right. It's much simpler to just determine the angle to the point.

If I understand, you want to turn to face the point (px, py), which is your prediction of the target robot's current location. Try this:

RSL
startAngle = _gunAim
destAngle = Atan2 (px - _xPos, py - _yPos)
GoSub (MinDegreesRight)
GunRight (rightDegrees)


The "px - _xPos" should give the x coordinate of the predicted x relative to your position, and "py - _yPos" does the same for the y. Those form the two legs of the right triangle, and Atan2 should give you the corresponding angle from that triangle, which is the absolute angle to the predicted point from your robot's location. You then use MinDegreesRight to turn to that angle.

That's just off the top of my head. If it doesn't work, let me know, and I can dig around in my robots this weekend. I know I've done this somewhere.


--------------------
-Ichabod
Nils illegitimo carborundum

QUOTE (Cho Setsu)
By eliminating disturbances, we redouble the disease.


131,628,711 robots killed in the name of simulation
 
     Top

lhilt
Posted: May 18 2007, 06:43 AM


Serious Player


Group: Members
Posts: 64 (3 robots)
Member No.: 1092
Joined: 16-April 07



Thanks ich! I infact thought that I had done the conversion to vectors but I dont think I have. Ill try out your solution for this today, so long as work doesnt get in the way <G>


Thanks a ton!
 
    Top

lhilt
Posted: May 18 2007, 11:34 AM


Serious Player


Group: Members
Posts: 64 (3 robots)
Member No.: 1092
Joined: 16-April 07



QUOTE (Ichabod @ May 17 2007, 11:04 AM)
QUOTE (ichabod)

That's just off the top of my head. If it doesn't work, let me know, and I can dig around in my robots this weekend. I know I've done this somewhere.



you're my hero... it works great! thanks a ton! Ive gotten a second wind now

 
    Top

lhilt
Posted: May 29 2007, 09:59 AM


Serious Player


Group: Members
Posts: 64 (3 robots)
Member No.: 1092
Joined: 16-April 07



ok, so now that the rotation thing is down, I cannot seem to call the "guessing" variable in the right place to get the flow of the prediction down. This is becoming more and more frustrating, and im debating whether to continue with this project further.


I really havent the foggiest how to call the guessing, currently after I go through all the undulations of the first scan I set guessing to = 1 and then call a "return" to exit the event handler.

The other problem that randomly crops up is somehow the return for _dtcid is randomly -1, throwing the whole thing for a loop. It causes the guessing to stop, and ive not got a reason for that.


the other problem I am having is that I am calling Radarright(rightdegrees) and no matter what the rotation of the gun/radar is always the same.. I would think that atleast occasionally it would reverse the rotation of the turret.... further prompting me that this is in fact not working at all....


Anyhow, thats the status update.. I hoped to be around 35% and then modify it for the flagbot contest, however I doubt I will enter this guy at all...
 
    Top

steJ
Posted: May 29 2007, 12:23 PM


Tiny Bot Obsessive


Group: Moderators
Posts: 951 (13 robots)
Member No.: 9
Joined: 2-May 03



I too have had the _dtcid = -1 crop up on occasion with Analyst, i had to add a few check sections in to iron it out but shouldnt cause you too much trouble.

As for guessing, im not sure which part your having a problem with so this is just what i did with my attempt at pred fire. Im assuming you have your approx (x,y) co ords for your target and the heading and so have predicted x,y co ords for future turns of the robot.

I then attempted to calculate how long it would take to turn my radar /gun to point at a target point and fire a missile to there and try to come up with a situation where the missile should hit one of the target co ords as the target bot should just get there. Simple hey tongue.gif If only sad.gif


--------------------
He who laughs last, thinks slowest.
SteJ
 
    Top

lhilt
Posted: May 29 2007, 12:36 PM


Serious Player


Group: Members
Posts: 64 (3 robots)
Member No.: 1092
Joined: 16-April 07



I am uploading the 4th version of my Bot... I used my frustration with it to drive me to totally ignore the first 6 hours of work.. (great to have a coding hobby when you work in an IT job... looks to most like im simply scripting <EG>)

So currently this thing is at about 67% accurate in predicting with fluctuations as low as 45% all the way up to 97% based on how many times he gets to guess.


Stej -- Yes thats what I was basically doing.. taking 2 scans, finding the rate of change, picking a point and figuring it out from there, going radarright(angletonext) but the problem was tht I couldnt set the guessing variable correctly to prevent it from assuming that it was the second scan on the very first one....... I think I have come up with a way around it...

As far as the -1 problem, I think its intermittantly returning a scanned wall thing, so I just had to return out of the sub in the proper place so that it would work... i dunno

So now that the Prediction is working, I just have to make the thing competitive.. adding a more complex firing sub, and get the Priorities for event handlers in proper order.

Can anyone give me advice on what order the priorities should be? Thats the hardest part for me... Should regDtcRobot be a 1, or should regCldWall/RegCldRobot be higher?
 
    Top
Pages: (3) [1] 2 3 
<< Back to New Robots