For a rover application .....
I am modifying the 1.9 firmware to send out acceleration in global coordinates, but I am not getting satisfactory results.
My process is to perform a matrix operation by multiplying the acceleration vector (in body frame) by the DCM. This should transform the vector into the global frame.
Accel_x = AvgX*DCM_Matrix[0][0]+AvgY*DCM_Matrix[0][1]+AvgZ*DCM_Matrix[0][2];
Accel_y = AvgX*DCM_Matrix[1][0]+AvgY*DCM_Matrix[1][1]+AvgZ*DCM_Matrix[1][2];
Accel_z = AvgX*DCM_Matrix[2][0]+AvgY*DCM_Matrix[2][1]+AvgZ*DCM_Matrix[2][2];
The output does not behave correctly. If the vector was transformed into the global frame, lifting one side of the rover should only have a momentary effect. But the result is a persistent value. This make me think that gravity is still effecting the vector. As a result I think my attempt to transform the vector to global frame has failed.
Any ideas?
Replies
Hiya,
This is exactly what I'm trying to do too.
I only got my board last week so am still trailing the web for all the required information. So far I've got it up and running and am outputting a custom string of gyro motion and heading.
Next step is to get the displacement from the accelerometers. I had nievely assumed that this might be standard output and someone might have already done the hard work, but it appears not :)
Surely we can't be the first to try it...
If you find anything, I'd be very interested.
It think I can help,but I don't understand what you are trying to do. In version 2.X there are libraries to do all kinds of vector/matrix operations.
Here's how it's done now.
// multiplication by a vector
template <typename T>
Vector3<T> Matrix3<T>::operator *(const Vector3<T> &v) const
{
return Vector3<T>(a.x * v.x + a.y * v.y + a.z * v.z,
b.x * v.x + b.y * v.y + b.z * v.z,
c.x * v.x + c.y * v.y + c.z * v.z);
}
Looks like the same thing you have. It's beyond me how all that template<t> stuff works, but the math looks the same. Its just abc,xyz instead of [1][0]. It must be your math that's wrong.