Page 1 of 1

How to stop RC Servo (RCC1000_0 ) during motion?

Posted: Fri Mar 06, 2020 4:29 pm
by Rhybot
Hello Phidget Forums,

I have an 16X RC Servo Phidget (RCC1000_0), board version 110.

I use the board to move a servo slowly (5 °/second). I do something like this:
[*] phidget.getPosition(), returns 0.0°
[*] phidget.setVelocityLimit(5.0)
[*] phidget.setTargetPosition(180.0)

How can I stop the servo in the middle of its motion?

Originally, I wanted to do something like this:

Code: Select all

phidget.setTargetPosition(phidget.getPosition())
But as shown here: viewtopic.php?p=31367, it's not possible to get position updates during motion, with this board.

Aside

When the servo's current position != target position, and it's velocity limit is 0.0 °/second, the servo's getIsMoving() method still returns True. I think, since it's not moving, getIsMoving() should return False.

Re: How to stop RC Servo (RCC1000_0 ) during motion?

Posted: Mon Mar 09, 2020 8:44 am
by Patrick
Are you using some sort of external input to decide when to stop the rotation?

I think, with the RCC1000, you will need to take some of the control into your own program, and step the servo yourself in appropriately small steps, using the TargetPositionReached event to move for example 1 degree 180 times, until you want to stop.

Maybe we should look at adding a supported way to stop a rotation early and return the current position - but this isn't possible the way the firmware is currently written.

-Patrick

Re: How to stop RC Servo (RCC1000_0 ) during motion?

Posted: Mon Mar 09, 2020 10:12 am
by Rhybot
Hi Patrick,

Thank you for responding. To answer your questions:

Yes, there is an external input: a user interface for a Python program where a user can hit a stop button.

In my use case, the servo is used in a fluid mixing application. The servo slowly moves back and forth, causing several fluids to gently mix in a rocking container. Eventually, someone decides it's mixed, and hits stop.

Per this idea:
step the servo yourself in appropriately small steps, using the TargetPositionReached event to move for example 1 degree 180 times, until you want to stop
It makes sense, and yes that would enable me to stop the motor's motion. However, the mixing would be jerky, because the motor is constantly in a state of acceleration/deceleration. I also imagine it'd negatively impact the servo motor's lifetime.

I think adding the ability to stop servos controlled with RCC1000 has merit.

The solution I have decided to go with is to use the RCC0004 board (giving live position updates), which enables me to nicely implement stop functionality.