Changing pid.0.Igain value in HAL file
27 Apr 2012 22:18 #19597
by ben5446
Changing pid.0.Igain value in HAL file was created by ben5446
I'm trying to change the value of Igain to Zero when the following error is less than the deadband. To do this I use the following section of code:
net Xferror axis.0.f-error => abs.1.in
net Xferrorabs abs.1.out => comp.0.in1
setp comp.0.in0 0.00005
net Xcompout comp.0.out => conv-bit-s32.0.in
net Xconvb32out conv-bit-s32.0.out => conv-s32-float.0.in
setp mult2.0.in0 [AXIS_0]I
net Xs32floatin0 conv-s32-float.0.out => mult2.0.in1
setp pid.0.Igain mult2.0.out
addf pid.0.do-pid-calcs servo-thread
net motor.00.command pid.0.output => ppmc.0.pwm.00.value
The problem is that I get an error saying "...mult2.0.out is invalid for float". I've tried linking the mult2.0.out value to pid0.Igain every way I can think of but I get some type of error any way I try.
Am I missing something obvious or can you not use a variable to assign the Igain?
net Xferror axis.0.f-error => abs.1.in
net Xferrorabs abs.1.out => comp.0.in1
setp comp.0.in0 0.00005
net Xcompout comp.0.out => conv-bit-s32.0.in
net Xconvb32out conv-bit-s32.0.out => conv-s32-float.0.in
setp mult2.0.in0 [AXIS_0]I
net Xs32floatin0 conv-s32-float.0.out => mult2.0.in1
setp pid.0.Igain mult2.0.out
addf pid.0.do-pid-calcs servo-thread
net motor.00.command pid.0.output => ppmc.0.pwm.00.value
The problem is that I get an error saying "...mult2.0.out is invalid for float". I've tried linking the mult2.0.out value to pid0.Igain every way I can think of but I get some type of error any way I try.
Am I missing something obvious or can you not use a variable to assign the Igain?
Please Log in or Create an account to join the conversation.
27 Apr 2012 22:30 #19598
by andypugh
Replied by andypugh on topic Re:Changing pid.0.Igain value in HAL file
ben5446 wrote:
mult2.out is an output pin, and Igain is an IO pin.
I think you can connect them via the tristate_float component.
Am I missing something obvious or can you not use a variable to assign the Igain?
mult2.out is an output pin, and Igain is an IO pin.
I think you can connect them via the tristate_float component.
Please Log in or Create an account to join the conversation.
04 May 2012 17:23 #19817
by ben5446
Replied by ben5446 on topic Re:Changing pid.0.Igain value in HAL file
Thanks for your help. I couldn't link the mult2.0.out to the tristate-float, but I was able to make the code work using tristate-float command. The following works fine:
net Xferror axis.0.f-error => abs.1.in
net Xferrorabs abs.1.out => comp.0.in1
setp comp.0.in0 0.00005
net Comp0Not not.0.in <= comp.0.out
setp tristate-float.0.in 0
setp tristate-float.1.in [AXIS_0]I
net XIgain0 tristate-float.0.enable <= not.0.out
net Comp0Not tristate-float.1.enable
net XIgain pid.0.Igain <= tristate-float.0.out
net XIgain tristate-float.1.out
#Do PID calculations
addf pid.0.do-pid-calcs servo-thread
net motor.00.command pid.0.output => ppmc.0.pwm.00.value
net Xferror axis.0.f-error => abs.1.in
net Xferrorabs abs.1.out => comp.0.in1
setp comp.0.in0 0.00005
net Comp0Not not.0.in <= comp.0.out
setp tristate-float.0.in 0
setp tristate-float.1.in [AXIS_0]I
net XIgain0 tristate-float.0.enable <= not.0.out
net Comp0Not tristate-float.1.enable
net XIgain pid.0.Igain <= tristate-float.0.out
net XIgain tristate-float.1.out
#Do PID calculations
addf pid.0.do-pid-calcs servo-thread
net motor.00.command pid.0.output => ppmc.0.pwm.00.value
Please Log in or Create an account to join the conversation.
Time to create page: 0.064 seconds