How to use the Taco option on the PicoBorg Reverse board?

Hi,

Can you explain how to use the Taco option?
I would like to use this function in order to stop a motor when a limit sensor is active.

Thank you.

Emmanuel

piborg's picture

The taco inputs are normally used to get the PicoBorg Reverse to move a motor for a set distance.

It works by having a signal which swaps between high and low a given number of times per wheel rotation.
When the feedback mode is enabled PBR.SetEncoderMoveMode(True) the board starts counting each change.
To then move a motor for a given distance the speed is set using PBR.SetEncoderSpeed(power) and the motor is then told how many of these changes to continue to move for before stopping using PBR.EncoderMoveMotor1(counts) for either or both motors.

Normally we would use the EPO connector as a limit switch input, however we can make use of the fact that you can change the speed of the motor after setting a number of counts (taco line changes) to make it behave as a stop signal.

Below is an example of doing this for Motor 1 and getting the code to see it has hit the limit signal:

# Load any libraries we need
import time
import PicoBorgRev

# Setup the PicoBorg Reverse
PBR = PicoBorgRev.PicoBorgRev()
PBR.Init()
PBR.ResetEpo()

# Enable feedback mode
PBR.SetEncoderMoveMode(True)

# Set the motors to an initial speed of 0 (off)
PBR.SetEncoderSpeed(0)

# Tell motor 1 it should move until its taco line changes once
PBR.EncoderMoveMotor1(1)

# Loop indefinitely
while True:
    # Test if the taco line changed
    if PBR.IsEncoderMoving():
        # The taco for motor 1 has not yet changed
        # Perform any speed setting code here
        PBR.SetMotor1(0.5)
    else:
        # Motor 1 should now be stopped, exit the loop
        break
    # Wait a short while
    time.sleep(0.1)

# When finished tell the board to stop all movement
# this includes waiting for the taco line change
PBR.MotorsOff()

Bear in mind this assumes that the limit sensor is in the non-tripped state when the script is started, this is because it waits for a change instead of a high or low.

Subscribe to Comments for "How to use the Taco option on the PicoBorg Reverse board?"