GAPTER: Ball Tracking


In this tutorial you will learn how to:

  • run ball tracking code with gapter

For any query, please feel free to post your questions in the Gaitech EDU Forum


Get ball tracking code

Download the ball tracking code from Github

Run the code

After running the Gapter Simulator, in a new terminal run following command:

$ python

You will see the following screen:


It will run with default camera of computer, can be easily changed for other camera. If ball is green press ‘c’ on image window, or place the ball inside the rectanglar region and press ‘a’, press ‘n’ to re-calibrate and space-bar for pause, ‘q’ for quiting. If you have a green ball, you can hold it in as in the following screen:


After presing ‘c’, another window with a mask will appear:


Now in a new terminal run:

$ python

You can now move the ball, and see your Gapter following it. You can use rqt_plot to visualize current position using following command:

$  rqt_plot /mavros/setpoint_velocity/cmd_vel/twist/linear/x:y:z