update code

master
Cole Deck 2 years ago
parent e329c893d7
commit 0d84232a56

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.6.21" />
</component>
</project>

@ -3,7 +3,7 @@
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
# #
# MODIFIED to use pololu motor drivers, but compatible with adafruit_servokit driver layout # MODIFIED to use pololu motor drivers, but compatible with adafruit_servokit driver layout
# by Cole Deck # by Amelia Deck
# Based on adafruit_motor.py as well # Based on adafruit_motor.py as well
""" """
@ -152,7 +152,7 @@ class pololuservo:
self._duty_range = max_pulse - min_pulse self._duty_range = max_pulse - min_pulse
self.duty_cycle = 0 self.duty_cycle = 0
print("init servo", ch) print("init servo", ch)
pca.setAccel(ch, 10) pca.setAccel(ch, 15)
pca.setTarget(ch, int((max_pulse-min_pulse)/2 + min_pulse)) # set midpoint pca.setTarget(ch, int((max_pulse-min_pulse)/2 + min_pulse)) # set midpoint
time.sleep(0.1) time.sleep(0.1)
pca.setAccel(ch, 0) pca.setAccel(ch, 0)

@ -38,9 +38,9 @@
"movementInterval": 5, "movementInterval": 5,
"movementSwitchDuration": 150, "movementSwitchDuration": 150,
"leg0Offset": [ "leg0Offset": [
0,
10, 10,
25 10,
30
], ],
"leg0Scale": [ "leg0Scale": [
1, 1,
@ -48,29 +48,29 @@
-1 -1
], ],
"leg1Offset": [ "leg1Offset": [
-1.0, 15,
8, -20,
-6 35
], ],
"leg1Scale": [ "leg1Scale": [
1, 1,
1, -1,
1 -1
], ],
"leg2Offset": [ "leg2Offset": [
1.0, -3,
12.0, 10,
1.0 20
], ],
"leg2Scale": [ "leg2Scale": [
1, 1,
1, -1,
1 -1
], ],
"leg3Offset": [ "leg3Offset": [
-3, 7,
12.0, 15,
-6.0 -10
], ],
"leg3Scale": [ "leg3Scale": [
1, 1,
@ -78,9 +78,9 @@
1 1
], ],
"leg4Offset": [ "leg4Offset": [
-6, 15,
2, 10,
-6.0 5
], ],
"leg4Scale": [ "leg4Scale": [
1, 1,
@ -88,9 +88,9 @@
1 1
], ],
"leg5Offset": [ "leg5Offset": [
0, -7,
10, 10,
-40 -30
], ],
"leg5Scale": [ "leg5Scale": [
1, 1,

@ -132,18 +132,18 @@ class Hexapod(Thread):
correction=self.config.get('leg1Offset', [0, 0, 0]), scale=self.config.get('leg1Scale', [1, 1, 1])), correction=self.config.get('leg1Offset', [0, 0, 0]), scale=self.config.get('leg1Scale', [1, 1, 1])),
# rear right # rear right
Leg(2, Leg(2,
[self.pca_left.servo[12], self.pca_left.servo[13], [self.pca_left.servo[14], self.pca_left.servo[13],
self.pca_left.servo[14]], self.pca_left.servo[12]],
correction=self.config.get('leg2Offset', [0, 0, 0]), scale=self.config.get('leg2Scale', [1, 1, 1])), correction=self.config.get('leg2Offset', [0, 0, 0]), scale=self.config.get('leg2Scale', [1, 1, 1])),
# rear left # rear left
Leg(3, Leg(3,
[self.pca_right.servo[15], self.pca_right.servo[16], [self.pca_right.servo[17], self.pca_right.servo[16],
self.pca_right.servo[17]], self.pca_right.servo[15]],
correction=self.config.get('leg3Offset', [0, 0, 0]), scale=self.config.get('leg3Scale', [1, 1, 1])), correction=self.config.get('leg3Offset', [0, 0, 0]), scale=self.config.get('leg3Scale', [1, 1, 1])),
# center left # center left
Leg(4, Leg(4,
[self.pca_right.servo[9], self.pca_right.servo[10], [self.pca_right.servo[11], self.pca_right.servo[10],
self.pca_right.servo[11]], self.pca_right.servo[9]],
correction=self.config.get('leg4Offset', [0, 0, 0]), scale=self.config.get('leg4Scale', [1, 1, 1])), correction=self.config.get('leg4Offset', [0, 0, 0]), scale=self.config.get('leg4Scale', [1, 1, 1])),
# front left # front left
Leg(5, Leg(5,

Loading…
Cancel
Save