Sensor orientation rage

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Sensor orientation rage

Post by timecop »

I've mentioned this before and I will mention it again.
This really needs to be fixed before next stable version.

First of all there should only be ONE PLACE where sensor orientation changes, and that's in per-board define, that is under #if defined (FREEIMUBLABHAL).

for example while there's a
#define ACC_ORIENTATION(X, Y, Z) {accADC[ROLL] = X; accADC[PITCH] = Y; accADC[YAW] = Z;}
under each board, some of the accel/gyro/etc drivers (i.e. ACC_getADC type stuff) will ALSO swap/invert axises!
This is nutty, for example in ADXL345 driver, it swaps axises around and inverts some,, but then at same time, will invert/ swap some axises again inside ACC_ORIENTATION! The same kind of junk happens for mags/gyros, and its a real clusterfuck because you expect one thing, change an axis and find out its completely different because it gets swapped somewhere else. RAGE!!

Since Alex has most/all of the sensor breakout boards, someone needs to go through and FIX all the axis stuff, and make it all changeable in ONE place! *never* change drivers axis swap or +/-, this should be done in board-specific define or system-wide define only.

Thanks!

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: Sensor orientation rage

Post by timecop »

Comeon, someone at least agree with me :)

wilco1967
Posts: 156
Joined: Thu Aug 18, 2011 6:04 pm
Location: Winterswijk, Netherlands

Re: Sensor orientation rage

Post by wilco1967 »

dongs wrote:Comeon, someone at least agree with me :)


Ok.... here you go....
Agree :lol:

I think it has been adressed in dev 20120225..... (at least partly).

As an additional note, I think, there should be some comment in the define, that explains the sensor board orientation (like 'Y arrow pointing forward', or 'soldering row to the left', or whatever makes it clear on which sensor board orientation is is intended for). Not all people fly the board in the same orientation.

I turned mine 90 degrees, so it would fit better (direct wire runs) on the sensor bob. But this requires different orientation settings.
I made my own define, which I simply copy whenever a new software version comes out.... I leave most settings in config.h default or commented out.

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: Sensor orientation rage

Post by Alexinparis »

As an additional note, I think, there should be some comment in the define, that explains the sensor board orientation (like 'Y arrow pointing forward', or 'soldering row to the left', or whatever makes it clear on which sensor board orientation is is intended for). Not all people fly the board in the same orientation.

Right,a small note for each sensor should help to understand. This explains for instance why ROLL is tied to Y and PITCH is tied to X.

User avatar
howardhb
Posts: 189
Joined: Tue Oct 11, 2011 7:10 pm
Location: Port Elizabeth, South Africa

Re: Sensor orientation rage

Post by howardhb »

The number of permutations of axis configuration is incredible, considering the number of different boards, bobs and shields!
Maybe this has been discussed before but, my question:
Is it conceivable to have a setup "wizard" in WINGUI to set-up sensor axis automatically?
It would really benefit "first time users" and non-coders....

There could be a single button in the GUI that prompts a sensor orientation setup routine, depending on which sensors are enabled in CONFIG....
The GUI would first force the user to "callibrate" sensors (accel and mag) in the usual manner, as we do already.

Then, for the Gyro...
"place copter on horizontal surface and click NEXT button"
"Rotate copter to the LEFT, then click NEXT"
"Tilt copter FORWARD (raise the tail), then click NEXT"
"Tilt copter RIGHT (raise the LEFT-HAND side), then click NEXT"
The readings from the gyro during each stage can be interpreted and then the sensors configured accordingly.
A variable, describing the gyro axis direction / orientation, could be saved in EEPROM, for use by gyro's driver.

Similar steps, with instructions, to be followed for the Mag and Accel.

Feasible?

Kevo
Posts: 2
Joined: Tue Mar 01, 2011 2:40 am

Re: Sensor orientation rage

Post by Kevo »

One issue with gyro pops to mind. at any instant .. 0 deg or 90 deg looks the same. So the measurement needs to be of the movement. Not of the resultant location. So it would be a bit more complex. Like .. click next , then move the copter in one smooth motion from level to inverted in a right roll. And then use the info measured between that and the next click. Perhaps calculating area under the curve ( Will that work ?? I dont even know ) for all of the gyro plots to see which one moved the most.

accel can be figured out with the click next .. place on side .. and so on. Thats pretty simple. There is code out there for that allready.

RocketMan
Posts: 1
Joined: Mon Jan 07, 2013 10:02 pm

Re: Sensor orientation rage

Post by RocketMan »

I'm enjoying using the excellent MultiWii hardware/software on my airplanes! However, I've been struggling with what should be a very simple thing: installing the board oriented vertically. All I would normally need to do is swap 2 of the accelerometer axes, and voila! It would work! But it doesn't! Or better yet, I would just press the Accelerometer calibrate button on the GUI, without changing any axes. Certainly, the 3-axis accelerometer provides all the information necessary to determine the orientation of the board, regardless of which way it is mounted. But this doesn't work either!

In config.h I've tried all 36 combinations of x, y, z, -x,-y and -z in the accelerometer orientation #define. None of them seem to help at all; changing them just makes things worse.

Is anyone coming up with a software fix to make sense of accelerometer axes on the MultiWii? It would be productive of great advances if we could easily manipulate the accelerometer axes.

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: Sensor orientation rage

Post by timecop »

Yea man.
What's worse, you have to recompile/reupload every fucking time to correct this.
Maybe you wanna look into "OpenAero" instead, I heard they handle board orientation with much less aids.

User avatar
Gartenflieger
Posts: 65
Joined: Sat Oct 01, 2011 10:07 pm
Location: Dortmund, Germany

Re: Sensor orientation rage

Post by Gartenflieger »

RocketMan wrote: However, I've been struggling with what should be a very simple thing: installing the board oriented vertically.


I have done just that a while ago with an EPP silhouette model. I stuck the package to the side of the model. Going by Alex's instructions for the sensor orientation it took (I think) about 3 iterations to find the orientation for a gyro-only MWC. Stabilization works like a charm, by the way.

Iteration 1: Identify X-Y-Z Axis.
Iterations 2 and 3: Identify required signs in the mixer.

However, nower days there are simpler and cheaper gyro-only stabilizers on the market. Whether you can mount those vertically I don't know.

regards
Christoph

Post Reply