-
Notifications
You must be signed in to change notification settings - Fork 13.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Toward a centralized, flexible PWM resource coordination subsystem #10534
Conversation
…existence on FMU. 2. minor change on drv_pwm_servo to allow parallel access to pwm channels 3. re-arrange mindpx timer configuration 4. fix rgb pwm led breathing issue 5. add bmi160 and lis3mdl imu
…existence on FMU. 2. minor change on drv_pwm_servo to allow parallel access to pwm channels 3. re-arrange mindpx timer configuration 4. fix rgb pwm led breathing issue 5. add bmi160 and lis3mdl imu
@rolandash this was really needed. Thank you! I will review it in detail next week. Would you be able to join the dev call wednesday 8:00 PM PST and walk us through it? |
@davids5 thank you and that's great! Are you sure the dev call is 8PM PST? as in dev call calendar it seems to be 8AM PST. In latter case, I will be happy to discuss it on Slack (need someone invites me in though), or add more comments/documents where you need ... |
My bad 8 AM.
We can plan a skype call with @dagar when it would work for you. What time zone are you in? |
@davids5 thanks that will be nice. I am in UTC+8, usually local time 11:00 ~ 21:00 is good for me. I am traveling till Wed next week. So sometime on Thursday or Friday would be great. Please let me know if that suits your. |
@dagar what time will work for you. I will fit it what works for both you and @rolandash |
@rolandash could you please schedule something as late as possible for you either Thursday or Friday? |
I looked at the linked design document but that didn't really give me much of an idea as to what needs to happen in QGC either. So will need something I can understand to help out here. |
@dagar will about 23:00 my local time work for you? |
Thanks @DonLakeFlyer You are right that's not complete yet. Will let you know when more details come out. |
@rolandash - wouldn't that be 8AM PST which is when the dev call is? Is that time slot workable? |
@davids5 @dagar Lets have the call on 23.00 Fri. my local time, i assume its better time for your guys. I have added you on Skype @dagar |
@rolandash @dagar - I have added ning.roland@hotmail.com to skype and will place the call 8:00 AM PST on 9/28. |
|
@davids5
The problem is we want to use one single target (firmware) for both hardwares(another purpose of this PR, for the release of new mindracer hardware). This brings some extra issues in:
So these actually challenges on:
These explains where the ideas of channel conflict/rate conflict checking coming from. Sorry i forgot these during the call as they were buried under many design threads back few months ago, but it is important. This is actually a quite typical example what the problems we will encounter when we try to add a new pwm device into existing PX4 system, not limited to pwm led only. Instance-able FMU/ECU, and timers are great and we should work on that, but may be not enough to solve the problems, e.g., we can make main & aux run on main processor, but a 6-outputs aux mixer which works on MindPX, may break the pwm led on new Mindracer. And these are what i tried to address in PwmGroups class in this PR. Hope you will take this into account when we move forward. @dagar This is the link of MindPX/new Mindracer pinout map Please let me know if you need further discussions. |
Another question about if a pwm device can use channel across the boarder of main and aux port, on another thought it probably be feasible based on current design(depends on how we revise some existing limits), though pilots may not intend to do that by intuition. But technically its an option we can turn it on or off. |
@rolandash @dagar - here is what we have The led pwm and pwm_trigger are more or less copies. The drv_pwm_servo and drv_input_capture are lend themselves to hierarchical model. led pwm and pwm_trigger may be absorbed by having a pointer based implementation. |
@davids5 thanks. thats is a clear picture. |
I have to look at the use case in more detail, but in general: https://github.com/PX4/Firmware/blob/master/src/drivers/stm32/drv_io_timer.c#L523-L537 would become Then the same code can work on multiple sets of io_timer and timer_io_channels described by instances of io_timer_dev. Then the 0th instance of the FMU (code) would use the 0th instance of io_timer_dev. Ideally this would all be done in C++ and the specialization hinted at in the uml would be implemented. The challenges is that the PX4IO uses the same code and we have more resource limitations there. @dagar when you get a chance we should spend some time hashing this out. |
@davids5
We can set up another discussion if necessary @dagar |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Closing as stale. |
Note
This PR is a workable branch, little bit behind latest px4/master (so all checks may fail), but as i imagine it will not be merged in short time so i need to rebase it anyway till then. You are welcome to comments on the new model and design, to see any improvements needed, and co-work if you are also interested.
If anyone would like to have a test flight you can find it here:
https://github.com/airmind/OpenMindPX
as its updated from time to time.
So far it is only tested on MindPX and MindRacer. Please let me know if you found any problem on other hardware (TAP-V1 probably broke on LED drivers, but it was not a correct implementation and needs to be fixed later anyway).
Describe problem solved by the proposed pull request
This PR starts the step towards a centralized while flexible PWM resource management system which introduce many interesting features.
Existing PWM subsystem majorly hand-wire pwm resource allocation like timers, channels, pin numbers, scattered in many different locations such as board configs, airframe config files, mixer files, or source codes, many of them hard-coded. This makes attempts to expand supported PWM devices quite difficult as one needs to manually settle all potential conflicts on resource usage.
This PR wants to build a centralized while flexible way to support as many kind of PWM devices as possible with only few simple runtime configurations needed through some kind of Human-Machine Interface(like from GUI of GCS).
Describe your preferred solution
A new model of PWM devices and a centralized resource management group of classes are defined to
achieve this goal. A detailed description of the model and design can be found here:
Design document
Some interesting features can be brought in by the new design. For example,
He will not need to change the codes and compile to upload everytime he wants to change the task modules layout for different missions.
Additional context
@davids5 It will be very interesting to see the possibility of it to be combined with the hardware manifest work you initiated. I am expecting your co-work on it.
@dagar This PR is somewhat independent of the original PR #7208 and #8142 that separating the FMU from other 'flight management' tasks. I prefer that we pursuing that target in an other PR.
@DonLakeFlyer Ultimately all these configurations has to be done through GCS. I think this will need your help on QGC side, if you like it and are interested on helping it out.
@testflights I will be appreciate if you can help to test the PR. And i strongly recommend you have MindPX/MindRacer hardwares added into your testing package :-)
@mzahana I think you can have all 16 (8 main + 8 aux) channels on MindPX fully funtional and all VTOL frames available now. Pls let me know on any issue. @TSC21
@LorenzMeier