2 motor drivetrain will rotate, but will not go forward and back

myVariable = 0

def ondriver_drivercontrol_0():
    global myVariable
    arm2.set_stopping(HOLD)
    arm1.set_stopping(HOLD)
    arm2.set_velocity(75, PERCENT)
    arm1.set_velocity(75, PERCENT)
    electricSpinnyThings.set_velocity(75, PERCENT)
    drivetrain.drive(FORWARD)
    drivetrain.turn(RIGHT)
    while 1 == 1:
        drivetrain.set_drive_velocity((controller_1.axis2.position() + controller_1.axis2.position()), PERCENT)
        drivetrain.set_turn_velocity((controller_1.axis1.position() + controller_1.axis1.position()), PERCENT)
        if drivetrain.velocity(PERCENT) > 5:
            drivetrain.drive(FORWARD)
        if drivetrain.velocity(PERCENT) < 5:
            drivetrain.drive(REVERSE)
        if controller_1.buttonL2.pressing():
            arm1.spin(REVERSE)
            arm2.spin(REVERSE)
            while not not controller_1.buttonL2.pressing():
                wait(5, MSEC)
            arm1.stop()
            arm2.stop()
        if controller_1.buttonL1.pressing():
            arm1.spin(FORWARD)
            arm2.spin(FORWARD)
            while not not controller_1.buttonL1.pressing():
                wait(5, MSEC)
            arm1.stop()
            arm2.stop()
        if controller_1.axis1.position() > 5:
            drivetrain.turn(RIGHT)
        if controller_1.axis1.position() < 5:
            drivetrain.turn(LEFT)
        wait(5, MSEC)

def onauton_autonomous_0():
    global myVariable
    pass

def when_started1():
    global myVariable
    pass

# create a function for handling the starting and stopping of all autonomous tasks
def vexcode_auton_function():
    # Start the autonomous control tasks
    auton_task_0 = Thread( onauton_autonomous_0 )
    # wait for the driver control period to end
    while( competition.is_autonomous() and competition.is_enabled() ):
        # wait 10 milliseconds before checking again
        wait( 10, MSEC )
    # Stop the autonomous control tasks
    auton_task_0.stop()

def vexcode_driver_function():
    # Start the driver control tasks
    driver_control_task_0 = Thread( ondriver_drivercontrol_0 )
    # wait for the driver control period to end
    while( competition.is_driver_control() and competition.is_enabled() ):
        # wait 10 milliseconds before checking again
        wait( 10, MSEC )
    # Stop the driver control tasks
    driver_control_task_0.stop()

# register the competition functions
competition = Competition( vexcode_driver_function, vexcode_auton_function )

when_started1()

my hardware team wants me to make code to invert the controls of the robot, and i thought i had the code to do it, but my code moves the robot left, and only left. it doesn’t move right, or forwards and backwards. competition is in 2 weeks and i need this code to work.
~Jadon

1 Like