USB HID Joystick & PPM-In program

More
27 Apr 2013 05:21 #9263 by PhracturedBlue
Replied by PhracturedBlue on topic USB HID Joystick & PPM-In program
of course it would. but then I need to add a scrollbar and more complicated page code. I didn't think it was worth it.
Or did you mean have 1-4 in col1, and 5-8 in col 2? That would be quite easy.

Please Log in or Create an account to join the conversation.

More
27 Apr 2013 05:29 - 27 Apr 2013 05:30 #9265 by vlad_vy
Replied by vlad_vy on topic USB HID Joystick & PPM-In program
Yes, 1-4 in column 1, and 5-8 in column 2.
Last edit: 27 Apr 2013 05:30 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
07 May 2013 14:36 - 07 May 2013 19:43 #9672 by Wene001
Replied by Wene001 on topic USB HID Joystick & PPM-In program
PPM in doesn´t work for me on Devo12s
Any idea?

Edit: also not working with my devo 6s ?!?

do i miss something

i created a model 8 channel ppm out on slave (devo6s or dx8)

on devo12s i created a model 8 channel devo protocol activated ppm Input and assigned ppm1-4 to channels 5-8

do i overlook something?
All ppm is set to 1500/400

Deviation release 1556052181fb

i have also tested the other way (devo12s als slave and devo6 as master)

also Trainer mode is not working for me
Last edit: 07 May 2013 19:43 by Wene001.

Please Log in or Create an account to join the conversation.

More
08 May 2013 03:48 #9691 by PhracturedBlue
Replied by PhracturedBlue on topic USB HID Joystick & PPM-In program
I just tested my devo12 connected to the devo10 as slave.
There is definitely a bug.
Devo10 on and transmitting ppm.
devo12 set ppmIn to train, set switch to trn1, go to 'Channel monitor' page. push Train switch, control switches to the devo10. release train switch, control comes back. power-cycle devo10 and train switch still works. Power cycle devo12 and train switch no longer works. Only way to get it working again is to turn PPMIn off and then back on. I'll need to debug further

Please Log in or Create an account to join the conversation.

More
08 May 2013 05:46 - 08 May 2013 05:53 #9698 by Wene001
Replied by Wene001 on topic USB HID Joystick & PPM-In program
started again with two default models and now it works as you described.
if i use the train option i cant see anything on the bars on main screen.
only on the monitor page of the mixer.

thanks for programming this cool feature

for me it would be more intuitiv to have the channels 1-4 in the left column on trainer config page. and channels 5-7 on the right side.

on the ppm out page i would prefer displayed 1500 ms as standard for the complete pulse (high and low)
Last edit: 08 May 2013 05:53 by Wene001.

Please Log in or Create an account to join the conversation.

More
08 May 2013 11:29 #9704 by wuselfuzz
Replied by wuselfuzz on topic USB HID Joystick & PPM-In program
common_devo/ppmin.c:152
    t = (t1>=t0) ? (t1-t0) : (65536+t1-t0);     // none-stop TIM1 counter, compute ppm-signal width (2MHz = 0.5uSecond)

With both t1 and t0 being u16, this can be simplified to
   t = t1-t0;

Adding 65536 to an u16 does absolutely nothing.

Please Log in or Create an account to join the conversation.

  • rbe2012
  • rbe2012's Avatar
  • Offline
  • So much to do, so little time...
More
08 May 2013 13:52 - 08 May 2013 13:53 #9705 by rbe2012
Replied by rbe2012 on topic USB HID Joystick & PPM-In program
As far as I have understood it is a matter of what the compiler does internally. Subtracting unsigned values can have a result < 0 which can not be put in a u16 variable. And 65536+t1 is always > t0.
Maybe something like "t=(u16)(t1-t0);" might be universal...
Last edit: 08 May 2013 13:53 by rbe2012.

Please Log in or Create an account to join the conversation.

More
08 May 2013 16:18 - 08 May 2013 16:28 #9709 by PhracturedBlue
Replied by PhracturedBlue on topic USB HID Joystick & PPM-In program
I didn't write the calculation code, so I'll need to go back over it. But my guess is that the issue is related to how we detect a sync which is what enables PPMin.

You should see the values on the main page if you set the box to show 'Ch3' as opposed to showing 'Thr'. The difference is the input vs output value.

I already added a ticket to fix the display order on the ppmin page.

As far as the ppmout page goes, I agree it would be better if we were consistent, but there is a need for the extra 'notch' setting and needing to subtract it may be just as confusing. I'm certainly open to opinions on this though

Edit: I just fixed the ppmin train channel mapping order
Last edit: 08 May 2013 16:28 by PhracturedBlue.

Please Log in or Create an account to join the conversation.

More
08 May 2013 16:45 #9710 by PhracturedBlue
Replied by PhracturedBlue on topic USB HID Joystick & PPM-In program

wuselfuzz wrote: common_devo/ppmin.c:152

    t = (t1>=t0) ? (t1-t0) : (65536+t1-t0);     // none-stop TIM1 counter, compute ppm-signal width (2MHz = 0.5uSecond)

With both t1 and t0 being u16, this can be simplified to
   t = t1-t0;

Adding 65536 to an u16 does absolutely nothing.

You're right, it doesn't but it makes it clearer whatthe logic does. Actually I'm not sure why 't' is 16bits here. Doing math with 16bits is slower than with 32bits, and there would be no question of the results with a 32bit value here. t0 could still be 16bit to save 2bytes of ram, since the final value of t is guaranteed to fit in a 16bit value. The end result is the same though.

The problem with not working on reboot seems to be that I never call PPMin_Start() after loading a new model.
I think it is as easy as calling PPMinStop when resetting a model, and PPMinStart() at the end of loading a model (assuming the proper conditions are met)

I'm not in front of my Tx at the moment, so I can't test it though.

Please Log in or Create an account to join the conversation.

More
08 May 2013 18:25 - 08 May 2013 18:40 #9713 by wuselfuzz
Replied by wuselfuzz on topic USB HID Joystick & PPM-In program

rbe2012 wrote: As far as I have understood it is a matter of what the compiler does internally. Subtracting unsigned values can have a result < 0 which can not be put in a u16 variable. And 65536+t1 is always > t0.
Maybe something like "t=(u16)(t1-t0);" might be universal...


Integer promotion might happen (which is what happens internally, and is actually specified in the ANSI standard), but then, the additional bits are still discarded after the assignment to t.

About the actual bug, when the slave is switched off, the master might not desync properly, since no interrupts happen at all.

/edit: After thinking about that a bit longer, that shouldn't really happen, only in the rare case that there's a timer overflow at the wrong time. And then the desync would be detected in the next round.

/edit2: Should read everything before posting...
Last edit: 08 May 2013 18:40 by wuselfuzz.

Please Log in or Create an account to join the conversation.

More
08 May 2013 19:38 - 08 May 2013 19:43 #9716 by wuselfuzz
Replied by wuselfuzz on topic USB HID Joystick & PPM-In program
Duh...

This happens when I hook up my dx6i. Time to dig out the logic analyzer...
Attachments:
Last edit: 08 May 2013 19:43 by wuselfuzz.

Please Log in or Create an account to join the conversation.

More
08 May 2013 23:16 #9719 by PhracturedBlue
Replied by PhracturedBlue on topic USB HID Joystick & PPM-In program
Well, either the delta or center width parameters are likely wrong. Vlad posted a link a while back with the parameters for many radio systems here:
github.com/blutack/paparazzi/tree/v3.9/conf/radios

It would be nice to provide some interface (or at least a procedure for setting the parameters properly.
maybe an 'autodetect' button like the stick calibration where you move one channel from center to max and we calculate the values from that.

Please Log in or Create an account to join the conversation.

More
09 May 2013 01:05 #9721 by PhracturedBlue
Replied by PhracturedBlue on topic USB HID Joystick & PPM-In program
FYI, I verified that the fix for PPMin working after power-on or model change is now working.

Please Log in or Create an account to join the conversation.

More
09 May 2013 06:39 - 09 May 2013 06:42 #9729 by vlad_vy
Replied by vlad_vy on topic USB HID Joystick & PPM-In program
I can select up to PPM9 for 8ch mode (Trainer page), up to PPM7 for 6ch mode. Is it normal? And, possible it will be better to fill absent channels by 'None', but not the last available PPM channel.

Also, why by default 'Trainer sw' is AIL? Possible will be better by defaul use most usable switch (for all possible Tx), or add 'None'(Off) as default.

Attachments:
Last edit: 09 May 2013 06:42 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
09 May 2013 08:10 - 09 May 2013 09:12 #9731 by BitOne
Replied by BitOne on topic USB HID Joystick & PPM-In program
Hi Guys,

Trainer and PPM-In are wonderful features ! Thanks a lot for that.

I have a small question or remark: from the picture above, it seems that the PPM Inputs from the slave are mapped directly to the output channels of the master, without going through the mixer on the master.

I realized it matches what PhracturedBlue described previously :

1) Trainer mode: In this mode each input channel is mapped to an output of the transmitter when the relevant switch is enabled, otherwise the channels act as normal


So it means that all the mixers, trims, safety switch settings, etc... must be done on the slave transmitter, as well as on the master transmitter. And the two setup must produced the same result (not easy when you have two different software on the two TXs).

In my case, it does not work very well: I have a DX5 transmitter that I would like to use as slave and my Devo 8s as master. As the DX5 is not programmable, I cannot use it with this mode in Deviation.

Same at my club: the slave TX is a very simple non-programmable transmitter. Could even be a module-less cheap one, as it's only used as slave TX.

The use case where the more advanced TX is the slave can occur too (and this is the one covered by Deviation as I understood it), but I have the feeling that in a lot of situation the more powerful TX will be used as master as it has for example the highest range.

Could it be possible to implement both ways and to choose which one from the configuration :
- PPM inputs from slave TX mapped directly to output channels on master TX
- PPM inputs from slave TX override master stick inputs (so the inputs will go through mixer and master TX configuration)

Or maybe with the PPIM In mode (the FPV one) I could emulate what I want by using a mixer, a switch and virtual channels linked to the PPIM In to do the overriding, at the cost of a complex setup and modifying each model setup to enable trainer input.
Last edit: 09 May 2013 09:12 by BitOne.

Please Log in or Create an account to join the conversation.

More
09 May 2013 12:54 #9743 by PhracturedBlue
Replied by PhracturedBlue on topic USB HID Joystick & PPM-In program
I assumed that you would want the slave to behave as if the owner was flying it, but you bring up a good point that it would result in a difference in behavior when going to master-mode if the configs didn't match.

How do other transmitters handle this?

You can of-course use the 'FPV' mode to achieve what you want. it requires using advanced mixers everywhere and having the 1st mixer be a 1:1 mixer, the 2nd mixer use the train switch to override with the proper PPM input, and the 3rd and higher mixers to apply whatever curves or d/r you want.

However, if the current 'train' mode isn't valuable, then I could change the behavior to be an input override instead. Not having ever used a trainer, I may not have been the best person to implement this feature :)

Please Log in or Create an account to join the conversation.

More
09 May 2013 12:58 #9744 by PhracturedBlue
Replied by PhracturedBlue on topic USB HID Joystick & PPM-In program
vlad, when you say 'abssnt channels' you mean the case where the # of selected channels is != 8?

And yes, supporting PPM9 is a bug. There are only 8 supported PPM channels.

Please Log in or Create an account to join the conversation.

More
09 May 2013 13:19 - 09 May 2013 13:51 #9745 by BitOne
Replied by BitOne on topic USB HID Joystick & PPM-In program

How do other transmitters handle this?


I dug into my memories and the ugly truth showed its nose ;)

I did some flying in the past as a student so using a slave TX connected to a master TX, both Futabas.

I remember it was working exactly the way you implemented it in Deviation: the master radio, while in trainer mode, was acting as just a big radio module sending the exact signal from the slave TX.

And to be honest, it was a pain in the ass:
- we need to spend 5-10 minutes at the beginning of each flying session to setup the exact same configuration on servo reversal and trims. And it was not perfect, as the slave TX was a dumb radio and the master a programmable one. Even trim were not of the same resolution. So when the master was gaining control, the plane had often a kind of sudden reaction until we managed to fine trim it during flight
- flying different planes was almost impossible, as the dumb TX did not have any memory, so we stuck to the same plane
- I could not benefit from any advantages of the master TX: no expo (would have been useful for a beginner), no way to have delta mixing (so I had to learn alone how to fly my flying wing)

So this way of working is far from ideal. The funny thing is that I just found some information from Futaba describing their trainer system:
www.futaba-rc.com/faq/product-faq.html#q106

And they have the two possibilities:
- on basic/average radio: only the way I described above
- on high end radio, you can choose between both ways

In the NORMAL mode:

when you hold the trainer button the student radio is totally in control. Its throws, rates, servo directions, etc, MUST be set exactly to the aircraft it is flying.


In the FUNC mode:

The student radio is acting just as a joystick while running the programming from the 8.


In addition to the present "NORMAL" mode, can we have a mode similar to the "FUNC" one, please ?

Thank you ;)

Edit: And for Christmas, I would like a MIX mode too:

the instructor can have the option to make corrections for the student without taking the aircraft completely back from the student. This is called "MIX" mode.


Could be nice to have ;) But the FUNC mode seems to be easier to implement and the MIX mode could be done via a complex mixer.
Last edit: 09 May 2013 13:51 by BitOne.

Please Log in or Create an account to join the conversation.

More
09 May 2013 13:36 - 09 May 2013 13:38 #9746 by BitOne
Replied by BitOne on topic USB HID Joystick & PPM-In program
Interesting data from the ER9x implementation.

Extract from the ER9x documentation, page 15 ("PPM In") code.google.com/p/er9x/source/browse/tru...%20Users%20Guide.pdf

This menu allows the PPMin (trainer) inputs to be configured. It enables the RAW PPM inputs to be selected to replace the sticks for training purposes. The student transmitter does not need to have the same model setup as the instructor. All the mixes on the instructors Tx will be applied to the student inputs. If, for example, you have expo on your sticks, this will be applied to the raw trainer inputs when they are selected.

Last edit: 09 May 2013 13:38 by BitOne.

Please Log in or Create an account to join the conversation.

More
09 May 2013 14:07 #9750 by PhracturedBlue
Replied by PhracturedBlue on topic USB HID Joystick & PPM-In program
Alright, it looks like I've got more development to do then...

Please Log in or Create an account to join the conversation.

Time to create page: 0.093 seconds
Powered by Kunena Forum