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 » Mon Oct 26, 2020 3:44 pm

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: 1463
Joined: Thu Feb 26, 2015 9:45 pm

Re: roboclaw python library speed control

Post by Basicmicro Support » Tue Nov 03, 2020 8:40 am

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 » Mon Nov 09, 2020 2:49 pm

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: 1463
Joined: Thu Feb 26, 2015 9:45 pm

Re: roboclaw python library speed control

Post by Basicmicro Support » Tue Nov 17, 2020 6:57 pm

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