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
Support custom per-channel parameters in actuator driver #20594
Support custom per-channel parameters in actuator driver #20594
Conversation
Bitfield param is implemented in a non-per-channel basis. Have no idea how to support that now |
@SalimTerryLi Thanks for this PR! Could you apply the changes requested? |
Sorry for the inconvenience. Will do it next month. |
480e1a9
to
665bccb
Compare
Hi @bkueng , While playing around with schema validation, I come up with some issues:
My current module.yaml: module_name: PCA9685 Output
actuator_output:
output_groups:
- param_prefix: PCA9685
channel_label: 'Channel'
standard_params:
disarmed: { min: 800, max: 2200, default: 900 }
min: { min: 800, max: 1400, default: 1000 }
max: { min: 1600, max: 2200, default: 2000 }
failsafe: { min: 800, max: 2200 }
custom_params:
MODE_${i}:
description:
short: Set output signal mode on ${i}
long: |
FOO BAR
type: enum
values:
0: PWM
1: Duty-cycle
default: 0
num_instances: 16
instance_start: 1
show-as: 'bitmap'
num_channels: 16
|
Yes certainly. Whatever is in the json, we can use in the yaml.
I would go with that, but I'm not sure what problems you might run into. Can you elaborate? |
@bkueng Sorry but I'm still confused by some of your statement... I'd be appreciate if further guidance is possible...
This goes into
Which
If I re-arrange the definition into module level, then how could I tell if one param is needed to be included by
then There is no existing way to tell whether Also this raises another question: where should I extend the scheme? I'm trying to address |
Sorry I wasn't clear enough then. My idea was to do it like this:
|
665bccb
to
0c6aac7
Compare
Sincerely thanks @bkueng So far so good, everything works as intended. My current module_name: PCA9685 Output
actuator_output:
output_groups:
- param_prefix: PCA9685
channel_label: 'Channel'
standard_params:
disarmed: { min: 0, max: 4095, default: 900 }
min: { min: 0, max: 4095, default: 1000 }
max: { min: 0, max: 4095, default: 2000 }
failsafe: { min: 0, max: 4095 }
custom_params:
- name: 'DUTY_EN'
label: "Duty-Cycle\n Mode"
index_offset: -1
show_as: bitset
num_channels: 16
parameters:
- group: Actuator Outputs
definitions:
PCA9685_DUTY_EN:
description:
short: Set output signal mode on ${i}
long: |
FOO BAR
type: bitmask
bit:
0: Put CH1 to Duty-Cycle mode
1: Put CH2 to Duty-Cycle mode
2: Put CH3 to Duty-Cycle mode
3: Put CH4 to Duty-Cycle mode
4: Put CH5 to Duty-Cycle mode
5: Put CH6 to Duty-Cycle mode
6: Put CH7 to Duty-Cycle mode
7: Put CH8 to Duty-Cycle mode
8: Put CH9 to Duty-Cycle mode
9: Put CH10 to Duty-Cycle mode
10: Put CH11 to Duty-Cycle mode
11: Put CH12 to Duty-Cycle mode
12: Put CH13 to Duty-Cycle mode
13: Put CH14 to Duty-Cycle mode
14: Put CH15 to Duty-Cycle mode
15: Put CH16 to Duty-Cycle mode
default: 0 Still a small issue, as I commented in code:
Since those two part of param is totally independent, there's no way to validate and ensure the one in actuator_metadate is actually existing as module-level param. Any thought? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, is it ready to merge?
Since those two part of param is totally independent, there's no way to validate and ensure the one in actuator_metadate is actually existing as module-level param. Any thought?
Right, I don't think it's a big problem in practice, as a mismatch will show up immediately when testing.
But if you want to add a check that would certainly not be bad.
0c6aac7
to
da7fc4b
Compare
Rebased. I'd leave the additional check as a TODO for now :) Lots' of things need to be done before... |
Describe problem solved by this pull request
I'm now doing the rewrite of
pca9685_pwm_out
driver and want to make it able to output duty cycle information(aka PWM mode) instead of typical 1ms~2ms pulse signal.This PR will let actuator drivers be able to do runtime configuration of its output, based on Dynamic Allocator in a more flexible way than before.
Describe your solution
Both param and meta generator are affected.
Test data / coverage
This is the part of my current
module.yml
:After touching some of params by
Here are some screenshots of the working demo: