Slushengine Модель D водитель мотора (рука робота + малина пи) - PullRequest
0 голосов
/ 02 октября 2018

Хе, я разрабатываю робота-манипулятора 3d-робота, используя модель Slushengine D + Raspberry Pi.У меня проблема с плечевой частью робота.Я использую два нема 23 двигателя с 3,0 ампер.Но его трудно двигать роботом.Обратитесь к этому видео, чтобы увидеть проблему: https://www.youtube.com/watch?v=AzAMZ7n1cHg

Я хочу знать в примере кодирование:

motor1.setCurrent (запустить, ускорить, уменьшить, удержать)

насколько большую ценность я могу увеличить мой ток.Прямо сейчас я использую 185, это кажется мне большим.Но мотор не может выдержать вес робота.Безопасно ли увеличивать стоимость?и насколько оно может быть максимальным?

Я ссылаюсь на это руководство: https://roboteurs.com/pages/slushengine-advanced-current-driving-of-stepper-motors

, но оно устанавливает текущее значение только в диапазоне (1-200).Я хочу увеличить крутящий момент двигателя.

Это мое полное кодирование:

from inputs import get_key
import RPi.GPIO as GPIO
import Slush
import math
import time

from time import sleep

#setup all of the axis for the SlushEngine
b = Slush.sBoard()
joints = [Slush.Motor(0), Slush.Motor(1), Slush.Motor(2), Slush.Motor(3), Slush.Motor(4), Slush.Motor(5)]

#reset the joints to clear previous errors
for joint in joints:
    joint.resetDev()
    joint.setMicroSteps(16)

#some initalization stuff that needs cleanup
joints[0].setMaxSpeed(40)
joints[1].setMaxSpeed(40)
joints[2].setMaxSpeed(40)
joints[3].setMaxSpeed(40)
joints[4].setMaxSpeed(25)
joints[5].setMaxSpeed(40)

#joint current limits. Still setting manually becuase testing (hold A, run A, acc A, dec, A)
joints[0].setCurrent(85, 85, 85, 85)
joints[1].setCurrent(300, 300, 300, 300)
joints[2].setCurrent(300, 300, 300, 300)
joints[3].setCurrent(150, 150, 150, 150)
joints[4].setCurrent(85, 85, 85, 85)
joints[5].setCurrent(150, 150, 150, 150)

#setup the gripper
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
pwm = GPIO.PWM(18, 50)
pwm.start(0)
GPIO.output(18, True)


#start reading the inputs from the keyboard and putting them out the joints
gripper = 7
while 1:
    events = get_key()
    for event in events:

        if event.code == 'KEY_Q':
            value = event.state
            if value == 1:
                if not joints[0].isBusy(): joints[0].run(1, 40)
        if event.code == 'KEY_A':
            value = event.state
            if value == 1:
                if not joints[0].isBusy(): joints[0].softStop()
        if event.code == 'KEY_Z':
            value = event.state
            if value == 1:
                if not joints[0].isBusy(): joints[0].run(0, 40)


        if event.code == 'KEY_W':
            joints[1].run(1, 40)
            joints[2].run(0, 40)
        if event.code == 'KEY_S':
            joints[1].softStop()
            joints[2].softStop()
        if event.code == 'KEY_X':
            joints[1].run(0, 40)
            joints[2].run(1, 40)



        if event.code == 'KEY_E':
            value = event.state
            if value == 1:
                if not joints[3].isBusy(): joints[3].run(1, 40)
        if event.code == 'KEY_D':
            value = event.state
            if value == 1:
                if not joints[3].isBusy(): joints[3].softStop()
        if event.code == 'KEY_C':
            value = event.state
            if value == 1:
                if not joints[3].isBusy(): joints[3].run(0, 40)




        if event.code == 'KEY_R':
            value = event.state
            if value == 1:
                if not joints[4].isBusy(): joints[4].run(1, 25)
        if event.code == 'KEY_F':
            value = event.state
            if value == 1:
                if not joints[4].isBusy(): joints[4].softStop()
        if event.code == 'KEY_V':
            value = event.state
            if value == 1:
                if not joints[4].isBusy(): joints[4].run(0, 25)



        if event.code == 'KEY_T':
            value = event.state
            if value == 1:
                if not joints[5].isBusy(): joints[5].run(1, 25)
        if event.code == 'KEY_G':
            value = event.state
            if value == 1:
                if not joints[5].isBusy(): joints[5].softStop()
        if event.code == 'KEY_B':
            value = event.state
            if value == 1:
                if not joints[5].isBusy(): joints[5].run(0, 25)



        if event.code == 'KEY_1':
            value = event.state
            if value == 1:
                pwm.ChangeDutyCycle(1)
                time.sleep(0.5)
                if not pwm.stop(): pwm.start(0)
        if event.code == 'KEY_2':
            pwm.stop()
            time.sleep(0.5)
            pwm.start(0)
        if event.code == 'KEY_3':
            pwm.ChangeDutyCycle(7)         

        if event.code == 'KEY_P':
            joints[0].softFree()
            joints[1].softFree()
            joints[2].softFree()
            joints[3].softFree()
            joints[4].softFree()
            joints[5].softFree()
...