Author Topic: AI-ing (.py files, coding, nose-orienting R+D, and help)  (Read 235650 times)

Offline G.K.

  • *
  • Posts: 12156
  • Rep: 10
  • Striving for a good personal text since 1994.
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #320 on: January 09, 2010, 01:29:20 AM »
Have you wired the controls correctly?
My above post explains everything about everything.

Host of: Wheely Tag, Back To The Beginnings, BTTB 2, BTTB 3, BTTB 4, & BTTB V.

Heavy Metal: Champion (Mockery of the Whole Concept)
Robotic International Wars Series 1: Champion (Minifridge 6)
RA2 Team Championships 1 & 2: Champion (High Speed Train & Upthrust - as part of Naryar's Not Quite Evil Council of Doom)

Runner Up in: The Amazing Rage (Team Fedex), R0B0NOVA (Zaphod Stock), Steel Warzone (Inception of Instability), Box of Nightmares (Gicquel), Wheely Tag (Minifridge the Second)

Clash Cubes IV: 5th place (Fretless)
BBEANS 6: Rumble Winner & 6th Place (Minifridge 4)

Offline S.T.C.

  • *
  • Posts: 2105
  • Rep: 4
  • Not to be confused with STDs.
    • www.youtube.com/user/Shad
    • View Profile
    • Awards
  • See profile for gamer tags: Yes
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #321 on: January 09, 2010, 08:58:22 AM »
yeah, I did



Offline G.K.

  • *
  • Posts: 12156
  • Rep: 10
  • Striving for a good personal text since 1994.
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #322 on: January 09, 2010, 10:06:26 AM »
I dunno then.

Edit:The edit to the .py isn't working, might be the test bot.
My above post explains everything about everything.

Host of: Wheely Tag, Back To The Beginnings, BTTB 2, BTTB 3, BTTB 4, & BTTB V.

Heavy Metal: Champion (Mockery of the Whole Concept)
Robotic International Wars Series 1: Champion (Minifridge 6)
RA2 Team Championships 1 & 2: Champion (High Speed Train & Upthrust - as part of Naryar's Not Quite Evil Council of Doom)

Runner Up in: The Amazing Rage (Team Fedex), R0B0NOVA (Zaphod Stock), Steel Warzone (Inception of Instability), Box of Nightmares (Gicquel), Wheely Tag (Minifridge the Second)

Clash Cubes IV: 5th place (Fretless)
BBEANS 6: Rumble Winner & 6th Place (Minifridge 4)

Offline System32

  • *
  • Posts: 4663
  • Rep: 4
  • Reality
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #323 on: January 12, 2010, 12:57:06 PM »
I was AIing a batch of Stock bots, when suddenly... Nothing.

I mean it, I wire the bindings correctly and NO AI works.

They just drive, no weapon movement at all. It's freaky.
Put this onto your signature if you were part of this crappy fad in '03.

Offline Scrap Daddy

Re: AI-ing (.py files, coding, R+D, and help)
« Reply #324 on: January 12, 2010, 08:13:43 PM »
Someone help please?

I'm trying to AI those servo bots. On the left is my bot and below is Click's Kheper. Wired and named exactly the same yet they don't act the same way. My bot trys to move the servo down at the beginning of the match instead of up which is bad...




and my bindings and Kheper's.

Code: [Select]
    list.append(("Revelation","Kheper",{'nose':math.pi*2,'invertible':False,'radius':1,'topspeed':99,'throttle':100,'turn':100,'turnspeed':2,'ServoID':7,'NoChassisTime':4,'weapons':(32,33,34,35,36,37)}))

    list.append(("Kheper","Kheper",{'nose':math.pi/2,'invertible':True,'radius':1,'topspeed':99,'throttle':100,'turn':100,'turnspeed':2,'ServoID':7,'NoChassisTime':4,'weapons':(32,33,34,35,36,37)}))

This is really the only thing keeping me from sending my bots to finish for NAR AI. Tomorrow is the latest I want to send the bots so if I cant figure it out I will just send new bots to replace them...

Offline JoeBlo

Re: AI-ing (.py files, coding, R+D, and help)
« Reply #325 on: January 12, 2010, 09:23:02 PM »
I haven't looked though the py but should the ServoID be the same ?

Offline Scrap Daddy

Re: AI-ing (.py files, coding, R+D, and help)
« Reply #326 on: January 12, 2010, 09:26:15 PM »
I haven't looked though the py but should the ServoID be the same ?
Well, Click said ServoID is what tells the .py where to get the motor angle from and since they are the same they SHOULD be. Unless im misunderstanding what its supposed to do.

Edit: WAIT I think i know whats going on. I forgot to edit the motor angles in the py >.<

Offline Clickbeetle

  • *
  • Posts: 3375
  • Rep: 21
  • In Soviet Russia, bugs stomp YOU!
  • Awards BOTM Winner
    • View Profile
    • Beetle Bros site
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #327 on: January 12, 2010, 09:38:38 PM »
Ah.  It's because your servo is mounted on the baseplate, while Kheper's is mounted sideways on a drum piece.  Your servo is also facing in the opposite direction.


The '0' angle on the DSL servo is in the +Y direction.  So for your bot, 0 is straight up.  But I wrote Kheper's .py based on a '0' angle in the +Z direction, because that is how the servo is oriented on Kheper.


Fix that requires some rebuilding: rotate your servo so it is exactly like Kheper's.


Fix that requires some Python edits: Go through Kheper.py and redo all the angles.  Doing a search for "GetMotorAngle" should find all of them for you.


To clarify:


Servo angles on Kheper=

Servo angles on your bot=


Edit: WAIT it looks like you figured it out.  Well those diagrams should still help.

To lack feeling is to be dead, but to act on every feeling is to be a child.
-Brandon Sanderson, The Way of Kings

Offline G.K.

  • *
  • Posts: 12156
  • Rep: 10
  • Striving for a good personal text since 1994.
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #328 on: January 16, 2010, 03:11:50 PM »
What does EcoOmni do?
My above post explains everything about everything.

Host of: Wheely Tag, Back To The Beginnings, BTTB 2, BTTB 3, BTTB 4, & BTTB V.

Heavy Metal: Champion (Mockery of the Whole Concept)
Robotic International Wars Series 1: Champion (Minifridge 6)
RA2 Team Championships 1 & 2: Champion (High Speed Train & Upthrust - as part of Naryar's Not Quite Evil Council of Doom)

Runner Up in: The Amazing Rage (Team Fedex), R0B0NOVA (Zaphod Stock), Steel Warzone (Inception of Instability), Box of Nightmares (Gicquel), Wheely Tag (Minifridge the Second)

Clash Cubes IV: 5th place (Fretless)
BBEANS 6: Rumble Winner & 6th Place (Minifridge 4)

Offline Naryar

  • Posts: 23278
  • Rep: 20
  • hybrids oui oui
    • http://www.youtube.com/us
  • Awards BOTM Winner
    • View Profile
    • Awards
  • Skype: TheMightyNaryar
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #329 on: January 16, 2010, 03:33:33 PM »
I still have issues with my SZSpinner.py

Code: [Select]
from __future__ import generators
import plus
import AI
from AI import vector3
import Arenas
import Gooey
import math
import Tactics

class SZSpinner(AI.SuperAI):
    "Like Omni, but does not use a range value for a spinning weapon ; instead uses a smartzone"
    name = "SZSpinner"
   
    #IMPORTANT NOTE: This is a WIP and it might not work properly.
    #Just like said, this is an Omni AI that activates it's spinning weapon via a smartzone (that you need to name "spinner") rather than a range value.
    #For very short spinup time robots (jugglers, drums, face spinners, etc) that only really need to spin their weapons when the opponent is on them.
    #Brought to you by Naryar and inspired by Madiaba's Arrowhead.py.
   
    def __init__(self, **args):
        AI.SuperAI.__init__(self, **args)
               
        self.zone = "weapon"
        self.zone1 = "spinner"
        self.triggers = ["Fire"]
        self.trigger2 = ["Srimech"]
        self.reloadTime = 0
        self.reloadDelay = 3
        self.botinzone1 = 0
       
     
        if 'triggers' in args: self.triggers = args['triggers']
        if 'reload' in args: self.reloadDelay = args['reload']
       
        self.triggerIterator = iter(self.triggers)
 
        self.tactics.append(Tactics.Engage(self))
       
    def Activate(self, active):
        if active:
            if AI.SuperAI.debugging:
                self.debug = Gooey.Plain("watch", 0, 75, 100, 75)
                tbox = self.debug.addText("line0", 0, 0, 100, 15)
                tbox.setText("Throttle")
                tbox = self.debug.addText("line1", 0, 15, 100, 15)
                tbox.setText("Turning")
                tbox = self.debug.addText("line2", 0, 30, 100, 15)
                tbox.setText("")
                tbox = self.debug.addText("line3", 0, 45, 100, 15)
                tbox.setText("")
           
            self.RegisterSmartZone(self.zone, 1)
            self.RegisterSmartZone(self.zone1, 2)
           
        return AI.SuperAI.Activate(self, active)

    def Tick(self):
        # fire weapon
        if self.weapons:
            # spin up if enemy is in smartzone.
            if self.botinzone1 == 1:
                self.Input("Spin", 0, 100)
            else:
                self.Input("Spin", 0, 0)
           
           
            targets = [x for x in self.sensors.itervalues() if x.contacts > 0 \
                and not plus.isDefeated(x.robot)]
           
            # slight delay between firing
            if self.reloadTime > 0: self.reloadTime -= 1
           
            if len(targets) > 0 and self.reloadTime <= 0:
                try:
                    trigger = self.triggerIterator.next()
                except StopIteration:
                    self.triggerIterator = iter(self.triggers)
                    trigger = self.triggerIterator.next()
               
                self.Input(trigger, 0, 1)
                self.reloadTime = self.reloadDelay
           
        return AI.SuperAI.Tick(self)

    def InvertHandler(self):
        # fire all weapons once per second (until we're upright!)
        while 1:
            for trigger in self.trigger2:
                self.Input(trigger, 0, 1)
           
            for i in range(0, 8):
                yield 0
               
    def LostComponent(self, id):
        # if we lose all our weapons, stop using the Engage tactic and switch to Shove (absolutely worthless, that said)
        if id in self.weapons: self.weapons.remove(id)
       
        if not self.weapons:
            tactic = [x for x in self.tactics if x.name == "Engage"]
            if len(tactic) > 0:
                self.tactics.remove(tactic[0])
               
                self.tactics.append(Tactics.Shove(self))
                self.tactics.append(Tactics.Charge(self))
           
        return AI.SuperAI.LostComponent(self, id)
               
    def DebugString(self, id, string):
        if self.debug:
            if id == 0: self.debug.get("line0").setText(string)
            elif id == 1: self.debug.get("line1").setText(string)
            elif id == 2: self.debug.get("line2").setText(string)
            elif id == 3: self.debug.get("line3").setText(string)
           
AI.register(SZSpinner)



The .py in a whole works, but the spinner doesn't spins ! Any help ?


Offline Madiaba

Re: AI-ing (.py files, coding, R+D, and help)
« Reply #330 on: January 16, 2010, 11:09:05 PM »
I see a couple probs, Nar.  But please expound on all of your desired characteristics, first please.
1. SZ triggers spin?
2. _____________
3. _____________
Input is appreciated. :)
-Arrogance is a quantity devoid of quality...
-As a client once told me "This is my story, and it's sticking to me!"
-Relationships these days are like the 'Arrival' section of the airport: a lot of baggage is being revealed in one place, and not a lot of it is being correlated to its real owners...

Offline Trovaner

  • *
  • Posts: 1222
  • Rep: 32
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #331 on: January 16, 2010, 11:56:56 PM »
Right now, self.botinzone1 isn't getting changed so the bot won't spin.

Things you can do:
1. Add a SmartZoneEvent section to the bottom -- you would probably want to move the "Fire" command down, too; if you choose to do this
2. Do what was done for the "Fire" command -- the only problem with this would be that the two smartzones could interfere with each other

Offline Naryar

  • Posts: 23278
  • Rep: 20
  • hybrids oui oui
    • http://www.youtube.com/us
  • Awards BOTM Winner
    • View Profile
    • Awards
  • Skype: TheMightyNaryar
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #332 on: January 17, 2010, 03:35:19 AM »
@Mad: Yes, it's just an Omni that only spins it's spinning weapon as long as the bot is in a smartzone.

Right now, self.botinzone1 isn't getting changed so the bot won't spin.

*Slaps self in face* I thought self.botinzone1 was automatically detecting the bot but obviously it's just a constant that has to be modified...

Right, i'll try to get how SmartZoneEvent works and implement that.

Offline Madiaba

Re: AI-ing (.py files, coding, R+D, and help)
« Reply #333 on: January 17, 2010, 08:14:11 AM »
Yea, "self.botinzone1" isn't a command.  "Spin" never saw the light of day. That was one of the probs. 
But still, Nar, what is your objective as a whole? ...Or is that all?
Input is appreciated. :)
-Arrogance is a quantity devoid of quality...
-As a client once told me "This is my story, and it's sticking to me!"
-Relationships these days are like the 'Arrival' section of the airport: a lot of baggage is being revealed in one place, and not a lot of it is being correlated to its real owners...

Offline Naryar

  • Posts: 23278
  • Rep: 20
  • hybrids oui oui
    • http://www.youtube.com/us
  • Awards BOTM Winner
    • View Profile
    • Awards
  • Skype: TheMightyNaryar
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #334 on: January 17, 2010, 08:26:20 AM »
Yes, just an Omni.py supporting a spinner with a smartzone switching the spinner on/off (<= not with a switch command of course, but with an analog). Might be useful for a few jugglers and top spinners, including my last Backyard Grinder... also i think Reier's Hot Rod needs this to work.

But no, I can't figure what are you trying to make me think of and what greater purpose do you seem to see under this.

Offline JoeBlo

Re: AI-ing (.py files, coding, R+D, and help)
« Reply #335 on: January 17, 2010, 08:36:00 AM »
if you have power saving in mind why not take a look at EcoOmni ?

Offline Naryar

  • Posts: 23278
  • Rep: 20
  • hybrids oui oui
    • http://www.youtube.com/us
  • Awards BOTM Winner
    • View Profile
    • Awards
  • Skype: TheMightyNaryar
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #336 on: January 17, 2010, 08:39:43 AM »
if you have power saving in mind why not take a look at EcoOmni ?

It's not the only thing i have in mind.

Offline Madiaba

Re: AI-ing (.py files, coding, R+D, and help)
« Reply #337 on: January 17, 2010, 09:15:16 AM »
Ok. Just trying to get a 'whole picture' of things....
So yea, just add a SmartZoneEvent section that controls "Spin".  If you need help, just ask.
BTW, Really glad you're getting into the coding, Nar. Some cool stuff can be done...
 
 
 
Thanks, Trov. for helping out so much...
Input is appreciated. :)
-Arrogance is a quantity devoid of quality...
-As a client once told me "This is my story, and it's sticking to me!"
-Relationships these days are like the 'Arrival' section of the airport: a lot of baggage is being revealed in one place, and not a lot of it is being correlated to its real owners...

Offline System32

  • *
  • Posts: 4663
  • Rep: 4
  • Reality
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #338 on: January 17, 2010, 03:14:35 PM »
Recently finished AIing a batch of Bots.

And... Crash.

I can't remember what does this, I edited the bindings and AI folders, if that helps.
Put this onto your signature if you were part of this crappy fad in '03.

Offline G.K.

  • *
  • Posts: 12156
  • Rep: 10
  • Striving for a good personal text since 1994.
    • View Profile
    • Awards
Re: AI-ing (.py files, coding, R+D, and help)
« Reply #339 on: January 17, 2010, 03:19:30 PM »
Where's the crash? Startup? Did you forget teams.txt?
My above post explains everything about everything.

Host of: Wheely Tag, Back To The Beginnings, BTTB 2, BTTB 3, BTTB 4, & BTTB V.

Heavy Metal: Champion (Mockery of the Whole Concept)
Robotic International Wars Series 1: Champion (Minifridge 6)
RA2 Team Championships 1 & 2: Champion (High Speed Train & Upthrust - as part of Naryar's Not Quite Evil Council of Doom)

Runner Up in: The Amazing Rage (Team Fedex), R0B0NOVA (Zaphod Stock), Steel Warzone (Inception of Instability), Box of Nightmares (Gicquel), Wheely Tag (Minifridge the Second)

Clash Cubes IV: 5th place (Fretless)
BBEANS 6: Rumble Winner & 6th Place (Minifridge 4)