Motor command to be used to just accelerate the motor

General discussion of using Roboclaw motor controllers
Denesh
Posts: 5
Joined: Mon Jul 02, 2018 7:17 pm

Motor command to be used to just accelerate the motor

Postby Denesh » Wed Jul 11, 2018 12:00 pm

Hi
I'm using Roboclaw 2X7A motor controller to drive a dc motor.I'm involved in a project to balance the inverted pendulum.I have setup the labview vi and it seems to be communicating well with the setup.

Now,I would like to get your suggestions on the motor command ( mode of operation) that is to be used for my application.

So basically , I'm trying to control the inverted pendulum .In my labview code, what comes out as input to the system is in the form of Force (N).
So ideally I want the motor to accelerate with an accelerarion proportional to the force that comes out of the code.

So far I have been using the labview driver called motor duty cycle to convert the force into duty cycle by just factoring 32767.I feel this approach is wrong and also to back it up, I observed that when I give 0 input what I want is essentially 0 acceleration, but it seems to give 0 velocity and the motor comes to a halt.

Could you please help me out on this? Also let me know if you need any other details.

Regards
Denesh

User avatar
Basicmicro Support
Posts: 989
Joined: Thu Feb 26, 2015 9:45 pm

Re: Motor command to be used to just accelerate the motor

Postby Basicmicro Support » Thu Jul 12, 2018 9:51 am

You just have to think about the duty re: force differently. If you want zero force, you need to stop changing the duty, not zero the duty. If you want more forward force you increase duty from where it is at and if you want less force or reverse force you decrease duty.

You will need to deal with potential singularities at the maximum duty limits(+ and -). Assuming your motor has enough power to balance the pendulum that shouldnt be a problem(eg you will never reach those limits).

Denesh
Posts: 5
Joined: Mon Jul 02, 2018 7:17 pm

Re: Motor command to be used to just accelerate the motor

Postby Denesh » Thu Jul 12, 2018 10:43 am

So do u mean to say that the duty cycle command is the right way to approach?
In fact my requirement is very simple .Its the same sort of thing that a normal dc motor with constant current will do.Itll give a constant torque and this achieve constant acceleration.

Please note that I just want to use the motor controller in open loop mode.The control will be taken care of by my code.
The problem is I have a control and simulation loop running every 0.01 secs So every 0.01 seconds I will get an input value which should correspond to a constant torque value which in turn should induce constant acceleration for that 0.01 seconds.

So ideally what I want to achieve is in the loop if I give a command to the motor and plot the x position of the cart vs time., I should see the position increasing quadratically , but now I see only a linear change.

Please guide me on this

User avatar
Basicmicro Support
Posts: 989
Joined: Thu Feb 26, 2015 9:45 pm

Re: Motor command to be used to just accelerate the motor

Postby Basicmicro Support » Fri Jul 13, 2018 9:10 am

I beleive it is the right way. You are effectively building your own PID externally) and only need to control power through the Roboclaw.

Yes, constant current in a DC motor effectively translates to constant force however you dont need to control corrent in your application. Controlling current will be an automatic side effect of you PID controller. Eg you measure the error from the center point of your angle sensor and the PID will automatically calculate the necessary duty(eg voltage) which will provide the necessary force(current). You just need to tune your PI controller.

Yes, you are using open loop mode which means Duty is the ONLY control method you have available(with a Roboclaw). You could use a MCP with current control but as I said above current/torque control is no necessary. The only requirements of your system are:

a) the motor must have the ability to do the tast
b) you must have a measurement of the error from center(eg pendulum perfectly balanced)
c) you must tune your PID controller properly.

Note it is the Integral part of the PID that will cause the acceleration factor but again you dont really need to understand that. You just need to tune the system using the Zeigler Nichols method. The acceleration will come out of the system automatically.

Starting with just a P controller you will see the pendulum holding position with offset error. Smaller error with larger P values. At some point the Pendulum will start to oscilator(possibly wildly aroudn the center point). That is your ultimate gain for P. Reduce that value by about 2/3rds. Then start adding I. The I value will get you to center but will also impart oscillation around the center point. Use D to dampen the oscillation.

I have not setup a balanced pendulum before so I cant give you balpark ratios for P I and D unfortunately. For speed and position control I is usually around 1/10th p and D is usually around 10 times P.


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 5 guests