In order to track the position of a robot or other vehicle using the ARToolkit, we will need to create an algorithm that creates relative coordinates for the robot based off of a known location of a stationary marker. This will allows us to create a kind of coordinate system that is independent of camera position or resolution. In order to do this, we will need to use one barcode marker (in most cases this will be number 0) fixed to a stationary location, and then reference this location in our code to get relative distances. ​ This can be achieved by adding this block of code to the end of the for loop from the previous step (Please declare xCoordRel and yCoordRel at the beginning to the mainLoop() function):

+

In order to track the position of a robot or other vehicle using the ARToolkit, we will need to create an algorithm that creates relative coordinates for the robot based off of a known location of a stationary marker. This will allows us to create a kind of coordinate system that is independent of camera position or resolution. In order to do this, we will need to use one barcode marker (in most cases this will be number 0) fixed to a stationary location, and then reference this location in our code to get relative distances. ​ This can be achieved by adding this block of code to the end of the for loop from the previous step (Please declare xCoordRel and yCoordRel ​as arrays, with the same size as xCoord and yCoord, ​at the beginning to the mainLoop() function):