Author Topic: Forklift.py: Forks won't go back down  (Read 1591 times)

Offline Resetti's Replicas

  • *
  • Posts: 4399
  • Rep: 18
  • Replica King
    • ResettisReplicas
  • Awards BOTM Winner
    • View Profile
    • Awards
  • See profile for gamer tags: Yes
Forklift.py: Forks won't go back down
« 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.

Online apanx

Re: Forklift.py: Forks won't go back down
« Reply #1 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()

Offline Resetti's Replicas

  • *
  • Posts: 4399
  • Rep: 18
  • Replica King
    • ResettisReplicas
  • Awards BOTM Winner
    • View Profile
    • Awards
  • See profile for gamer tags: Yes
Re: Forklift.py: Forks won't go back down
« Reply #2 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.

Online apanx

Re: Forklift.py: Forks won't go back down
« Reply #3 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.

Offline Resetti's Replicas

  • *
  • Posts: 4399
  • Rep: 18
  • Replica King
    • ResettisReplicas
  • Awards BOTM Winner
    • View Profile
    • Awards
  • See profile for gamer tags: Yes
Re: Forklift.py: Forks won't go back down
« Reply #4 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."

Online apanx

Re: Forklift.py: Forks won't go back down
« Reply #5 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,) }) )

Offline Resetti's Replicas

  • *
  • Posts: 4399
  • Rep: 18
  • Replica King
    • ResettisReplicas
  • Awards BOTM Winner
    • View Profile
    • Awards
  • See profile for gamer tags: Yes
Re: Forklift.py: Forks won't go back down
« Reply #6 on: August 13, 2017, 07:55:27 PM »
Do I use the the [] brackets for those?

Online apanx

Re: Forklift.py: Forks won't go back down
« Reply #7 on: August 13, 2017, 07:57:19 PM »
yeah, so if the servo/LinAcu ID is 8
you put
Code: [Select]
'LinAcus': [8]

Offline Resetti's Replicas

  • *
  • Posts: 4399
  • Rep: 18
  • Replica King
    • ResettisReplicas
  • Awards BOTM Winner
    • View Profile
    • Awards
  • See profile for gamer tags: Yes
Re: Forklift.py: Forks won't go back down
« Reply #8 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?

Online apanx

Re: Forklift.py: Forks won't go back down
« Reply #9 on: August 17, 2017, 12:14:07 PM »
Stock bot, Get it here

Offline Resetti's Replicas

  • *
  • Posts: 4399
  • Rep: 18
  • Replica King
    • ResettisReplicas
  • Awards BOTM Winner
    • View Profile
    • Awards
  • See profile for gamer tags: Yes
Re: Forklift.py: Forks won't go back down
« Reply #10 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.