roboclaw python library speed control

Questions about using encoders with the Roboclaw product line
Post Reply
hmahdi
Posts: 2
Joined: Mon Oct 26, 2020 3:40 pm
roboclaw python library speed control

Post by hmahdi »

Hello,

I would like to use the built-in PID speed controller. I am using the function:

Code: Select all

SpeedM1M2 #(also tried SpeedM1)
If I feed a value of 0, it's all good; the motors don't move. If I feed it 1 or higher, it goes to max speed!!!!!
I initially thought it was my code but then I tried it in a super simple program and it did the same thing.

I might just implement my own PID and use the encoder feedback/pwm commands but I would love to know if I did something wrong.
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: roboclaw python library speed control

Post by Basicmicro Support »

Before you use velocity or position control you have to tune the motor settings using Motion studio. If it doesnt work in Motion Studio it is not going to work in python.
hmahdi
Posts: 2
Joined: Mon Oct 26, 2020 3:40 pm
Re: roboclaw python library speed control

Post by hmahdi »

Thanks for your reply and sorry for my delayed response. I tried to tune it in motionstudio but it crashes as soon as I click on tune. I found git issue where it said I have to make sure the logic battery is at 5, and I did by adding a 5V source but it still crashes.
Is there anyways to fix it?
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: roboclaw python library speed control

Post by Basicmicro Support »

It crashes if your motor is large enough to cause USB to drop out. In this case you have to fall back to manually tuning or get a better USB cable. One with a ferrite choke or adding a USB isolation adapter will usually help this kind of problem.

Post Reply