Unexpected behavior with "Iterate" component

NodeCanvas Forums General Discussion Unexpected behavior with "Iterate" component

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #11795
    ehrlichmann
    Participant

    Good afternoon.

    I’ve been working on a behaviour for a user to scan a scene, find available tables and head for the closer one. I’ve got it working when I set the available tables on design time, but if I change the status of the table on runtime, the BT will fail. I’ve debugged it on runtime and found out that the problem was that the “Iterate” component was scanning only the last item on the list that was passed, even if I reset the index (see attached image).

    My logic says there’s something wrong with that iterator, but I would like for you to confirm to me if I’m approaching it wrong or there is actually something bad with the component.

    Note: the “wait” actions that are there, were placed for debug purposes only. That’s how i managed to see what was happening.

    Thank you in advance for your help.

    Best regards.

    Attachments:
    You must be logged in to view attached files.
    #11801
    Gavalakis
    Keymaster

    Hello and sorry for the late reply.
    I tried replicating the problem you are facing, but I can’t really do so. :/
    Once thing you might want to check, would be to ensure that your nodes are executed in the correct order. Looking in the image your posted maybe the nodes in your original graph are not executed in the order you expect them to. The order is automatically adjusted based on the child node positions from left to right. Please always check the connection line to confirm the order they execute.

    Another thing worth noting here, is that you don’t really need the “Optional” decorator bellow the Iterator if you haven’t set a “Termination Condition” on the Iterator, which seems to be the case at least in this image 🙂

    If the issue persists and is possible for you, please send me a small test reproduction project to check things to support_AT_paradoxnotion.com
    Let me know.
    Thanks!

    Join us on Discord: https://discord.gg/97q2Rjh

    #11809
    ehrlichmann
    Participant

    Hello.

    Thanks for your reply. I managed to solve the issue last week. You see, the iterator was working fine if i ran it just once, however, i was runing it inside a repeater. For some odd reason whenever the sequence started again, the iterator would not start from the begining of the list but from the end, giving me the issue i reported.

    I solved it by adding this line:

    currentIndex = 0;

    into the source code into the line 74 (see image), and it seemed to solve the issue without affecting the functioning of the iterator node.

    I’ll let you know if something else comes up, but so far, so good.

    Thanks for your help.

    Regards.

    PS: added a second image where i show you how the BT ended up after a revision.

    Attachments:
    You must be logged in to view attached files.
    #11815
    Gavalakis
    Keymaster

    Hey,
    Thanks. I will check this out and implement your fix after confirming the rest of functionality is working correctly.
    You BT looks nice and clean by the way. I am always glad to see such well organized BTs 🙂

    Cheers!

    Join us on Discord: https://discord.gg/97q2Rjh

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.