End robot moovement from signal

I am looking to create a ‘while’ loop that terminates upon the activation of a sensor. The objective is to manipulate objects whose dimensions are theoretically unknown.

The strategy here involves utilizing sensors to determine the height of the object. In the simulation, my aim is to halt the downward movement when the sensor is triggered.

However, I haven’t found a way to interrupt the movement as it appears to be synchronous. This is something quite straightforward to implement with actual robots, but in the simulation environment,

it seems to be more challenging. Is there a simple solution available, or is scripting the only option to achieve this?"
image

It sounds like you could try this:

Alright, I’ve found the solution and I’ll explain it here so that people won’t need to download any files. You start by creating a ‘while’ loop with the condition IN[port] == False.

In each iteration of the loop, move the robot incrementally in the negative z-direction, with tz = -1, from the base_1 position you have set up.

After each movement, adjust the base one level lower to ensure the loop functions correctly.

It’s important to reset the base to its original position at the end of the loop, which isn’t done in the current program. Perhaps you could implement a counter to track the movements and then reposition the base accordingly. Thanks, BAD."