I’m wanting to obtain the real time orientation of an object. How do I obtain this?
Currently I have the Wifi Uno Rev 2 with the LSM6DS3TR IMU. Though I can obtain other equipment if needed.
I’m wanting to obtain the real time orientation of an object. How do I obtain this?
Currently I have the Wifi Uno Rev 2 with the LSM6DS3TR IMU. Though I can obtain other equipment if needed.
Cool!
Couple of quick questions.
What is the object that we are tracking?
Will the object be stationary in space while it’s rotating or is carried around?
Does the object have room on the inside which could house the LSM6DS3TR IMU?
Hi Mitchell,
Another couple of questions.
What do you mean by real-time orientation? Is it just the angle that the object is being held at or also a distance from where it was picked up?
A bit more general information about your project will help a ton!
Liam
Thanks Mixmusix
The thigh of a person while walking, so the object will move in space as well as rotating. The IMU would be on the persons thigh so not technically inside
Just the angle will be sufficient. I want to assess the orientation of someone’s thigh in real time (flexion/extension, abduction/adduction, internal rotation/external rotation.
Have a look at this library by adafruit that interfaces between the arduino and the lsm6ds3trc
/* UNTESTED CODE!!!
THIS CODE IS INCOMPLETE AND FOR INSTRUCTIONAL PURPOSES ONLY */
struct GVec {
float x;
float y;
float z;
float dist(GVec v) {
float dx = x - v.x;
float dy = y - v.y;
float dz = z - v.z;
return (float) Math.sqrt(dx*dx + dy*dy + dz*dz);
}
}
//Init a global vector.
GVec cacheVector;
/* SETUP REQUIRED! See Library Documentation */
void setup{// CODE GOES HERE!}
void loop() {
// Get a new normalized sensor event
sensors_event_t accel;
sensors_event_t gyro;
sensors_event_t temp;
lsm6ds3trc.getEvent(&accel, &gyro, &temp);
/* Calculate the distance traveled form last loop in radians */
GVec vzero;
vzero.x = gyro.gyro.x;
vzero.y = gyro.gyro.y;
vzero.z = gyro.gyro.z;
Serial.println(vzero.dist(cacheVector));
cacheVector = vzero;
delay(1000);
}
Hi Mitchell,
An IMU seems like the intuitive answer but a poteniometer is also an option: Core Electronics on Instagram: "We caught Liam trying to turn himself into a cyborg after playing too much Cyberpunk 2077. Only a few pots, a Pico and some Feetech servos and he's already claiming he can talk to the toaster. Head the link in bio to grab yourself some servos and get in on the craze."
There is definitely a scale of accuracy and timelyness when using an IMU, the method PIx used is very fast to compute but doesnt account for gyro drift.
Using the accelerometer is also fast but cannot easily reject fast movements or vibrations.
Sensor fusion through the use of a Kalman filter will be a bit slower to compute (still close enough to real time for the movements of a human) and help with the issues above.
Liam
Ooooo yeah good point.
Hi Mitchell
Maybe I’m missing something here, but if you want the orientation of an object in real time without drift error then a 3D magnetometer sensor would seem to be the most appropriate. Core sell various magnetometers, some with onboard accelerometers, gyroscopes and onboard processing included.
Richard
Here’s an example of an IMU that does the fusion itself and has a visualiser.
I’ve linked our store page and Adafruit’s page. There is a comprehensive setup guide in there for a few different processors.
How do I apply the Kalman Filter in the code. What would be an estimate of the delay using the Kalman Filter?
Great, thanks. An IMU that does the fusion itself will be the best option.
There are some discussion posts about drift over time causing significantly inaccurate measures with this sensor. Are there other options that are more accurate?
There will always be some element of drift that creeps into sensors. Long term the goal is to minimise it.
Some things to consider, in no particular order, would be:
Another thing to consider is if you are tracking movement long enough for drift to be an issue. This is where testing is needed.
I am pretty sure I have given you some more questions than answers here but hopefully this helps.