Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP_HAL: support brushed motors on more boards #7538

Open
rmackay9 opened this issue Jan 15, 2018 · 1 comment
Open

AP_HAL: support brushed motors on more boards #7538

rmackay9 opened this issue Jan 15, 2018 · 1 comment

Comments

@rmackay9
Copy link
Contributor

At the moment AP_HAL::RCOutput::set_output_mode is only implemented for the STM32 based boards. We should support this on all the Linux boards like the Navio2, etc.

@silver2row
Copy link

silver2row commented Dec 16, 2019

Hello,

I know people are using C/C++ on ardupilot software but I found this type of software to be handy on Python3 and DC, brushed motors:

class Motor:
    def __init__(self, dir_pin, pwm_pin, pwm_freq):
        self.dir_pin = dir_pin
        self.pwm_pin = pwm_pin
        self.value = 0

        PWM.start(pwm_pin, 0, pwm_freq)
        GPIO.setup(dir_pin, GPIO.OUT)

def set(self, value):
    if value == self.value:
        return

    assert -100 <= value <= 100

    if (value < 0) != (self.value < 0):
        # changing direction
        PWM.set_duty_cycle(self.pwm_pin, 0)
        GPIO.output(self.dir_pin, value < 0)

    PWM.set_duty_cycle(self.pwm_pin, abs(value))
    self.value = value

This can control brushed motors on a BBB or related board with their MotorCape.

...

I was given this software by a person on Freenode, #beagle at some point in time. I basically use it to control four DC, brushed motors w/ a server online.

...

Now, I am not off base I think but if you need to make a brushed motor work on more boards, I can help but I do not have complete access to all boards. I have stuck w/ the BBB or BBBlue recently.

I branched out on other boards but I stuck w/ the am335x the most.

Seth

P.S. If you need me to use it to set up some C/C++ source to make some motors move on the BBB or related boards w/ the am335x, I can probably think of something. It is GPIO and PWM signals being used. I do not know about AP_HAL::RCOutput::set_output_mode yet but if you chat me through it in time, I can help. I see this is an older, OPEN issue from 2018. If you are still wondering about it and you still want support, please let me know. Oh and the MotorCape uses the L298 motor drivers on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants