Calibrating Your Odometry Sensor

Pages
Favorited Favorite 1

Software Setup

Arduino

Attention: If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE. If you have not previously installed an Arduino library, please check out our installation guide.

We've written a library to get you started with the SparkFun Optical Tracking Odometry Sensor. You can obtain this library through the Arduino Library Manager by searching for "SparkFun Qwiic OTOS Arduino Library" and installing the latest version from SparkFun. If you prefer downloading libraries manually, you can grab them from the GitHub Repository.

Python

Attention: If this is your first time working with Python, there are quite a few useful tutorials on getting started. The Python Programming Section of our Getting Started with the Raspberry Pi Tutorial has some good basic information and resources for getting started with Python.

In addition to the library provided above, we have written a Python script that allows you to visualize an XRP in real time. Download via the button below.

Linux/Raspberry Pi Variants

We've written a python package to get you started with the SparkFun Optical Tracking Odometry Sensor. It's been included in the SparkFun Qwiic Python package, which aggregates all Python Qwiic drivers/modules to provide a single entity for Qwiic within a Python environment. The Qwiic_Py GitHub Library ReadMe has more information on the Qwiic Python package.

If you already have your Qwiic Python package installed, you can update it with the following command:

pip install --upgrade sparkfun-qwiic

If you don't have the Qwiic Python package installed already, you can install it with the following command:

pip install sparkfun-qwiic

If you prefer to install just this package, use the following command:

pip install sparkfun-qwiic-otos

If you prefer downloading the code to build and install the package manually, you can grab them from the GitHub Repository.

Attention:

If you are working with a Raspberry Pi and are using the new Bookworm distribution of the Raspberry Pi OS, refer to these instructions to setup a virtual environment.

Make sure to include the --system-site-packages flag:python3 -m venv --system-site-packages

Then it is possible to install the packages using pip.


XRP/MicroControllers

If you are working with the XRP or other microcontroller, pip will not work for you. Instead, you'll need to install the Qwiic_I2C_Py driver as well as the Qwiic_OTOS driver.

Attention: These instructions are written for the XRP using the XRPCode IDE. However the setup process is very similar for MicroPython and CircuitPython on any other board, so you should be able to follow along with these instructions using your IDE of choice!
Install Qwiic_OTOS_Py

Qwiic_I2C_Py is a generic I2C driver we have created to work on various platforms (such as MicroPython). Our Qwiic Python device drivers take advantage of Qwiic_I2C_Py to function correctly on any of the supported platforms, so it is a required dependency to use our OTOS Python driver.

Fist, go to the Qwiic_I2C_Py repository and download it as a .zip file. Once downloaded, extract the qwiic_i2c folder within.

Connect your XRP to your computer over USB, navigate to the XRPCode IDE, and connect to your XRP. For usage information, see the XRPCode User Guide.

Create a new folder within the lib directory (right-click on the folder), and name it qwiic_i2c.

Create a new folder in the lib directory

Create a new folder in the lib directory

Name the folder qwiic_i2c

Name the folder qwiic_i2c

Upload the files from the previously extracted qwiic_i2c folder into the new folder you just created on the XRP. From the File menu, choose the Upload to XRP option:

Choose the Upload to XRP option

Choose the "Upload to XRP" option

Then select the extracted files:

Select the extracted I2C Files

Select the extracted I2C Files

Then choose the newly created qwiic_i2c folder on the XRP:

Choose the newly created qwiic_i2c folder

Choose the newly created qwiic_i2c folder

Uploading...

Update in Progress

Update in Progress

You can test to confirm correct installation by typing import qwiic_i2c followed by qwiic_i2c.get_i2c_driver().scan() in the Shell. If no errors are printed, then the Qwiic_I2C_Py driver has been installed correctly!

Testing the I2C install

Testing the install

Install Qwiic_OTOS_Py

Fist, go to the Qwiic_OTOS_Py repository and download just the qwiic_otos.py file.

Connect your XRP to your computer over USB, navigate to the XRPCode editor, and connect to your XRP. For usage information, see the XRPCode User Guide.

Upload the qwiic_otos.py file into the lib folder on the XRP. From the File menu, choose the Upload to XRP option:

Select the Upload to XRP Option from the File Menu

Select the "Upload to XRP" Option from the File Menu

Select the qwiic_otos.py file:

Select the qwiic_otos.py file

Select the qwiic_otos.py file

Then select the lib folder on the XRP:

Select the lib folder on the XRP

Select the lib folder on the XRP

Updating...

Updating

Updating

You can test to confirm correct installation by typing import qwiic_otos followed by qwiic_otos.QwiicOTOS().is_connected() in the Shell. If no errors are printed, then the Qwiic_OTOS_Py driver has been installed correctly!

Testing the install:

Testing the install

Testing the install

Visualization

In addition to the package provided here, we have written a Python script that allows you to visualize the XRP in real time. Download via the button below.

Visualization Script in Action

Visualization Script in Action