Skip to content

A Raspberry Pi Pico RP2040 library compatible with the pico-sdk, designed to use the PAA5160E1 odom sensor from SparkFun

License

Notifications You must be signed in to change notification settings

robotcopper/PAA5160E1_Pico_Library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PAA5160E1 Raspberry Pi Pico RP2040 Library

This library is a refactoring of SparkFun_Qwiic_OTOS_Arduino_Library to make the SparkFun Optical Tracking Odometry Sensor - PAA5160E1 (Qwiic) compatible with the Raspberry Pi Pico RP2040 SDK.

Description

This library was designed to work in I2C with the PAA5160E1. By default the i2c0 and the GP4 and GP5 are used in this project.

Raspberry Pi Pico and PAA5160E1

Raspberry Pi Pico connected using I2C to the PAA5160E1 - Schematic created with Fritzing

Motivation

By not using Arduino but rather the Raspberry Pi Pico SDK, I set out to port the Arduino library from SparkFun.

Project Structure

The project is structured as follows:

Qwiic_OTOS_Library
├── assets
├── CMakeLists.txt
├── include
│   ├── QwiicOtos.h
│   ├── sfeQwiicOtos.h
│   └── utils.h
├── LICENSE
├── README.md
└── src
    ├── sfeQwiicOtos.cpp
    └── utils.cpp

The specification of Raspberry Pi Pico pins used for I2C, with I2C0 being the default, and the ability to set the I2C baud rate, are defined in utils.h:

Qwiic_OTOS_Library
└── include
    └── utils.h

Requirements

Installation

To use this library, clone the repository into your Raspberry Pi Pico RP2040 project directory:

git clone https://github.com/robotcopper/PAA5160E1_Pico_Library.git

Then include it in your project's CMakeLists.txt file:

add_subdirectory(
	Qwiic_OTOS_Library
)

target_link_libraries(main
    Qwiic_OTOS_Library
)

Usage

Here's a simple example demonstrating how to use the library to initialize the sensor and read odom data:

#include "QwiicOtos.h"

initI2C(false);
// Calibrate the IMU, which removes the accelerometer and gyroscope offsets
myOtos.calibrateImu();
// Set the desired units meters for linear, and radians for angular.
myOtos.setLinearUnit(kSfeOtosLinearUnitMeters);
myOtos.setAngularUnit(kSfeOtosAngularUnitRadians);
// Reset the tracking algorithm - this resets the position to the origin,
// but can also be used to recover from some rare tracking errors
myOtos.resetTracking();

while (true) {

    sfe_otos_pose2d_t pos;
    myOtos.getPosition(pos);

    printf("x: %.2f m, y: %.2f m, h: %.2f rad \n", pos.x, pos.y, pos.h);

}

Credits and Contributions

Original Developer:

   SparkFun :
     Links :

License

The modifications made to SparkFun's work are licensed under the BSD 3-Clause License.

About

A Raspberry Pi Pico RP2040 library compatible with the pico-sdk, designed to use the PAA5160E1 odom sensor from SparkFun

Topics

Resources

License

Stars

Watchers

Forks