How to stop RC Servo (RCC1000_0 ) during motion?

Technical Discussions on any InterfaceKits
Post Reply
Rhybot
Phidgeteer!
Posts: 52
Joined: Wed Aug 14, 2019 4:58 pm
Contact:

How to stop RC Servo (RCC1000_0 ) during motion?

Post 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.
User avatar
Patrick
Lead Developer
Posts: 3399
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

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

Post 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
Rhybot
Phidgeteer!
Posts: 52
Joined: Wed Aug 14, 2019 4:58 pm
Contact:

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

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests