Search code examples
blockvuforiarobotics

FTC Robotics Block Program (VuForia loop runs once then if statements stop working?)


I am on an FTC Robotics team and we are using FTC blocks to program our robot. I have used a sample project for VuForia to be able to see the images on the walls of the field. I am trying to get the robot to move forward until it sees that the Y position is greater than 50 (it goes up the closer it gets to the wall)

What happens is it seems to run through the if statements once, turn on the motors, then never check if it is closer than 50 so it never shuts off. I have tried putting it in some loops, it's own separate function, etc. The odd part about this is that it runs everything else in the loop to update the positions and telemetry so it should be running the if blocks as well.

I have attached an image of my blocks below if anyone could help me figure this out that would be much appreciated.

~Stone

Complete Blocks Program

(The if statement that I am referring to is in the middle function (Process), it is under if TargetName is equal to RedWall.)


Solution

  • So after banging my head against a wall for 3 days, I have finally figured out my problem. I was looking at the values for my current coordinates and telling the robot to move forward until it gets to a distance of 50. The values the phones were returning however were negative and increased as I got further away. This means that to get to 50 the robot would have had to get further away, not closer in order for the if statement to stop it from moving.