Brainstorm: oXs as wing level indication system

Development & General Chat for the superb openxvario project.

Moderator: rainer

Post Reply
offers
Posts: 81
Joined: Tue Jan 22, 2013 4:14 pm
Country: -

Brainstorm: oXs as wing level indication system

Post by offers »

Hi

I am learning to fly precision aerobatic in F3A competitions
One of the critical issues if I like to be perfectly precise, is that the wing mast be completely leveled before each maneuver.

I am wondering if it possible to build a system that will help identify if the wing are really(!) leveled using the oXs

I understand that the oXs already support gyros.
However I will need some kind of beeping (like a variometer?) to know if the wing bank to the right or left and in what level.

Any suggestion how to build such a system?

Offer

User avatar
kalle123
Posts: 905
Joined: Sat Mar 29, 2014 10:59 am
Country: -
Location: Moenchengladbach

Re: Brainstorm: oXs as wing level indication system

Post by kalle123 »

Acc for level, not gyro is needed for that task.

KH
User avatar
Kilrah
Posts: 11107
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Brainstorm: oXs as wing level indication system

Post by Kilrah »

Combination of both is needed (well, ideally a full IMU) in dynamic flight.
Better start from a multicopter flight controller if you want to do that, actually it would most likely be plug and play if you get an FC with telemetry output.
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: Brainstorm: oXs as wing level indication system

Post by mstrens »

When a IMU (6050) is connected to oXs, oXs can transmit the Roll angle.
I presume this is exactly what you are asking.
Playing some sound should be configured (or programmed) on Tx side
offers
Posts: 81
Joined: Tue Jan 22, 2013 4:14 pm
Country: -

Re: Brainstorm: oXs as wing level indication system

Post by offers »

oXs transmitting roll angels sound like a good start!

Now how do I translate this to an efficient sound indicator?

Calling the angel each second would be annoying,
I thought about something similar to the beeping of variometer that change the beep in relation to the acceleration rate.
But start only when I am in +/- 5 degrees

Should I write something like this in a lua script?

Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: Brainstorm: oXs as wing level indication system

Post by Carbo »

offers wrote: Sun Mar 26, 2017 4:29 amI thought about something similar to the beeping of variometer that change the beep in relation to the acceleration rate.
OpenTX allows to select any sensor as vario source. Vario sound is perfect configurable in radio settings setup (pitch at zero, pitch at max) and in the telemetry page (range and behaviour near zero). IMO it should work out of the box as desired.
User avatar
Kilrah
Posts: 11107
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Brainstorm: oXs as wing level indication system

Post by Kilrah »

Or just set up a logical switch on the value and use that to trigger playback of whatever you want to play.
Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: Brainstorm: oXs as wing level indication system

Post by Carbo »

Both ways can be tested in no time. IMO the vario solution offers a nearly analog feedback. BTW the OpenTX vario implementation is far the best integrated vario available. bsongis did a great job, i am always grateful, when i hear other brands ;)
offers
Posts: 81
Joined: Tue Jan 22, 2013 4:14 pm
Country: -

Re: Brainstorm: oXs as wing level indication system

Post by offers »

I will try it.
Thank for the useful suggestions

As someone said, "other tx are good only for basic flying" :-)
offers
Posts: 81
Joined: Tue Jan 22, 2013 4:14 pm
Country: -

Re: Brainstorm: oXs as wing level indication system

Post by offers »

It possible to see the accelerometer values in the serial monitor?
Without connecting a receiver, just to verify the mpu connected ok
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: Brainstorm: oXs as wing level indication system

Post by mstrens »

offers wrote: Fri Mar 31, 2017 9:45 am It possible to see the accelerometer values in the serial monitor?
Without connecting a receiver, just to verify the mpu connected ok
Yes,
just uncomment the following line in the file oXs_config.h
//#define DISPLAY_ACC_OFFSET // used ONLY in order to display the acceleration offset on pc terminal; KEEP AS COMMENT once offsets have been setup
You will get the raw values given by accelerometers
offers
Posts: 81
Joined: Tue Jan 22, 2013 4:14 pm
Country: -

Re: Brainstorm: oXs as wing level indication system

Post by offers »

Tried it, but no display is written to the serial monitor apart from initialization logs .
No other debugging method found
User avatar
kalle123
Posts: 905
Joined: Sat Mar 29, 2014 10:59 am
Country: -
Location: Moenchengladbach

Re: Brainstorm: oXs as wing level indication system

Post by kalle123 »

Just did a short test here, works, no problem ;)

IMG_20170401_172619.jpg
1.jpg

Did you

- un-commet this line? #define USE_6050 // uncomment this line if a IMU 6050 is connected

- connect INT? Interrupt from 6050 has to be connected to Arduino pin 2 or pin 3
offers
Posts: 81
Joined: Tue Jan 22, 2013 4:14 pm
Country: -

Re: Brainstorm: oXs as wing level indication system

Post by offers »

Thanks,
It found out that I had issue with the interrupt electrical connection.

Now I can see the data running on the serial monitor.

Connecting the sport of the X8R, cause the serial monitor to stop showing the data (is it normal?), and the transmitter does not show the additional telemetry.

I connected the sport to pin 4, vcc,gnd

Any way to debug it?
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: Brainstorm: oXs as wing level indication system

Post by mstrens »

When you activate the debug function, oXs should send some data to the PC terminal and in most cases (could depend on the debug options that are activated) still handle the telemetry protocol with the Rx. If there are to many messages sent to the PC terminal, it could be that the telemetry flow is perturbed.
Can you put here (or in a private message) the oXs_config.h file that you use.
In order to check your config file, please confirm that you use the latest version on Github (version 8) and that you are have only connected a Gy-86 to the pro mini.
offers
Posts: 81
Joined: Tue Jan 22, 2013 4:14 pm
Country: -

Re: Brainstorm: oXs as wing level indication system

Post by offers »

oXs_config.h
(15.63 KiB) Downloaded 432 times
Hi
I use am using:
Arduino Uno
MPU-6050 board (the only sensor connected)
X8R FrSky receiver
Taranis Plus with openTx 2.1.8
Attach the config file
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: Brainstorm: oXs as wing level indication system

Post by mstrens »

Can you try with the config file here.
I modified some lines:
There was a pin defined for PPM signal. It was the same pin number as the pin defined for IMU6050 interrupt. I can't be. I put the line as comment because you do not use PPM function.

The line with vario was commented. Probably this is not allowed because initially IMU6050 support had been added in order to get faster reaction on the vario. So even if you do not use the vario keep it in the config.

I activated next lines in order to ask oXS to send pitch, roll and yaw (otherwise, oXs does not send those data)
#define ACCX_SOURCE PITCH // select between TEST_1, TEST_2, TEST_3, GLIDER_RATIO , SECONDS_SINCE_T0 ,AVERAGE_VSPEED_SINCE_TO , VOLT_1, VOLT_2, VOLT_3, VOLT_4, VOLT_5, VOLT_6, PITCH, ROLL , YAW, ADS_VOLT_1, ADS_VOLT_2, ADS_VOLT_3, ADS_VOLT_4
#define ACCY_SOURCE ROLL // select between TEST_1, TEST_2, TEST_3, GLIDER_RATIO , SECONDS_SINCE_T0 ,AVERAGE_VSPEED_SINCE_TO , VOLT_1, VOLT_2, VOLT_3, VOLT_4, VOLT_5, VOLT_6, PITCH, ROLL , YAW, ADS_VOLT_1, ADS_VOLT_2, ADS_VOLT_3, ADS_VOLT_4
#define ACCZ_SOURCE YAW // select between TEST_1, TEST_2, TEST_3, GLIDER_RATIO , SECONDS_SINCE_T0 ,AVERAGE_VSPEED_SINCE_TO , VOLT_1, VOLT_2, VOLT_3, VOLT_4, VOLT_5, VOLT_6, PITCH, ROLL , YAW, ADS_VOLT_1, ADS_VOLT_2, ADS_VOLT_3, ADS_VOLT_4

I put next line as comment because it is used only to get the offsets.
#define DISPLAY_ACC_OFFSET // used ONLY in order to display the acceleration offset on pc terminal; KEEP AS COMMENT once offsets have been setup

I put DEBUG line as comment.

This config expect that the pin INTA from gy-86 is connected to arduino pin 3.

Try this config and I expect it should just work fine.
Attachments
oXs_config.h
(15.62 KiB) Downloaded 270 times
offers
Posts: 81
Joined: Tue Jan 22, 2013 4:14 pm
Country: -

Re: Brainstorm: oXs as wing level indication system

Post by offers »

Hi msterns
The updated config file indeed help to get the data into the Taranis telemetry! thanks!!!!

If I can suggest some improvement for next versions

> The line with vario was commented.
> Probably this is not allowed because initially IMU6050 support had been added in order to get
> faster reaction on the vario. So even if you do not use the vario keep it in the config.
So can it be changed to:
#define VARIO_OR_GYRO // set as comment if there is no vario **and no Gyro**
#define VSPEED_SOURCE FIRST_BARO_OR_FIRST_GYRO



It is not clear that you need to change the PPM pin if you don't care about it
my suggestion is to have a main section that will globally enable/disable feature, and later, if the feature enable change specific setting

// --------- Enable / Disable features ---------
#define ENABLE_SPORT TRUE/FALSE
#define ENABLE_PPM TRUE/FALSE
#define ENABLE_VARIO TRUE/FALSE
#define ENABLE_VOLTAGE TRUE/FALSE
...

// --------- 1 - Telemetry protocol ---------
... specific setting here

// --------- 2 - Serial data pin choice ---------
... specific setting here

// --------- 3 - PPM settings ---------
... specific setting here

// --------- 4 - Vario settings ---------
... specific setting here

// --------- 6 - Voltages & Current sensor settings ---------
... specific setting here
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: Brainstorm: oXs as wing level indication system

Post by mstrens »

Fine that it works.
I will see what I can easily do.
I also think about splitting the config file in 2 parts (basic and advanced).

Did you had a look at the file oXs_config_description.h because normally every thing is explained there.
offers
Posts: 81
Joined: Tue Jan 22, 2013 4:14 pm
Country: -

Re: Brainstorm: oXs as wing level indication system

Post by offers »

This how the test setup looks like...

Image

Image


offers
Posts: 81
Joined: Tue Jan 22, 2013 4:14 pm
Country: -

Re: Brainstorm: oXs as wing level indication system

Post by offers »

Hi
what is the units that I get?
Is it possible to get them degree?
I did found a comment said: "Can calculate Roll and Pitch for attitude indicator (using a Lua script on OpenTx)"
but could note find any referece
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: Brainstorm: oXs as wing level indication system

Post by mstrens »

Internally (in oXs) roll and pitch are calculated in 1/10 of degree.
oXs send them currently in 1/10 of degree too but as they are put in the fields Acc, I expect that openTx divides the value by 100.
So could it be that you get the values in 10 of degree?
If so I could make a change in order to multiply the value by 10 before sending it.

About Lua script, did you search on google.
Here a link I found.
https://gist.github.com/xdandys/67612d119be6e0b4841e
offers
Posts: 81
Joined: Tue Jan 22, 2013 4:14 pm
Country: -

Re: Brainstorm: oXs as wing level indication system

Post by offers »

Hi
Where will be a good place in the code to put the x10 multiplayer?

I also like to add a button that calibrate the x & y to zero degree, what of the program arguments do I need to play with?

Thanks,
Offer
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: Brainstorm: oXs as wing level indication system

Post by mstrens »

In file oXs_imu.cpp you have
pitch.value = 10*atan(gravity.x / sqrt(gravity.y*gravity.y + gravity.z*gravity.z)) * radians_to_degrees; // Pitch in 1/10 of degree
roll.value = 10*atan(gravity.y / sqrt(gravity.x*gravity.x + gravity.z*gravity.z)) * radians_to_degrees; // Roll in 1/10 of degree
If you replace 10 by 100, roll and pitch will be in 1/100 of degree and so I expect that openTx will display them in degree.

I presume that if you calibrate once the offsets of the accelerometers, than results should be OK. You have for sure then to take care the the IMU device is fixed in the proper position in the airplane.
To calibrate the offsets, please follow the process given in file oXs_config_description.h
offers
Posts: 81
Joined: Tue Jan 22, 2013 4:14 pm
Country: -

Re: Brainstorm: oXs as wing level indication system

Post by offers »

Hi
I installed the system on a small f3a plane (sebart wind s 50)
And here are the conclusion,
The barometer system that connected now to the gyro, gives very identify able sound
I can config it to fine tune the level of warning i like to get when the wings are not level
With different sound when they bank to the right or to the left

However the oxs work only on level flight!
When starting a loop (large one) it looks like the additional G force affect the measurements
Any idea why??

Offer
offers
Posts: 81
Joined: Tue Jan 22, 2013 4:14 pm
Country: -

Re: Brainstorm: oXs as wing level indication system

Post by offers »

Any Idea if this can be fixed?
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: Brainstorm: oXs as wing level indication system

Post by mstrens »

the 6050 is running his own code in order to provide the 3D orientation of the sensor.
This code uses as well the gyro as the accelerometer informations.
Gyros are good for quick changes but are known to drift over time.
Accelerometers data are then used to realign the position. In order to achieve this, it assumes that over a long term (some seconds?) the sum of all accelerations is just equal to gravity. Probably that when you make a large loop, this assumption is false due to centrifugal force.

I do not have access to the internal code of the mpu 6050 so I can't change it.

Note: I am still surprised of your issue because I do not understand why a loop would have an impact on the roll. I would expect an impact on pitch and yaw.
Just to be sure: did you calibrate the Acc offsets as explained in the description of oXs? If not, try to do it; this could perhaps help.
offers
Posts: 81
Joined: Tue Jan 22, 2013 4:14 pm
Country: -

Re: Brainstorm: oXs as wing level indication system

Post by offers »

I will try to re-calibrate an see what happen.

Next week I have competition, so I will not have the time, I will test it the week after.

Thanks

Post Reply

Return to “OpenXVario - an open source vario supported by the open source firmwares!!”