Skip to content

Commit

Permalink
Merge pull request #426 from krkeegan/Proportional_weight
Browse files Browse the repository at this point in the history
Enable User Setting of Proportional on Error/Measurement Ratio
  • Loading branch information
BarbourSmith authored Sep 25, 2017
2 parents 4fd76a3 + 4ee9342 commit d5be279
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,13 @@ def get_application_config(self):
"section": "Advanced Settings",
"key": "KdPos"
},
{
"type": "string",
"title": "Proportional Weighting",
"desc": "The ratio of Proportional on Error (1) to Proportional on Measure (0)",
"section": "Advanced Settings",
"key": "propWeight"
},
{
"type": "bool",
"title": "Enable Custom Velocity PID Values",
Expand Down Expand Up @@ -397,6 +404,7 @@ def build_config(self, config):
'KpPos' : 400,
'KiPos' : 5,
'KdPos' : 10,
'propWeight' : 1,
'enableVPIDValues' : 0,
'KpV' : 20,
'KiV' : 1,
Expand Down Expand Up @@ -449,10 +457,12 @@ def push_settings_to_machine(self, *args):
KpPos = float(self.data.config.get('Advanced Settings', 'KpPos'))
KiPos = float(self.data.config.get('Advanced Settings', 'KiPos'))
KdPos = float(self.data.config.get('Advanced Settings', 'KdPos'))
propWeight = float(self.data.config.get('Advanced Settings', 'propWeight'))
else:
KpPos = 400
KiPos = 5
KdPos = 10
propWeight = 1

if int(self.data.config.get('Advanced Settings', 'enableVPIDValues')) == 1:
KpV = float(self.data.config.get('Advanced Settings', 'KpV'))
Expand All @@ -472,6 +482,7 @@ def push_settings_to_machine(self, *args):
+" M" + str(self.data.config.get('Advanced Settings', 'chainPitch'))
+" N" + str(self.data.config.get('Maslow Settings' , 'zDistPerRot'))
+" P" + str(self.data.config.get('Advanced Settings', 'zEncoderSteps'))
+" R" + str(propWeight)
+" S" + str(KpPos)
+" T" + str(KiPos)
+" U" + str(KdPos)
Expand Down

0 comments on commit d5be279

Please sign in to comment.