Skip to content

Commit

Permalink
Merge pull request #747 from MaslowCNC/add-PID-settings-for-the-Z-axis
Browse files Browse the repository at this point in the history
Add PID settings for the z axis (take two)
  • Loading branch information
MaslowCommunityGardenRobot authored Aug 1, 2018
2 parents 8fc4118 + a7e2620 commit 8d2c9f1
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 3 deletions.
42 changes: 42 additions & 0 deletions Settings/maslowSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,27 @@
"key": "KdPos",
"default": 34
},
{
"type": "string",
"title": "Kp Position Z-Axis",
"desc": "The proportional constant for the position Z-Axis PID controller",
"key": "KpPosZ",
"default": 1300
},
{
"type": "string",
"title": "Ki Position Z-Axis",
"desc": "The integral constant for the position Z-Axis PID controller",
"key": "KiPosZ",
"default": 0
},
{
"type": "string",
"title": "Kd Position Z-Axis",
"desc": "The derivative constant for the position Z-Axis PID controller",
"key": "KdPosZ",
"default": 34
},
{
"type": "string",
"title": "Proportional Weighting",
Expand Down Expand Up @@ -373,6 +394,27 @@
"key": "KdV",
"default": .28
},
{
"type": "string",
"title": "Kp Velocity Z-Axis",
"desc": "The proportional constant for the Z-axis velocity PID controller",
"key": "KpVZ",
"default": 5
},
{
"type": "string",
"title": "Ki Velocity Z-Axis",
"desc": "The integral constant for the Z-axis velocity PID controller",
"key": "KiVZ",
"default": 0
},
{
"type": "string",
"title": "Kd Velocity Z-Axis",
"desc": "The derivative constant for the Z-axis velocity PID controller",
"key": "KdVZ",
"default": .28
},
{
"type": "options",
"title": "PWM frequency for motor control",
Expand Down
1 change: 0 additions & 1 deletion UIElements/diagnosticsMenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,5 @@ def advancedOptionsFunctions(self, text):
self.runJustTriangularCuts()
elif text == "Reset settings to defaults":
self.resetAllSettings()
self.runJustTriangularCuts()
elif text == "Compute chain calibration factors":
self.measureChainTolerances()
16 changes: 14 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,13 @@ def computeSettings(self, section, key, value):
else:
value = maslowSettings.getDefaultValue('Advanced Settings', key)
self.config.set('Computed Settings', key + "Main", value)
self.config.set('Computed Settings', key + "Z", value)
#updated computed values for z-axis
for key in ('KpPosZ', 'KiPosZ', 'KdPosZ'):
if int(self.config.get('Advanced Settings', 'enablePosPIDValues')) == 1:
value = float(self.config.get('Advanced Settings', key))
else:
value = maslowSettings.getDefaultValue('Advanced Settings', key)
self.config.set('Computed Settings', key, value)

elif key == 'enableVPIDValues':
for key in ('KpV', 'KiV', 'KdV'):
Expand All @@ -204,7 +210,13 @@ def computeSettings(self, section, key, value):
else:
value = maslowSettings.getDefaultValue('Advanced Settings', key)
self.config.set('Computed Settings', key + "Main", value)
self.config.set('Computed Settings', key + "Z", value)
#updated computed values for z-axis
for key in ('KpVZ', 'KiVZ', 'KdVZ'):
if int(self.config.get('Advanced Settings', 'enablePosPIDValues')) == 1:
value = float(self.config.get('Advanced Settings', key))
else:
value = maslowSettings.getDefaultValue('Advanced Settings', key)
self.config.set('Computed Settings', key, value)

elif key == 'chainOverSprocket':
if value == 'Top':
Expand Down

0 comments on commit 8d2c9f1

Please sign in to comment.