I have a project that I'm working on that needs data about which directions something has moved and how quickly from a given point (accelerometer and magnetometer?). I have the working python code for the BNO055, I'm just having trouble interpreting it. I guess these are my specific questions:

  • Is the data from a starting point (doesn't seem likely) or a set time period that continues? If so, what is that time interval? Do I define it by how often I ask for the data?
  • Is magnetometer and accelerometer data what I should be using for my task?
  • What is a rough pseudocode outline for how I could convert this data into something easier to understand (i.e. an updating distance or x,y,[z] coord system)
  • $\begingroup$ Whose code are you using? I think knowing that will change the answer. For example, Adafruit's code for their dev board can output multiple types of information: learn.adafruit.com/adafruit-bno055-absolute-orientation-sensor/… . As far as a mag/accel being the right combination of sensors for your task, it depends on what "something" is and how much accuracy you're looking for over what time scale. $\endgroup$ – Steve Feb 12 '17 at 22:34
  • $\begingroup$ I'm using a modified version off that code (same output, just to work on a different platform). Something is a hexapod robot and I'm planning on building a reinforcement learning algorithm to teach it how to walk, but need certain data to assess whether or not it has gotten to a certain point. $\endgroup$ – traw1234 Feb 14 '17 at 1:28

So, it sounds like you're trying to get rough odometry of a hexapod using a accelerometer and magnetometer. You are right to be choosing a sensor to get lateral and angular accelerations, but I think the magnetometer is not as good of a choice as a MEMS gyroscope, which should be about the same price but not affected by magnetic fields. In my experience, the environment indoors is not a terribly friendly one for magnetometers, as there are a lot of pieces of metal around, and even less friendly when you're near a source of stray electromagnetic fields (like near motors). That answers your second question, I think.

For the first question, according to the API I sent and you confirmed, the data that comes to you from the sensor is some form of the instantaneous acceleration and magnetic field "felt by" the sensor when you read it.

As far as your third question, there's no simple answer, but I'd refer you to this question: https://stackoverflow.com/questions/26476467/calculating-displacement-using-accelerometer-and-gyroscope-mpu6050 .

  • $\begingroup$ That is definitely what I was looking for. I noticed the error racked up very quickly when trying to implement distance from the accelerometer. Do you have any other suggestions/options for distance traveled calculations? Also, would it make any difference that the BNO055 has built in sensor fusion? $\endgroup$ – traw1234 Feb 17 '17 at 16:46
  • $\begingroup$ I'm sorry I don't have much experience with legged robots; I take decent odometry for granted! Maybe you can use some sort of point rangefinder to keep track of movement relative to static objects in the environment? Unfortunately, just integrating accelerations is going to drift over time without some way to close the loop. $\endgroup$ – Steve Mar 2 '17 at 2:49

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.