Hello, we are trying to use a Pixy2 on a robot to find a line ahead of the robot, drive to it, and then turn to follow it. We have it setup our Pixy2 to be on the robot about 6.5" off the ground, and can see a white line on the floor about 18" in front of the robot. From the returned vector, we are hoping to calculate the distance from the robot’s current location to the nearest end of the vector, assuming the 78×51 grid the Pixy2 returns found vectors in.
Our first question is, what is the point on the grid of coordinates that the pixy uses to track vectors where the actual pixy camera is sitting. Is it (0,0), or (0,39), or somewhere else?
We are getting data back, but having trouble calculating the distance to the end of the vector as the Pixy2 gets further away from the end of the vector. Since the Pixy2 is facing down at a 45 degree angle from 6.5 inches above the floor, we are assuming there is something wrong in our math for that distance as it gets further away.
Does anyone have a good way to calculate this distance to a line/vector found out ahead of the Pixy2 in this situation?