Can we use motor.get_actual_velocity ( ) as limit switch?

Our team built DR4B bot and our programmer wants to use limit-switch to detect the upper limit of DR4B lift. However, we think we can accomplish this programmatically by using
“if liftmotor.get_actual_velocity ( ) == 0;”
as the arm motor moves up. If this solution works, it will save a lot of hardware hassle.

Yes, that’s doable, though not as trivial as it seems - you’d need deadbands at the start of the move and timeouts to trigger at the end. You’d also need a good and reliable mechanical hard-stop that will hit before your mechanics get into some extreme angles or where the things could break by the motor strength (V5 with 100rpm cartridge is perfectly capable of eating plastic gears when coupled to them by the metal 12t)

It might be 10-20 lines of well written code to detect the stall reliably.

2 Likes

You could also limit by motor rotations. Unless you have gear skipping, the motor will always turn the same number of rotations to get your lift from minimum to maximum height.

2 Likes