4
$\begingroup$

I'm working on a self-balancing TWIP (Two-Wheel Inverted-Pendulum) robot project which will be using two brushed DC gearmotors with encoders. As there were no speed constraints for the robot (and given a wheel radius of 0.03m) I chose a top speed of 1 m/s for the robot, giving a rated speed requirement of 318.28RPM for the gearmotor.

From what I understand, a high enough RPM is required to prevent the motor speed from saturating while the robot is balancing, as this can prevent the robot from maintaining balance i.e. the wheels can’t keep up with the body of the robot, and it falls over.

But, an encoder allows for direct measurement and control of the motor's speed, which can prevent it saturating i.e. it can prevent the motor from approaching speeds it can’t handle.

So, will the RPM I’ve calculated be fast enough for the robot or, since I’m using motors with encoders, can any motor speed be used?

Robot specs

enter image description here

$\endgroup$
1
  • 3
    $\begingroup$ Your question is good! But it's shame that it is 11 days old and it got only 16 views and no comments except this one, so I am placing a bounty of 100 of my own reputations to attract more viewers, readers, writers and answerers so your question will receive more attention. My kind. $\endgroup$ Sep 4, 2017 at 22:25

1 Answer 1

3
+100
$\begingroup$

:EDIT:

Let me put some numbers on this.

Let's say you want to get from any angle to vertical in half a second. Say for now (more on this unrealistic scenario later) that you want to get from "laying down" (90 degrees from vertical) to upright in half a second. This is just for the purposes of coming up with a spec.

The position equation:

$$ \theta = \theta_0 + \dot{\theta}_0 t + \frac{1}{2}\ddot{\theta}t^2 \\ $$

(It's equally valid for linear or angular positions/speeds). You would think that you need to accelerate from 90 to 0 degrees, but then you'd hit 0 with some velocity. In reality, you're looking to get to 45 degrees in a quarter second, then spend the other quarter second decelerating. So, if you want a quarter second to go from $\theta = 90^{\circ}$ to $\theta = 45^{\circ}$, then:

$$ 45^{\circ} = 90^{\circ} + (0^{\circ}/s)t + \frac{1}{2}\ddot{\theta}(0.25 \mbox{s})^2 \\ $$ $$ \frac{-45^{\circ}}{(0.25\mbox{s})^2} = \ddot{\theta} \\ $$ $$ \ddot{\theta} = 720 ^{\circ}/\mbox{s}^2 \\ $$

This is the acceleration you need beyond gravity to get the performance you want. You could accelerate slower if you want to - again, it's up to you to specify.

Check the top speed. At that acceleration, 720 degrees per second for a quarter second, you go from $\dot{\theta} = 0$ to $\dot{\theta} = (720^{\circ}/\mbox{s})(0.25\mbox{s})$, or $\dot{\theta} = 180^{\circ}/\mbox{s}$.

Now let's lower the speed requirement. Say instead of having the pendulum "pop" up from laying down in half a second, you're okay with it taking two seconds. Do the same steps as above, but now when it accelerates for half the time, it's accelerating for 1 second. It again decelerates for 1 second.

$$ 45^{\circ} = 90^{\circ} + (0^{\circ}/s)t + \frac{1}{2}\ddot{\theta}(1 \mbox{s})^2 \\ $$ $$ \frac{-45^{\circ}}{(1\mbox{s})^2} = \ddot{\theta} \\ $$ $$ \ddot{\theta} = 45 ^\circ/\mbox{s}^2 \\ $$

Now you run at that acceleration for a full second, and get $\dot{\theta} = 45^{\circ}/\mbox{s}$.

Seems reasonable so far, but you have to torque the pendulum by accelerating the base. Find the projection of the arm to the +y-axis, using the angle the arm makes with the vertical ($\theta$), to see how the base acceleration impacts the and then see that the base generates an angular acceleration at $\ddot{\theta} = \frac{1}{\ell} \cos(\theta) \ddot{x}$.

Now, at 90 degrees, $\cos(\theta) = 0$, so the angular acceleration you get is zero for any $\ddot{x}$. No amount of base acceleration will get the pendulum upright.

Say though that you want to start at 89 degrees instead. Now $\cos(89^{\circ}) = 0.0175$, so

$$ \ddot{x} = \frac{\ell}{0.0175} \ddot{\theta} \\ $$

Or $$ \ddot{x} = (53.3)(\ell)(\ddot{\theta}) \\ $$

So if $\ell$, the distance from the cart to the center of mass were 1 meter, then the cart has to accelerate 53 times the angular acceleration number. 720 degrees per second squared is 12.5 rad/s2, so you need your cart to accelerate about $(1\mbox{m})(53*12.5 \mbox{rad/s}^2) = 662.5 \mbox{m/s}^2$. At a gravitational constant of $9.81 \mbox{m/s}^2$, you're looking at a linear acceleration of about 67g.

For the slower case, 45 deg/s2 = 0.7854 rad/2, so now the cart would need to accelerate at $(1\mbox{m})(53*0.7854 \mbox{rad/s}^2) = 41.6 \mbox{m/s}^2$, or about 4.25g.

The faster case is accelerating at 67g for a quarter second, so $x_f = x_0 + v_0t + 1/2 at^2$, or $x_f = (0.5)(67\mbox{g})(9.81\mbox{m/s}^2/\mbox{g})(0.25\mbox{s}^2) = 20.54m$, versus the slower acceleration's case of $x_f = (4.25)(9.81)(1^2) = 20.84m$.

For top speeds, $(67)(9.81)(0.25) = 164 \mbox{m/s}$, versus the slower acceleration's $(4.25)(9.81)(1) = 41.7\mbox{m/s}$.

So my gut reaction earlier, that the slower acceleration would result in a higher top speed, was wrong. It can result in a longer distance traveled, but it looks like the top speed is lower.

But, I hope you can see that "popping up" from laying down is not realistic. You'd be better off to have some kind of spring-loaded trigger that pushed up instead of accelerating the base.

This still doesn't take into account the mass or moment of inertia; it's just looking at the base acceleration's relationship to a massless rod.

$\endgroup$
3
  • 1
    $\begingroup$ @somers - I really can't recommend simulations highly enough. When you create a simulation, there are no physical limitations unless you code them. You are free to have a motor of infinite power, which will generate unlimited torque up to an infinitely high top speed as required to meet the demands of your stabilization algorithm. You can then plot/chart the accelerations and top speeds and tune your controller until you get reasonable motor specifications. Then you could code in the physical limits and see the effects of saturation. It might be a bit of pain to set up but it's well worth it. $\endgroup$
    – Chuck
    Sep 5, 2017 at 18:08
  • $\begingroup$ You had mentioned to me a while back that my calculations were ok. I'm now worried. I chose the maximum possible torque the cart would need to be able to counteract (via acceleration from wheel force), as the torque the pendulum can exert (due to gravity) when its pitch angle is at +- 90° from the vertical. The actual maximum allowable angle deviation will be more like 5°. I also chose that much torque in the hope of being able to make the robot “pop up” from a lying down position. $\endgroup$
    – somers
    Sep 5, 2017 at 18:19
  • 1
    $\begingroup$ @somers - I revamped the answer. I did the math to try to give some numbers to the problem (performance specifications) and realized that I was wrong - lower angular accelerations for longer durations seem to result in lower top speeds, for the scenarios I evaluated. I would still really recommend you write a simulation for yourself and do the math. You should be able to generate a series of plots that gives responses, accelerations, top speeds, distances traversed, etc., for a variety of operating conditions. Again, highly recommended. $\endgroup$
    – Chuck
    Sep 5, 2017 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.