gametechmods

Robot Arena => General Support => Topic started by: Resetti's Replicas on August 12, 2017, 10:06:02 PM

Title: Forklift.py: Forks won't go back down
Post by: Resetti's Replicas on August 12, 2017, 10:06:02 PM
So I've been trying to AI a forklift-weapon bot using the Forklift.py (https://github.com/apanx/RA2_AI/blob/master/Forklift.py) but my bot won't drop the forks after the first time it raises them.  I've tried setting linacuslength to various things with no success.  'm unsing the Medium2" length DSL servo piston.  Any help is greatly appreciated.
Title: Re: Forklift.py: Forks won't go back down
Post by: apanx on August 13, 2017, 10:18:00 AM
Enable debug mode, tell me then what the forklift part is trying to do.
Code: [Select]
class SuperAI(plus.AI):
    "Python base class of the C++ AI."
    name = "No Name"

    debugging = True #plus.isDebugMode()
Title: Re: Forklift.py: Forks won't go back down
Post by: Resetti's Replicas on August 13, 2017, 11:49:31 AM
Sorry, can you talk me through how to enter debug mode and use that?  I'm not much of a coder.
Title: Re: Forklift.py: Forks won't go back down
Post by: apanx on August 13, 2017, 07:00:54 PM
Open __init__.py in AI and change the lines in the SuperAI class as shown in the last post. You should now get a debugwindow at the left upper side of the screen when running AI'd bots. You can check what the Forklift AI is trying to do, i.e lifting, or lowering forklift.
Title: Re: Forklift.py: Forks won't go back down
Post by: Resetti's Replicas on August 13, 2017, 07:41:33 PM
It says "Lift" whenever a bot touches its smartzone, and "Stop" when there isn't, and it doesn't lower the forks again.  If I touch it again after the forks have been raised, it says "Lift."
(https://gametechmods.com/uploads/images/61360indef.png)
Title: Re: Forklift.py: Forks won't go back down
Post by: apanx on August 13, 2017, 07:48:14 PM
Did you put in ID for the servo pistons, LinAcus to control?
Like this:
Code: [Select]
list.append( ("ForkliftDemo", "Forklift", {  'LinAcus': [1], 'LinAcusLength': [-0.6],'weapons': (2,) }) )
Title: Re: Forklift.py: Forks won't go back down
Post by: Resetti's Replicas on August 13, 2017, 07:55:27 PM
Do I use the the [] brackets for those?
Title: Re: Forklift.py: Forks won't go back down
Post by: apanx on August 13, 2017, 07:57:19 PM
yeah, so if the servo/LinAcu ID is 8
you put
Code: [Select]
'LinAcus': [8]
Title: Re: Forklift.py: Forks won't go back down
Post by: Resetti's Replicas on August 13, 2017, 08:22:27 PM
Ok, now it says "Descend" but it still stays up.  I've tried several 'LinAcusLength' settings, positive and negative.  Am I supposed to wire it with a "Descend" button?  I was using one analog control for it.

If it's not too much trouble, could I have the test-bot you made that has a working forklift?
Title: Re: Forklift.py: Forks won't go back down
Post by: apanx on August 17, 2017, 12:14:07 PM
Stock bot, Get it here (https://gametechmods.com/forums/index.php?action=downloads;sa=view;down=376)
Title: Re: Forklift.py: Forks won't go back down
Post by: Resetti's Replicas on October 12, 2017, 08:45:30 AM
Thanks for the help apanx, I've pinpointed what i was doing wrong.  Specifically, the robot has to be in the smarzone area in order for the forks to drop - I had thought it worked like the crusher AI where it automatically releases when there's nothing in the smart zone.