Handling of Groups

Hi, just encountering the challenge that we would like to do “FOR all [dill] {water}; FOR all [dill] {poke_hole}” but the best we could achieve was "FOR all [dill] {water; poke_hole}. Any suggestions how to do this?

@jensGeorgsen It sounds like you want to minimize movement by performing two actions in one spot instead of doing two trips around the garden. Am I understanding correctly?

If that’s the case, you can accomplish this goal via the use of a “wrapper” sequence:

Create 4 sequences:

  • One for watering
  • One for poking
  • One for combining the poke + water movement
  • One for iterating the Poke+Water combination across all dill plants.

image


Is this what you were trying to accomplish? Please let me know if not.

1 Like

It was actually the exact opposite I was trying to do. I wanted to have the watering done first and then (when the water has gone to the ground) start poking holes for all plants. I would like to call this for any group I select.

I tried doing one sequence for watering, one for poking - with external variables for each. Then I did a superior sequence with external variable (to be able to select the group). This sequence calls first watering, then poking but it turned out that the bot would do: “water, poke, water, poke, water, poke…” instead of “water, water, water… poke, poke, poke”.

@jensGeorgsen Are you trying to do something like this then?

Can you try the example above and let me know if it works for you? Again, apologies if I am misunderstanding. I think I understand your use case better now, but please let me know if not.

Hi @RickCarlino, the example you are showing is very similar to what I have tried. Just to make it more flexible, I used an external variable for the “All Dill Plants” and called the sequence from outside. If you say it should work this way, (meaning it should first water all, then poke all) I can define try it again and document the result. What do you think?

@jensGeorgsen OK, I see what happened now.

Something to remember when you pass a “parent” group down to a “child” location is that the location will always and immediately be deconstructed into a single location.

If you pass a group from a parent to a child, the child will only receive one location at a time. It will not receive the entire group. You cannot pass a group down twice. There are a lot of reasons why this is, but based on your description, it sounds like the system is working as intended. Please let me know if you require further assistance.

In this sense, it is better to think of groups in the same way that a “range” is used in a spreadsheet, rather than how arrays are used in traditional programming languages.

Below is some pseudocode to illustrate the issue. We start with a group and some sequences:

all_dill_plants = [dill1, dill2, dill3];
poke_hole = function(plant) { /* ... */ };
water = function(plant) { /* ... */ };

In my example, I called:

// STEP ONE
water(all_dill_plants)

// STEP TWO
poke_hole(all_dill_plants)

The sequence runner deconstructs this as:

// STEP ONE
water(dill1)
water(dill2)
water(dill3)

// STEP TWO
poke_hole(dill1)
poke_hole(dill2)
poke_hole(dill3)

Thanks for the detailed explanations, @RickCarlino, I think I understand now how the system works.

Our presented case, however, seems to me like a common application: We define different kind of activities (like watering and poking in our example) and would like to put them in a certain sequence. Sometimes it makes sense to have them executed directly one after the other or like in our case we do first one activity for all plants and then the other. Other examples for our application might be that you use one tool for all selected plants and then another tool.

How would you solve our case with the webApp?

@jensGeorgsen We don’t support the use of multiple variables yet, but that is the long term solution to the problem you are presenting. The short term solution is to use a wrapper sequence that explicitly uses the specific tool. If you have such a use case in mind but can’t find a way to do it, let me know and I can take a look. Because of the single variable restriction in the UI, it will be slightly repetitive but it is still entirely possible.

Thanks, @RickCarlino, I’ll revert to you if necessary.