Is there an IMU on board?

The more technical aspects of Spirit, and carry-over discussion from Kickstarter updates.
Posts: 74
Joined: Fri Jan 26, 2018 5:03 pm

Is there an IMU on board?

Postby gpvillamil » Sun Feb 04, 2018 11:43 pm

The Spirit overview ( references a 3-axis gyro and 3-axis accelerometer. Are those really there? Would be useful to keep the rover moving in a straight line...

User avatar
Posts: 58
Joined: Sun Jan 01, 2017 2:15 am
Location: Pasadena, CA

Re: Is there an IMU on board?

Postby esba1ley » Mon Feb 05, 2018 12:05 am

Yes... but... one usually has to remove errors from the MEMS sensors via an estimator to get the most accurate measurements. This is the technology on which I did my Masters Thesis.
Erik S. Bailey
Entry, Descent, and Landing Aerospace Engineer
Maker, and Musician
SpiritRover Kickstarter Backer #460

Posts: 74
Joined: Fri Jan 26, 2018 5:03 pm

Re: Is there an IMU on board?

Postby gpvillamil » Mon Feb 05, 2018 3:21 am

Good to know. I've done a bit of stuff with drone IMUs. I couldn't find any documentation for accessing the IMU, but I guess that will be forthcoming?

Posts: 169
Joined: Tue Jul 28, 2015 12:56 am

Re: Is there an IMU on board?

Postby Kevin » Sat Feb 10, 2018 3:08 am

There is a gyro and an accelerometer on board. Still need to get to documenting them, but here are a few notes to get you started.

These are the exact same parts as on our Ringo robot, and we use the same code. Have a look at the Ringo guide book in the navigation section. This is out dated, but will get you started.

The navigation functions written for Ringo were done by a friend a few years ago, and they have a lot of room for improvement. If you're able to understand them I sure would appreciate any help in re-writing them so they are more simple to use. The existing ones were kind of a "do everything for everyone" thing and they are very complicated to use outside of just calling them as intended. Maybe it's just because I didn't write the code but I always get all stressed when I have to do anything with those functions.

The parts used are an MMA8451Q (the accelerometer), and an L3GD20 for the gyro. The accel is placed directly over the drive axis directly in the center of the robot.

One thing to keep in mind with the accel (as you're probably already well aware), is the acceleration due to gravity is generally more than movement, so very slight tilting causes the accel to loose position quickly. There are functions to calibrate the nav sensors though, so as long as your "starting" angle where the cal is done is generally maintained, it works pretty well.

I know there is code available for these for python as well, and I have been able to read them from the Pi, but never got the software implemented beyond that point.


Posts: 74
Joined: Fri Jan 26, 2018 5:03 pm

Re: Is there an IMU on board?

Postby gpvillamil » Sat Feb 10, 2018 4:02 am


I notice that the navigation functions are in the BaseSketch, do they work exactly the same as on the Ringo? Ok I see that they differ from the documentation, GetHeading doesn't work but PresentHeading() and GetDegrees() are both present.

Also saw some interesting comments on using the IMU to correct drift while moving!

Posts: 74
Joined: Fri Jan 26, 2018 5:03 pm

Re: Is there an IMU on board?

Postby gpvillamil » Sat Feb 10, 2018 4:22 am

This doesn't seem to be working, I expect it to return a heading but instead I am just getting "Heading: 0" constantly. Tried it with PresentHeading() and GetDegrees().

Code: Select all

#include "Hardware.h"

#define inputLow 100
#define inputHigh 1000
#define outputLow 0
#define outputHigh 70

int red;
int green;
int blue;

void setup(){

  hardwareBegin();                    //initialize Spirit's Arduino processor to work with his circuitry
  SPI_Reset();                        //resets and turns on the SPI port
  playStartChirp();                   //Play startup chirp and blink eyes
  servoCenters();                     //Place all servos back in default position

  // add your own setup code here



void loop(){

  // add your own loop code here
  Serial.print("Heading: ");

} // end of loop() function

Who is online

Users browsing this forum: No registered users and 1 guest