I change the plane feature but the points don´t recalculate new position


I´m developing a roller application where the robot follow a path over an internal plastic sheet protection of a car door, pressing an adhesive to glue the plastic to the door.

The door moves constantly at slow speed, so the robot must recalculate points to do the same path.

To do this, I define the original feature pointing 3 points in a specific parts of the door. Then I define a temporary feature which is a copy of the original. And then I do the path saving the points over the temporary feature. In the main program I create an event when the input 1 is ON, the temporary feature copy the original feature plus an offset provided by a distance sensor conected to the analog 0. Using this method, the event is constantly changing the temporary feature each 200 ms. I can see the new values of the temporary feature in the Variables SCREEN which change every 200ms

It works and the robot can recalculate the points to follow the door. The problem is that it recalculates only once when the robot reaches the previous point read the next point. Once the next point was read and recalculated with the offset, the robot got to this point, but remember, the point moves continuously.

This method makes a big path difference if the points are separated with a long distance, and minimazed when was separated at an inch or less, because the read and recalculating the new positions are faster.

This method works but it is complicated to program and very difficult to correct points because it has a lot of them. I want know how I can do to recalculate the points constantly every 200ms during the movment, no only when was read it.

You’ll probably want to investigate the path_offset function. It can allow you to feed offsets into the robot path in real time, regardless of what waypoints the robot is going to. If done in a thread, you can do this continuously.

Another option is to use conveyor tracking with “virtual” conveyor encoder.
Conveyor tracking supports feeding encoder input through script with encoder_set_tick_count()

Using pseudocode:
MAIN thread:
move over initial point
start conveyor tracking
move through fixed waypoints
stop conveyor tracking

distance = Read analog sensor
set encoder tick count(distance)