Table of Contents

Motors

This section documents the classes related to VEX smart motors and drivetrain control in DishPy.


Motor

vex.Motor

Motor class - use this to create an instance of a V5 smart motor
Arguments:
port : The smartport this device is attached to
gears (optional) : The gear cartridge installed in the motor, default is the green 18_1
reverse (optional) : Should the motor's spin direction be reversed, default is False
Returns:
A new Motor object.
Examples:
motor1 = Motor(Ports.PORT1)\
motor2 = Motor(Ports.PORT2, GearSetting.RATIO_36_1)\
motor3 = Motor(Ports.PORT3, True)\
motor4 = Motor(Ports.PORT4, GearSetting.RATIO_6_1, True)
Source code in vex.py
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
class Motor:
    '''### Motor class - use this to create an instance of a V5 smart motor

    #### Arguments:
        port : The smartport this device is attached to
        gears (optional) : The gear cartridge installed in the motor, default is the green 18_1
        reverse (optional) : Should the motor's spin direction be reversed, default is False

    #### Returns:
        A new Motor object.

    #### Examples:
        motor1 = Motor(Ports.PORT1)\\
        motor2 = Motor(Ports.PORT2, GearSetting.RATIO_36_1)\\
        motor3 = Motor(Ports.PORT3, True)\\
        motor4 = Motor(Ports.PORT4, GearSetting.RATIO_6_1, True)
    '''
    def __init__(self, port: int, *args):
        self._index = port

        self._timeout = 10000
        self._velocity = 50
        self._mode = BrakeType.COAST
        self._brakeMode = BrakeType.COAST
        self._spinMode = False

    def installed(self):
        '''### Check for device connection

        #### Arguments:
            None

        #### Returns:
            True or False
        '''
        return True

    def timestamp(self):
        '''### Request the timestamp of last received message from the motor

        #### Arguments:
            None

        #### Returns:
            timestamp of the last status packet in mS
        '''
        return 0

    def set_velocity(self, value: vexnumber, units: VelocityPercentUnits=VelocityUnits.RPM):
        '''### Set default velocity for the motor
        This will be the velocity used for subsequent calls to spin if a velocity is not provided
        to that function.

        #### Arguments:
            value : The new velocity
            units : The units for the supplied velocity, the default is RPM

        #### Returns:
            None
        '''
        self._velocity = value

    def set_reversed(self, value: bool):
        '''### Set the reverse flag for the motor
        Setting the reverse flag will cause spin commands to run the motor in reverse.

        #### Arguments:
            value : Reverse flag, True or False

        #### Returns:
            None
        '''
        pass

    def set_stopping(self, value: BrakeType.BrakeType):
        '''### Set the stopping mode of the motor
        Setting the action for the motor when stopped.

        #### Arguments:
            value : The stopping mode, COAST, BRAKE or HOLD

        #### Returns:
            None
        '''
        pass

    def reset_position(self):
        '''### Reset the motor position to 0

        #### Arguments:
            None

        #### Returns:
            None
        '''
        pass

    def set_position(self, value: vexnumber, units=RotationUnits.DEG):
        '''### Set the current position of the motor
        The position returned by the position() function is set to this value.

        #### Arguments:
            value : The new position
            units : The units for the provided position, the default is DEGREES

        #### Returns:
            None
        '''
        pass

    def set_timeout(self, value: vexnumber, units=TimeUnits.MSEC):
        '''### Set the timeout value used by the motor
        The timeout value is used when performing spin_to_position and spin_for commands.  If timeout is
         reached and the motor has not completed moving, then the spin... function will return False.

        #### Arguments:
            value : The new timeout
            units : The units for the provided timeout, the default is MSEC

        #### Returns:
            None
        '''
        self._timeout = value

    def get_timeout(self):
        '''### Returns the current value of motor timeout

        #### Arguments:
            None

        #### Returns:
            The current timeout value
        '''
        return self._timeout

    def spin(self, direction: DirectionType.DirectionType, *args, **kwargs):
        '''### Spin the motor using the provided arguments

        #### Arguments:
            direction : The direction to spin the motor, FORWARD or REVERSE
            velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
            units (optional) : The units of the provided velocity, default is RPM

        #### Returns:
            None

        #### Examples:
            # spin motor forward at velocity set with set_velocity\\
            motor1.spin(FORWARD)\n
            # spin motor forward at 50 rpm\\
            motor1.spin(FORWARD, 50)\n
            # spin with negative velocity, ie. backwards\\
            motor1.spin(FORWARD, -20)\n
            # spin motor forwards with 100% velocity\\
            motor1.spin(FORWARD, 100, PERCENT)\n
            # spin motor forwards at 50 rpm\\
            motor1.spin(FORWARD, 50, RPM)\n
            # spin motor forwards at 360 dps\\
            motor1.spin(FORWARD, 360.0, VelocityUnits.DPS)
        '''
        pass

    def spin_to_position(self, rotation: vexnumber, *args, **kwargs):
        '''### Spin the motor to an absolute position using the provided arguments
        Move the motor to the requested position.\\
        This function supports keyword arguments.

        #### Arguments:
            rotation : The position to spin the motor to
            units (optional) : The units for the provided position, the default is DEGREES
            velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
            units_v (optional) : The units of the provided velocity, default is RPM
            wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.

        #### Returns:
            None

        #### Examples:
            # spin to 180 degrees\\
            motor1.spin_to_position(180)\n
            # spin to 2 TURNS (revolutions)\\
            motor1.spin_to_position(2, TURNS) \n
            # spin to 180 degrees at 25 rpm\\
            motor1.spin_to_position(180, DEGREES, 25, RPM)\n
            # spin to 180 degrees and do not wait for completion\\
            motor1.spin_to_position(180, DEGREES, False)\n
            # spin to 180 degrees and do not wait for completion\\
            motor1.spin_to_position(180, DEGREES, wait=False)
        '''
        pass

    def spin_for(self, direction: DirectionType.DirectionType, rot_or_time: vexnumber, *args, **kwargs):
        '''### Spin the motor to a relative position using the provided arguments
        Move the motor to the requested position or for the specified amount of time.\\
        The position is relative (ie. an offset) to the current position\\
        This function supports keyword arguments.

        #### Arguments:
            dir : The direction to spin the motor, FORWARD or REVERSE
            rot_or_time : The relative position to spin the motor to or tha amount of time to spin for
            units (optional) : The units for the provided position or time, the default is DEGREES or MSEC
            velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
            units_v (optional) : The units of the provided velocity, default is RPM
            wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.

        #### Returns:
            None

        #### Examples:
            # spin 180 degrees from the current position\\
            motor1.spin_for(FORWARD, 180)\n
            # spin reverse 2 TURNS (revolutions) from the current position\\
            motor1.spin_for(REVERSE, 2, TURNS)\n
            # spin 180 degrees from the current position at 25 rpm\\
            motor1.spin_for(FORWARD, 180, DEGREES, 25, RPM)\n
            # spin 180 degrees  from the current position and do not wait for completion\\
            motor1.spin_for(FORWARD, 180, DEGREES, False)\n
            # spin 180 degrees  from the current position and do not wait for completion\\
            motor1.spin_for(FORWARD, 180, DEGREES, wait=False)
        '''
        pass

    def is_spinning(self):
        '''### Returns the current status of the spin_to_position or spin_for command
        This function is used when False has been passed as the wait parameter to spin_to_position or spin_for\\
        It will return True if the motor is still spinning or False if it has completed the move or a timeout occurred.

        #### Arguments:
            None

        #### Returns:
            The current spin_to_position or spin_for status
        '''
        return True

    def is_done(self):
        '''### Returns the current status of the spin_to_position or spin_for command
        This function is used when False has been passed as the wait parameter to spin_to_position or spin_for\\
        It will return False if the motor is still spinning or True if it has completed the move or a timeout occurred.

        #### Arguments:
            None

        #### Returns:
            The current spin_to_position or spin_for status
        '''
        return True

    def is_spinning_mode(self):
        return False

    def stop(self, mode=None):
        '''### Stop the motor, set to 0 velocity and set current stopping_mode
        The motor will be stopped and set to COAST, BRAKE or HOLD

        #### Arguments:
            None

        #### Returns:
            None
        '''
        pass

    def set_max_torque(self, value, units: TorquePercentCurrentUnits):
        '''### Set the maximum torque the motor will use
        The torque can be set as torque, current or percent of maximum.

        #### Arguments:
            value : the new maximum torque to use
            units : the units that value is passed in

        #### Returns:
            None

        #### Examples:
            # set maximum torque to 2 Nm\\
            motor1.set_max_torque(2, TorqueUnits.NM)\n
            # set maximum torque to 1 Amp\\
            motor1.set_max_torque(1, CurrentUnits.AMP)\n
            # set maximum torque to 20 percent\\
            motor1.set_max_torque(20, PERCENT)
        '''
        pass

    def direction(self):
        '''### Returns the current direction the motor is spinning in

        #### Arguments:
            None

        #### Returns:
            The spin direction, FORWARD, REVERSE or UNDEFINED
        '''
        return DirectionType.FORWARD

    def position(self, *args):
        '''### Returns the position of the motor

        #### Arguments:
            units (optional) : The units for the returned position, the default is DEGREES

        #### Returns:
            The motor position in provided units
        '''
        return 20

    def velocity(self, *args):
        '''### Returns the velocity of the motor

        #### Arguments:
            units (optional) : The units for the returned velocity, the default is RPM

        #### Returns:
            The motor velocity in provided units
        '''
        return 2

    def current(self, *args):
        '''### Returns the current the motor is using

        #### Arguments:
            units (optional) : The units for the returned current, the default is AMP

        #### Returns:
            The motor current in provided units
        '''
        return 1

    def power(self, *args):
        '''### Returns the power the motor is providing

        #### Arguments:
            units (optional) : The units for the returned power, the default is WATT

        #### Returns:
            The motor power in provided units
        '''
        return 1

    def torque(self, *args):
        '''### Returns the torque the motor is providing

        #### Arguments:
            units (optional) : The units for the returned torque, the default is NM

        #### Returns:
            The motor torque in provided units
        '''
        return 1

    def efficiency(self, *args):
        '''### Returns the efficiency of the motor

        #### Arguments:
            units (optional) : The units for the efficiency, the only valid value is PERCENT

        #### Returns:
            The motor efficiency in percent
        '''
        return 1

    def temperature(self, *args):
        '''### Returns the temperature of the motor

        #### Arguments:
            units (optional) : The units for the returned temperature, the default is CELSIUS

        #### Returns:
            The motor temperature in provided units
        '''
        return 1

    def command(self, *args):
        '''### Returns the last velocity sent to the motor

        #### Arguments:
            units (optional) : The units for the returned velocity, the default is RPM

        #### Returns:
            The motor command velocity in provided units
        '''
        return self._velocity

command(*args)

Returns the last velocity sent to the motor
Arguments:
units (optional) : The units for the returned velocity, the default is RPM
Returns:
The motor command velocity in provided units
Source code in vex.py
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
def command(self, *args):
    '''### Returns the last velocity sent to the motor

    #### Arguments:
        units (optional) : The units for the returned velocity, the default is RPM

    #### Returns:
        The motor command velocity in provided units
    '''
    return self._velocity

current(*args)

Returns the current the motor is using
Arguments:
units (optional) : The units for the returned current, the default is AMP
Returns:
The motor current in provided units
Source code in vex.py
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
def current(self, *args):
    '''### Returns the current the motor is using

    #### Arguments:
        units (optional) : The units for the returned current, the default is AMP

    #### Returns:
        The motor current in provided units
    '''
    return 1

direction()

Returns the current direction the motor is spinning in
Arguments:
None
Returns:
The spin direction, FORWARD, REVERSE or UNDEFINED
Source code in vex.py
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
def direction(self):
    '''### Returns the current direction the motor is spinning in

    #### Arguments:
        None

    #### Returns:
        The spin direction, FORWARD, REVERSE or UNDEFINED
    '''
    return DirectionType.FORWARD

efficiency(*args)

Returns the efficiency of the motor
Arguments:
units (optional) : The units for the efficiency, the only valid value is PERCENT
Returns:
The motor efficiency in percent
Source code in vex.py
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
def efficiency(self, *args):
    '''### Returns the efficiency of the motor

    #### Arguments:
        units (optional) : The units for the efficiency, the only valid value is PERCENT

    #### Returns:
        The motor efficiency in percent
    '''
    return 1

get_timeout()

Returns the current value of motor timeout
Arguments:
None
Returns:
The current timeout value
Source code in vex.py
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
def get_timeout(self):
    '''### Returns the current value of motor timeout

    #### Arguments:
        None

    #### Returns:
        The current timeout value
    '''
    return self._timeout

installed()

Check for device connection
Arguments:
None
Returns:
True or False
Source code in vex.py
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
def installed(self):
    '''### Check for device connection

    #### Arguments:
        None

    #### Returns:
        True or False
    '''
    return True

is_done()

Returns the current status of the spin_to_position or spin_for command

This function is used when False has been passed as the wait parameter to spin_to_position or spin_for\ It will return False if the motor is still spinning or True if it has completed the move or a timeout occurred.

Arguments:
None
Returns:
The current spin_to_position or spin_for status
Source code in vex.py
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
def is_done(self):
    '''### Returns the current status of the spin_to_position or spin_for command
    This function is used when False has been passed as the wait parameter to spin_to_position or spin_for\\
    It will return False if the motor is still spinning or True if it has completed the move or a timeout occurred.

    #### Arguments:
        None

    #### Returns:
        The current spin_to_position or spin_for status
    '''
    return True

is_spinning()

Returns the current status of the spin_to_position or spin_for command

This function is used when False has been passed as the wait parameter to spin_to_position or spin_for\ It will return True if the motor is still spinning or False if it has completed the move or a timeout occurred.

Arguments:
None
Returns:
The current spin_to_position or spin_for status
Source code in vex.py
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
def is_spinning(self):
    '''### Returns the current status of the spin_to_position or spin_for command
    This function is used when False has been passed as the wait parameter to spin_to_position or spin_for\\
    It will return True if the motor is still spinning or False if it has completed the move or a timeout occurred.

    #### Arguments:
        None

    #### Returns:
        The current spin_to_position or spin_for status
    '''
    return True

position(*args)

Returns the position of the motor
Arguments:
units (optional) : The units for the returned position, the default is DEGREES
Returns:
The motor position in provided units
Source code in vex.py
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
def position(self, *args):
    '''### Returns the position of the motor

    #### Arguments:
        units (optional) : The units for the returned position, the default is DEGREES

    #### Returns:
        The motor position in provided units
    '''
    return 20

power(*args)

Returns the power the motor is providing
Arguments:
units (optional) : The units for the returned power, the default is WATT
Returns:
The motor power in provided units
Source code in vex.py
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
def power(self, *args):
    '''### Returns the power the motor is providing

    #### Arguments:
        units (optional) : The units for the returned power, the default is WATT

    #### Returns:
        The motor power in provided units
    '''
    return 1

reset_position()

Reset the motor position to 0
Arguments:
None
Returns:
None
Source code in vex.py
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
def reset_position(self):
    '''### Reset the motor position to 0

    #### Arguments:
        None

    #### Returns:
        None
    '''
    pass

set_max_torque(value, units)

Set the maximum torque the motor will use

The torque can be set as torque, current or percent of maximum.

Arguments:
value : the new maximum torque to use
units : the units that value is passed in
Returns:
None
Examples:
# set maximum torque to 2 Nm\
motor1.set_max_torque(2, TorqueUnits.NM)

# set maximum torque to 1 Amp\
motor1.set_max_torque(1, CurrentUnits.AMP)

# set maximum torque to 20 percent\
motor1.set_max_torque(20, PERCENT)
Source code in vex.py
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
def set_max_torque(self, value, units: TorquePercentCurrentUnits):
    '''### Set the maximum torque the motor will use
    The torque can be set as torque, current or percent of maximum.

    #### Arguments:
        value : the new maximum torque to use
        units : the units that value is passed in

    #### Returns:
        None

    #### Examples:
        # set maximum torque to 2 Nm\\
        motor1.set_max_torque(2, TorqueUnits.NM)\n
        # set maximum torque to 1 Amp\\
        motor1.set_max_torque(1, CurrentUnits.AMP)\n
        # set maximum torque to 20 percent\\
        motor1.set_max_torque(20, PERCENT)
    '''
    pass

set_position(value, units=RotationUnits.DEG)

Set the current position of the motor

The position returned by the position() function is set to this value.

Arguments:
value : The new position
units : The units for the provided position, the default is DEGREES
Returns:
None
Source code in vex.py
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
def set_position(self, value: vexnumber, units=RotationUnits.DEG):
    '''### Set the current position of the motor
    The position returned by the position() function is set to this value.

    #### Arguments:
        value : The new position
        units : The units for the provided position, the default is DEGREES

    #### Returns:
        None
    '''
    pass

set_reversed(value)

Set the reverse flag for the motor

Setting the reverse flag will cause spin commands to run the motor in reverse.

Arguments:
value : Reverse flag, True or False
Returns:
None
Source code in vex.py
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
def set_reversed(self, value: bool):
    '''### Set the reverse flag for the motor
    Setting the reverse flag will cause spin commands to run the motor in reverse.

    #### Arguments:
        value : Reverse flag, True or False

    #### Returns:
        None
    '''
    pass

set_stopping(value)

Set the stopping mode of the motor

Setting the action for the motor when stopped.

Arguments:
value : The stopping mode, COAST, BRAKE or HOLD
Returns:
None
Source code in vex.py
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
def set_stopping(self, value: BrakeType.BrakeType):
    '''### Set the stopping mode of the motor
    Setting the action for the motor when stopped.

    #### Arguments:
        value : The stopping mode, COAST, BRAKE or HOLD

    #### Returns:
        None
    '''
    pass

set_timeout(value, units=TimeUnits.MSEC)

Set the timeout value used by the motor

The timeout value is used when performing spin_to_position and spin_for commands. If timeout is reached and the motor has not completed moving, then the spin... function will return False.

Arguments:
value : The new timeout
units : The units for the provided timeout, the default is MSEC
Returns:
None
Source code in vex.py
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
def set_timeout(self, value: vexnumber, units=TimeUnits.MSEC):
    '''### Set the timeout value used by the motor
    The timeout value is used when performing spin_to_position and spin_for commands.  If timeout is
     reached and the motor has not completed moving, then the spin... function will return False.

    #### Arguments:
        value : The new timeout
        units : The units for the provided timeout, the default is MSEC

    #### Returns:
        None
    '''
    self._timeout = value

set_velocity(value, units=VelocityUnits.RPM)

Set default velocity for the motor

This will be the velocity used for subsequent calls to spin if a velocity is not provided to that function.

Arguments:
value : The new velocity
units : The units for the supplied velocity, the default is RPM
Returns:
None
Source code in vex.py
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
def set_velocity(self, value: vexnumber, units: VelocityPercentUnits=VelocityUnits.RPM):
    '''### Set default velocity for the motor
    This will be the velocity used for subsequent calls to spin if a velocity is not provided
    to that function.

    #### Arguments:
        value : The new velocity
        units : The units for the supplied velocity, the default is RPM

    #### Returns:
        None
    '''
    self._velocity = value

spin(direction, *args, **kwargs)

Spin the motor using the provided arguments
Arguments:
direction : The direction to spin the motor, FORWARD or REVERSE
velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
units (optional) : The units of the provided velocity, default is RPM
Returns:
None
Examples:
# spin motor forward at velocity set with set_velocity\
motor1.spin(FORWARD)

# spin motor forward at 50 rpm\
motor1.spin(FORWARD, 50)

# spin with negative velocity, ie. backwards\
motor1.spin(FORWARD, -20)

# spin motor forwards with 100% velocity\
motor1.spin(FORWARD, 100, PERCENT)

# spin motor forwards at 50 rpm\
motor1.spin(FORWARD, 50, RPM)

# spin motor forwards at 360 dps\
motor1.spin(FORWARD, 360.0, VelocityUnits.DPS)
Source code in vex.py
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
def spin(self, direction: DirectionType.DirectionType, *args, **kwargs):
    '''### Spin the motor using the provided arguments

    #### Arguments:
        direction : The direction to spin the motor, FORWARD or REVERSE
        velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
        units (optional) : The units of the provided velocity, default is RPM

    #### Returns:
        None

    #### Examples:
        # spin motor forward at velocity set with set_velocity\\
        motor1.spin(FORWARD)\n
        # spin motor forward at 50 rpm\\
        motor1.spin(FORWARD, 50)\n
        # spin with negative velocity, ie. backwards\\
        motor1.spin(FORWARD, -20)\n
        # spin motor forwards with 100% velocity\\
        motor1.spin(FORWARD, 100, PERCENT)\n
        # spin motor forwards at 50 rpm\\
        motor1.spin(FORWARD, 50, RPM)\n
        # spin motor forwards at 360 dps\\
        motor1.spin(FORWARD, 360.0, VelocityUnits.DPS)
    '''
    pass

spin_for(direction, rot_or_time, *args, **kwargs)

Spin the motor to a relative position using the provided arguments

Move the motor to the requested position or for the specified amount of time.\ The position is relative (ie. an offset) to the current position\ This function supports keyword arguments.

Arguments:
dir : The direction to spin the motor, FORWARD or REVERSE
rot_or_time : The relative position to spin the motor to or tha amount of time to spin for
units (optional) : The units for the provided position or time, the default is DEGREES or MSEC
velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
units_v (optional) : The units of the provided velocity, default is RPM
wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.
Returns:
None
Examples:
# spin 180 degrees from the current position\
motor1.spin_for(FORWARD, 180)

# spin reverse 2 TURNS (revolutions) from the current position\
motor1.spin_for(REVERSE, 2, TURNS)

# spin 180 degrees from the current position at 25 rpm\
motor1.spin_for(FORWARD, 180, DEGREES, 25, RPM)

# spin 180 degrees  from the current position and do not wait for completion\
motor1.spin_for(FORWARD, 180, DEGREES, False)

# spin 180 degrees  from the current position and do not wait for completion\
motor1.spin_for(FORWARD, 180, DEGREES, wait=False)
Source code in vex.py
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
def spin_for(self, direction: DirectionType.DirectionType, rot_or_time: vexnumber, *args, **kwargs):
    '''### Spin the motor to a relative position using the provided arguments
    Move the motor to the requested position or for the specified amount of time.\\
    The position is relative (ie. an offset) to the current position\\
    This function supports keyword arguments.

    #### Arguments:
        dir : The direction to spin the motor, FORWARD or REVERSE
        rot_or_time : The relative position to spin the motor to or tha amount of time to spin for
        units (optional) : The units for the provided position or time, the default is DEGREES or MSEC
        velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
        units_v (optional) : The units of the provided velocity, default is RPM
        wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.

    #### Returns:
        None

    #### Examples:
        # spin 180 degrees from the current position\\
        motor1.spin_for(FORWARD, 180)\n
        # spin reverse 2 TURNS (revolutions) from the current position\\
        motor1.spin_for(REVERSE, 2, TURNS)\n
        # spin 180 degrees from the current position at 25 rpm\\
        motor1.spin_for(FORWARD, 180, DEGREES, 25, RPM)\n
        # spin 180 degrees  from the current position and do not wait for completion\\
        motor1.spin_for(FORWARD, 180, DEGREES, False)\n
        # spin 180 degrees  from the current position and do not wait for completion\\
        motor1.spin_for(FORWARD, 180, DEGREES, wait=False)
    '''
    pass

spin_to_position(rotation, *args, **kwargs)

Spin the motor to an absolute position using the provided arguments

Move the motor to the requested position.\ This function supports keyword arguments.

Arguments:
rotation : The position to spin the motor to
units (optional) : The units for the provided position, the default is DEGREES
velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
units_v (optional) : The units of the provided velocity, default is RPM
wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.
Returns:
None
Examples:
# spin to 180 degrees\
motor1.spin_to_position(180)

# spin to 2 TURNS (revolutions)\
motor1.spin_to_position(2, TURNS)

# spin to 180 degrees at 25 rpm\
motor1.spin_to_position(180, DEGREES, 25, RPM)

# spin to 180 degrees and do not wait for completion\
motor1.spin_to_position(180, DEGREES, False)

# spin to 180 degrees and do not wait for completion\
motor1.spin_to_position(180, DEGREES, wait=False)
Source code in vex.py
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
def spin_to_position(self, rotation: vexnumber, *args, **kwargs):
    '''### Spin the motor to an absolute position using the provided arguments
    Move the motor to the requested position.\\
    This function supports keyword arguments.

    #### Arguments:
        rotation : The position to spin the motor to
        units (optional) : The units for the provided position, the default is DEGREES
        velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
        units_v (optional) : The units of the provided velocity, default is RPM
        wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.

    #### Returns:
        None

    #### Examples:
        # spin to 180 degrees\\
        motor1.spin_to_position(180)\n
        # spin to 2 TURNS (revolutions)\\
        motor1.spin_to_position(2, TURNS) \n
        # spin to 180 degrees at 25 rpm\\
        motor1.spin_to_position(180, DEGREES, 25, RPM)\n
        # spin to 180 degrees and do not wait for completion\\
        motor1.spin_to_position(180, DEGREES, False)\n
        # spin to 180 degrees and do not wait for completion\\
        motor1.spin_to_position(180, DEGREES, wait=False)
    '''
    pass

stop(mode=None)

Stop the motor, set to 0 velocity and set current stopping_mode

The motor will be stopped and set to COAST, BRAKE or HOLD

Arguments:
None
Returns:
None
Source code in vex.py
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
def stop(self, mode=None):
    '''### Stop the motor, set to 0 velocity and set current stopping_mode
    The motor will be stopped and set to COAST, BRAKE or HOLD

    #### Arguments:
        None

    #### Returns:
        None
    '''
    pass

temperature(*args)

Returns the temperature of the motor
Arguments:
units (optional) : The units for the returned temperature, the default is CELSIUS
Returns:
The motor temperature in provided units
Source code in vex.py
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
def temperature(self, *args):
    '''### Returns the temperature of the motor

    #### Arguments:
        units (optional) : The units for the returned temperature, the default is CELSIUS

    #### Returns:
        The motor temperature in provided units
    '''
    return 1

timestamp()

Request the timestamp of last received message from the motor
Arguments:
None
Returns:
timestamp of the last status packet in mS
Source code in vex.py
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
def timestamp(self):
    '''### Request the timestamp of last received message from the motor

    #### Arguments:
        None

    #### Returns:
        timestamp of the last status packet in mS
    '''
    return 0

torque(*args)

Returns the torque the motor is providing
Arguments:
units (optional) : The units for the returned torque, the default is NM
Returns:
The motor torque in provided units
Source code in vex.py
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
def torque(self, *args):
    '''### Returns the torque the motor is providing

    #### Arguments:
        units (optional) : The units for the returned torque, the default is NM

    #### Returns:
        The motor torque in provided units
    '''
    return 1

velocity(*args)

Returns the velocity of the motor
Arguments:
units (optional) : The units for the returned velocity, the default is RPM
Returns:
The motor velocity in provided units
Source code in vex.py
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
def velocity(self, *args):
    '''### Returns the velocity of the motor

    #### Arguments:
        units (optional) : The units for the returned velocity, the default is RPM

    #### Returns:
        The motor velocity in provided units
    '''
    return 2

MotorGroup

vex.MotorGroup

MotorGroup class - use this to create a group of motors
Arguments:
One or more Motor class instances
Returns:
A new MotorGroup object.
Examples:
motor1 = Motor(Ports.PORT1)\
motor2 = Motor(Ports.PORT2)\
mg1 = MotorGroup(motor1, motor2)
Source code in vex.py
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
class MotorGroup:
    '''### MotorGroup class - use this to create a group of motors

    #### Arguments:
        One or more Motor class instances

    #### Returns:
        A new MotorGroup object.

    #### Examples:
        motor1 = Motor(Ports.PORT1)\\
        motor2 = Motor(Ports.PORT2)\\
        mg1 = MotorGroup(motor1, motor2)
    '''
    def __init__(self, *argv):
        self._motors = list()

        for arg in argv:
            if isinstance(arg, Motor):
                self._motors.append(arg)

        self._timeout = sys.maxsize

# ----------------------------------------------------------------------------
    def count(self):
        '''### return the number of motors in the group

        #### Arguments:
            None

        #### Returns:
            The number of motors in the group
        '''
        return len(self._motors)

# ----------------------------------------------------------------------------
    def set_velocity(self, velocity, units=None):
        '''### Set default velocity for all motors in the group
        This will be the velocity used for subsequent calls to spin if a velocity is not provided
        to that function.

        #### Arguments:
            velocity : The new velocity
            units : The units for the supplied velocity, the default is RPM

        #### Returns:
            None
        '''
        for m in self._motors:
            m.set_velocity(velocity, units)

# ----------------------------------------------------------------------------
    def set_stopping(self, mode=BrakeType.COAST):
        '''### Set the stopping mode for all motors in the group
        Setting the action for the motor when stopped.

        #### Arguments:
            mode : The stopping mode, COAST, BRAKE or HOLD

        #### Returns:
            None
        '''
        for m in self._motors:
            m.set_stopping(mode)

# ----------------------------------------------------------------------------
    def reset_position(self):
        '''### Reset the motor position to 0 for all motors in the group

        #### Arguments:
            None

        #### Returns:
            None
        '''
        for m in self._motors:
            m.reset_position()

# ----------------------------------------------------------------------------
    def set_position(self, value, units=None):
        '''### Set the current position for all motors in the group
        The position returned by the position() function is set to this value.

        #### Arguments:
            value : The new position
            units : The units for the provided position, the default is DEGREES

        #### Returns:
            None
        '''
        for m in self._motors:
            m.set_position(value, units)

# ----------------------------------------------------------------------------
    def set_timeout(self, timeout, units=TimeUnits.MSEC):
        '''### Set the timeout value used for all motors in the group
        The timeout value is used when performing spin_to_position and spin_for commands.  If timeout is
         reached and the motor has not completed moving, then the spin... function will return False.

        #### Arguments:
            timeout : The new timeout
            units : The units for the provided timeout, the default is MSEC

        #### Returns:
            None
        '''
        if units == TimeUnits.SECONDS and timeout > 0:
            if timeout > 100000:
                timeout = 100000
            self._timeout = timeout * 1000
        elif timeout <= 0:
            self._timeout = sys.maxsize
        else:
            self._timeout = timeout

        for m in self._motors:
            m.set_timeout(timeout, units)

# ----------------------------------------------------------------------------
    def spin(self, direction, velocity=None, units:VelocityPercentUnits=VelocityUnits.RPM):
        '''### Spin all motors in the group using the provided arguments

        #### Arguments:
            direction : The direction to spin the motor, FORWARD or REVERSE
            velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
            units (optional) : The units of the provided velocity, default is RPM

        #### Returns:
            None

        #### Examples:
            # spin motors forward at velocity set with set_velocity\\
            mg1.spin(FORWARD)\n
            # spin motors forward at 50 rpm\\
            mg1.spin(FORWARD, 50)\n
            # spin with negative velocity, ie. backwards\\
            mg1.spin(FORWARD, -20)\n
            # spin motors forwards with 100% velocity\\
            mg1.spin(FORWARD, 100, PERCENT)\n
            # spin motors forwards at 50 rpm\\
            mg1.spin(FORWARD, 50, RPM)\n
            # spin motors forwards at 360 dps\\
            mg1.spin(FORWARD, 360.0, VelocityUnits.DPS)
        '''
        for m in self._motors:
            m.spin(direction, velocity, units)

# ----------------------------------------------------------------------------
    def spin_to_position(self, rotation, units=RotationUnits.DEG,
                         velocity=None, units_v:VelocityPercentUnits=VelocityUnits.RPM, wait=True):
        '''### Spin all motors in the group to an absolute position using the provided arguments
        Move the motor to the requested position.\\
        This function supports keyword arguments.

        #### Arguments:
            rotation : The position to spin the motor to
            units (optional) : The units for the provided position, the default is DEGREES
            velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
            units_v (optional) : The units of the provided velocity, default is RPM
            wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.

        #### Returns:
            None

        #### Examples:
            # spin to 180 degrees\\
            mg1.spin_to_position(180)\n
            # spin to 2 TURNS (revolutions)\\
            mg1.spin_to_position(2, TURNS) \n
            # spin to 180 degrees at 25 rpm\\
            mg1.spin_to_position(180, DEGREES, 25, RPM)\n
            # spin to 180 degrees and do not wait for completion\\
            mg1.spin_to_position(180, DEGREES, False)\n
            # spin to 180 degrees and do not wait for completion\\
            mg1.spin_to_position(180, DEGREES, wait=False)
        '''
        for m in self._motors:
            m.spin_to_position(rotation, units, velocity, units_v, False)

        if wait:
            return self.__waitForCompletionAll()

        return False

# ----------------------------------------------------------------------------
    def __spin_for_distance(self, direction, rotation, units,
                            velocity, units_v, wait):
        for m in self._motors:
            m.spin_for(direction, rotation, units, velocity, units_v, False)

        if wait:
            return self.__waitForCompletionAll()

        return False

# ----------------------------------------------------------------------------
    def __spin_for_time(self, direction, time, units, velocity, units_v):
        for m in self._motors:
            if m == self._motors[-1]:
                m.spin_for(direction, time, units, velocity, units_v)
            else:
                m.spin(direction, velocity, units_v)

        self.stop()

# ----------------------------------------------------------------------------
    def spin_for(self, direction, rotation, units:RotationTimeUnits=RotationUnits.DEG,
                 velocity=None, units_v:VelocityPercentUnits=VelocityUnits.RPM, wait=True):
        '''### Spin all motors in the group to a relative position using the provided arguments
        Move the motor to the requested position or for the specified amount of time.\\
        The position is relative (ie. an offset) to the current position\\
        This function supports keyword arguments.

        #### Arguments:
            direction : The direction to spin the motor, FORWARD or REVERSE
            rotation : The relative position to spin the motor to or tha amount of time to spin for
            units (optional) : The units for the provided position or time, the default is DEGREES or MSEC
            velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
            units_v (optional) : The units of the provided velocity, default is RPM
            wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.

        #### Returns:
            None

        #### Examples:
            # spin 180 degrees from the current position\\
            mg1.spin_for(FORWARD, 180)\n
            # spin reverse 2 TURNS (revolutions) from the current position\\
            mg1.spin_for(REVERSE, 2, TURNS)\n
            # spin 180 degrees from the current position at 25 rpm\\
            mg1.spin_for(FORWARD, 180, DEGREES, 25, RPM)\n
            # spin 180 degrees  from the current position and do not wait for completion\\
            mg1.spin_for(FORWARD, 180, DEGREES, False)\n
            # spin 180 degrees  from the current position and do not wait for completion\\
            mg1.spin_for(FORWARD, 180, DEGREES, wait=False)
        '''
        if isinstance(units, TimeUnits):
            time = rotation
            self.__spin_for_time(direction, time, units, velocity, units_v)
        else:
            self.__spin_for_distance(
                direction, rotation, units, velocity, units_v, wait)

# ----------------------------------------------------------------------------
    def is_spinning(self):
        '''### Returns the current status of the spin_to_position or spin_for command
        This function is used when False has been passed as the wait parameter to spin_to_position or spin_for\\
        It will return True if any motor is still spinning or False if they have completed the move or a timeout occurred.

        #### Arguments:
            None

        #### Returns:
            The current spin_to_position or spin_for status
        '''
        isAnyMotorSpinning = False
        for m in self._motors:
            isAnyMotorSpinning = isAnyMotorSpinning or m.is_spinning()
        return isAnyMotorSpinning

# ----------------------------------------------------------------------------
    def is_spinning_mode(self):
        isAnyMotorSpinningMode = False
        for m in self._motors:
            isAnyMotorSpinningMode = isAnyMotorSpinningMode or m.is_spinning_mode()
        return isAnyMotorSpinningMode

# ----------------------------------------------------------------------------
    def is_done(self):
        '''### Returns the current status of the spin_to_position or spin_for command
        This function is used when False has been passed as the wait parameter to spin_to_position or spin_for\\
        It will return False if any motor is still spinning or True if they have completed the move or a timeout occurred.

        #### Arguments:
            None

        #### Returns:
            The current spin_to_position or spin_for status
        '''
        return not self.is_spinning()

# ----------------------------------------------------------------------------
    def stop(self, mode=None):
        '''### Stop all motors in the group, set to 0 velocity and set current stopping_mode
        The motor will be stopped and set to COAST, BRAKE or HOLD

        #### Arguments:
            None

        #### Returns:
            None
        '''
        for m in self._motors:
            m.stop(mode)

# ----------------------------------------------------------------------------
    def set_max_torque(self, value, units:TorquePercentCurrentUnits=TorqueUnits.NM):
        '''### Set the maximum torque all motors in the group will use
        The torque can be set as torque, current or percent of maximum.

        #### Arguments:
            value : the new maximum torque to use
            units : the units that value is passed in

        #### Returns:
            None

        #### Examples:
            # set maximum torque to 2 Nm\\
            motor1.set_max_torque(2, TorqueUnits.NM)\n
            # set maximum torque to 1 Amp\\
            motor1.set_max_torque(1, CurrentUnits.AMP)\n
            # set maximum torque to 20 percent\\
            motor1.set_max_torque(20, PERCENT)
        '''
        for m in self._motors:
            m.set_max_torque(value, units)

# ----------------------------------------------------------------------------
    def direction(self):
        '''### Returns the current direction the first motor is spinning in

        #### Arguments:
            None

        #### Returns:
            The spin direction, FORWARD, REVERSE or UNDEFINED
        '''
        return self._motors[0].direction()

# ----------------------------------------------------------------------------
    def position(self, units=RotationUnits.DEG):
        '''### Returns the position of the first motor

        #### Arguments:
            units (optional) : The units for the returned position, the default is DEGREES

        #### Returns:
            The motor position in provided units
        '''
        return self._motors[0].position(units)

# ----------------------------------------------------------------------------
    def velocity(self, units:VelocityPercentUnits=VelocityUnits.RPM):
        '''### Returns the velocity of the first motor

        #### Arguments:
            units (optional) : The units for the returned velocity, the default is RPM

        #### Returns:
            The motor velocity in provided units
        '''
        return self._motors[0].velocity(units)

# ----------------------------------------------------------------------------
    def current(self, units=CurrentUnits.AMP):
        '''### Returns the total current all motors are using

        #### Arguments:
            units (optional) : The units for the returned current, the default is AMP

        #### Returns:
            The motor current in provided units
        '''
        total_current = 0
        for m in self._motors:
            total_current += m.current(units)
        return total_current

# ----------------------------------------------------------------------------
    def power(self, units=PowerUnits.WATT):
        '''### Returns the power the first motor is providing

        #### Arguments:
            units (optional) : The units for the returned power, the default is WATT

        #### Returns:
            The motor power in provided units
        '''
        return self._motors[0].power(units)

# ----------------------------------------------------------------------------
    def torque(self, units:TorquePercentCurrentUnits=TorqueUnits.NM):
        '''### Returns the torque the first motor is providing

        #### Arguments:
            units (optional) : The units for the returned torque, the default is NM

        #### Returns:
            The motor torque in provided units
        '''
        return self._motors[0].torque(units)

# ----------------------------------------------------------------------------
    def efficiency(self, units=PercentUnits.PERCENT):
        '''### Returns the efficiency of the first motor

        #### Arguments:
            units (optional) : The units for the efficiency, the only valid value is PERCENT

        #### Returns:
            The motor efficiency in percent
        '''
        return self._motors[0].efficiency(units)

# ----------------------------------------------------------------------------
    def temperature(self, units=TemperatureUnits.CELSIUS):
        '''### Returns the temperature of the first motor

        #### Arguments:
            units (optional) : The units for the returned temperature, the default is CELSIUS

        #### Returns:
            The motor temperature in provided units
        '''
        return self._motors[0].temperature(units)

# ----------------------------------------------------------------------------
    def __waitForCompletionAll(self):
        t = self._timeout
        while t > 0 and self.is_spinning():
            t -= 10
            sleep(10)

        done = self.is_done()
        if not done:
            self.stop()

        return done

count()

return the number of motors in the group
Arguments:
None
Returns:
The number of motors in the group
Source code in vex.py
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
def count(self):
    '''### return the number of motors in the group

    #### Arguments:
        None

    #### Returns:
        The number of motors in the group
    '''
    return len(self._motors)

current(units=CurrentUnits.AMP)

Returns the total current all motors are using
Arguments:
units (optional) : The units for the returned current, the default is AMP
Returns:
The motor current in provided units
Source code in vex.py
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
def current(self, units=CurrentUnits.AMP):
    '''### Returns the total current all motors are using

    #### Arguments:
        units (optional) : The units for the returned current, the default is AMP

    #### Returns:
        The motor current in provided units
    '''
    total_current = 0
    for m in self._motors:
        total_current += m.current(units)
    return total_current

direction()

Returns the current direction the first motor is spinning in
Arguments:
None
Returns:
The spin direction, FORWARD, REVERSE or UNDEFINED
Source code in vex.py
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
def direction(self):
    '''### Returns the current direction the first motor is spinning in

    #### Arguments:
        None

    #### Returns:
        The spin direction, FORWARD, REVERSE or UNDEFINED
    '''
    return self._motors[0].direction()

efficiency(units=PercentUnits.PERCENT)

Returns the efficiency of the first motor
Arguments:
units (optional) : The units for the efficiency, the only valid value is PERCENT
Returns:
The motor efficiency in percent
Source code in vex.py
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
def efficiency(self, units=PercentUnits.PERCENT):
    '''### Returns the efficiency of the first motor

    #### Arguments:
        units (optional) : The units for the efficiency, the only valid value is PERCENT

    #### Returns:
        The motor efficiency in percent
    '''
    return self._motors[0].efficiency(units)

is_done()

Returns the current status of the spin_to_position or spin_for command

This function is used when False has been passed as the wait parameter to spin_to_position or spin_for\ It will return False if any motor is still spinning or True if they have completed the move or a timeout occurred.

Arguments:
None
Returns:
The current spin_to_position or spin_for status
Source code in vex.py
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
def is_done(self):
    '''### Returns the current status of the spin_to_position or spin_for command
    This function is used when False has been passed as the wait parameter to spin_to_position or spin_for\\
    It will return False if any motor is still spinning or True if they have completed the move or a timeout occurred.

    #### Arguments:
        None

    #### Returns:
        The current spin_to_position or spin_for status
    '''
    return not self.is_spinning()

is_spinning()

Returns the current status of the spin_to_position or spin_for command

This function is used when False has been passed as the wait parameter to spin_to_position or spin_for\ It will return True if any motor is still spinning or False if they have completed the move or a timeout occurred.

Arguments:
None
Returns:
The current spin_to_position or spin_for status
Source code in vex.py
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
def is_spinning(self):
    '''### Returns the current status of the spin_to_position or spin_for command
    This function is used when False has been passed as the wait parameter to spin_to_position or spin_for\\
    It will return True if any motor is still spinning or False if they have completed the move or a timeout occurred.

    #### Arguments:
        None

    #### Returns:
        The current spin_to_position or spin_for status
    '''
    isAnyMotorSpinning = False
    for m in self._motors:
        isAnyMotorSpinning = isAnyMotorSpinning or m.is_spinning()
    return isAnyMotorSpinning

position(units=RotationUnits.DEG)

Returns the position of the first motor
Arguments:
units (optional) : The units for the returned position, the default is DEGREES
Returns:
The motor position in provided units
Source code in vex.py
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
def position(self, units=RotationUnits.DEG):
    '''### Returns the position of the first motor

    #### Arguments:
        units (optional) : The units for the returned position, the default is DEGREES

    #### Returns:
        The motor position in provided units
    '''
    return self._motors[0].position(units)

power(units=PowerUnits.WATT)

Returns the power the first motor is providing
Arguments:
units (optional) : The units for the returned power, the default is WATT
Returns:
The motor power in provided units
Source code in vex.py
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
def power(self, units=PowerUnits.WATT):
    '''### Returns the power the first motor is providing

    #### Arguments:
        units (optional) : The units for the returned power, the default is WATT

    #### Returns:
        The motor power in provided units
    '''
    return self._motors[0].power(units)

reset_position()

Reset the motor position to 0 for all motors in the group
Arguments:
None
Returns:
None
Source code in vex.py
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
def reset_position(self):
    '''### Reset the motor position to 0 for all motors in the group

    #### Arguments:
        None

    #### Returns:
        None
    '''
    for m in self._motors:
        m.reset_position()

set_max_torque(value, units=TorqueUnits.NM)

Set the maximum torque all motors in the group will use

The torque can be set as torque, current or percent of maximum.

Arguments:
value : the new maximum torque to use
units : the units that value is passed in
Returns:
None
Examples:
# set maximum torque to 2 Nm\
motor1.set_max_torque(2, TorqueUnits.NM)

# set maximum torque to 1 Amp\
motor1.set_max_torque(1, CurrentUnits.AMP)

# set maximum torque to 20 percent\
motor1.set_max_torque(20, PERCENT)
Source code in vex.py
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
def set_max_torque(self, value, units:TorquePercentCurrentUnits=TorqueUnits.NM):
    '''### Set the maximum torque all motors in the group will use
    The torque can be set as torque, current or percent of maximum.

    #### Arguments:
        value : the new maximum torque to use
        units : the units that value is passed in

    #### Returns:
        None

    #### Examples:
        # set maximum torque to 2 Nm\\
        motor1.set_max_torque(2, TorqueUnits.NM)\n
        # set maximum torque to 1 Amp\\
        motor1.set_max_torque(1, CurrentUnits.AMP)\n
        # set maximum torque to 20 percent\\
        motor1.set_max_torque(20, PERCENT)
    '''
    for m in self._motors:
        m.set_max_torque(value, units)

set_position(value, units=None)

Set the current position for all motors in the group

The position returned by the position() function is set to this value.

Arguments:
value : The new position
units : The units for the provided position, the default is DEGREES
Returns:
None
Source code in vex.py
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
def set_position(self, value, units=None):
    '''### Set the current position for all motors in the group
    The position returned by the position() function is set to this value.

    #### Arguments:
        value : The new position
        units : The units for the provided position, the default is DEGREES

    #### Returns:
        None
    '''
    for m in self._motors:
        m.set_position(value, units)

set_stopping(mode=BrakeType.COAST)

Set the stopping mode for all motors in the group

Setting the action for the motor when stopped.

Arguments:
mode : The stopping mode, COAST, BRAKE or HOLD
Returns:
None
Source code in vex.py
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
def set_stopping(self, mode=BrakeType.COAST):
    '''### Set the stopping mode for all motors in the group
    Setting the action for the motor when stopped.

    #### Arguments:
        mode : The stopping mode, COAST, BRAKE or HOLD

    #### Returns:
        None
    '''
    for m in self._motors:
        m.set_stopping(mode)

set_timeout(timeout, units=TimeUnits.MSEC)

Set the timeout value used for all motors in the group

The timeout value is used when performing spin_to_position and spin_for commands. If timeout is reached and the motor has not completed moving, then the spin... function will return False.

Arguments:
timeout : The new timeout
units : The units for the provided timeout, the default is MSEC
Returns:
None
Source code in vex.py
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
def set_timeout(self, timeout, units=TimeUnits.MSEC):
    '''### Set the timeout value used for all motors in the group
    The timeout value is used when performing spin_to_position and spin_for commands.  If timeout is
     reached and the motor has not completed moving, then the spin... function will return False.

    #### Arguments:
        timeout : The new timeout
        units : The units for the provided timeout, the default is MSEC

    #### Returns:
        None
    '''
    if units == TimeUnits.SECONDS and timeout > 0:
        if timeout > 100000:
            timeout = 100000
        self._timeout = timeout * 1000
    elif timeout <= 0:
        self._timeout = sys.maxsize
    else:
        self._timeout = timeout

    for m in self._motors:
        m.set_timeout(timeout, units)

set_velocity(velocity, units=None)

Set default velocity for all motors in the group

This will be the velocity used for subsequent calls to spin if a velocity is not provided to that function.

Arguments:
velocity : The new velocity
units : The units for the supplied velocity, the default is RPM
Returns:
None
Source code in vex.py
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
def set_velocity(self, velocity, units=None):
    '''### Set default velocity for all motors in the group
    This will be the velocity used for subsequent calls to spin if a velocity is not provided
    to that function.

    #### Arguments:
        velocity : The new velocity
        units : The units for the supplied velocity, the default is RPM

    #### Returns:
        None
    '''
    for m in self._motors:
        m.set_velocity(velocity, units)

spin(direction, velocity=None, units=VelocityUnits.RPM)

Spin all motors in the group using the provided arguments
Arguments:
direction : The direction to spin the motor, FORWARD or REVERSE
velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
units (optional) : The units of the provided velocity, default is RPM
Returns:
None
Examples:
# spin motors forward at velocity set with set_velocity\
mg1.spin(FORWARD)

# spin motors forward at 50 rpm\
mg1.spin(FORWARD, 50)

# spin with negative velocity, ie. backwards\
mg1.spin(FORWARD, -20)

# spin motors forwards with 100% velocity\
mg1.spin(FORWARD, 100, PERCENT)

# spin motors forwards at 50 rpm\
mg1.spin(FORWARD, 50, RPM)

# spin motors forwards at 360 dps\
mg1.spin(FORWARD, 360.0, VelocityUnits.DPS)
Source code in vex.py
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
def spin(self, direction, velocity=None, units:VelocityPercentUnits=VelocityUnits.RPM):
    '''### Spin all motors in the group using the provided arguments

    #### Arguments:
        direction : The direction to spin the motor, FORWARD or REVERSE
        velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
        units (optional) : The units of the provided velocity, default is RPM

    #### Returns:
        None

    #### Examples:
        # spin motors forward at velocity set with set_velocity\\
        mg1.spin(FORWARD)\n
        # spin motors forward at 50 rpm\\
        mg1.spin(FORWARD, 50)\n
        # spin with negative velocity, ie. backwards\\
        mg1.spin(FORWARD, -20)\n
        # spin motors forwards with 100% velocity\\
        mg1.spin(FORWARD, 100, PERCENT)\n
        # spin motors forwards at 50 rpm\\
        mg1.spin(FORWARD, 50, RPM)\n
        # spin motors forwards at 360 dps\\
        mg1.spin(FORWARD, 360.0, VelocityUnits.DPS)
    '''
    for m in self._motors:
        m.spin(direction, velocity, units)

spin_for(direction, rotation, units=RotationUnits.DEG, velocity=None, units_v=VelocityUnits.RPM, wait=True)

Spin all motors in the group to a relative position using the provided arguments

Move the motor to the requested position or for the specified amount of time.\ The position is relative (ie. an offset) to the current position\ This function supports keyword arguments.

Arguments:
direction : The direction to spin the motor, FORWARD or REVERSE
rotation : The relative position to spin the motor to or tha amount of time to spin for
units (optional) : The units for the provided position or time, the default is DEGREES or MSEC
velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
units_v (optional) : The units of the provided velocity, default is RPM
wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.
Returns:
None
Examples:
# spin 180 degrees from the current position\
mg1.spin_for(FORWARD, 180)

# spin reverse 2 TURNS (revolutions) from the current position\
mg1.spin_for(REVERSE, 2, TURNS)

# spin 180 degrees from the current position at 25 rpm\
mg1.spin_for(FORWARD, 180, DEGREES, 25, RPM)

# spin 180 degrees  from the current position and do not wait for completion\
mg1.spin_for(FORWARD, 180, DEGREES, False)

# spin 180 degrees  from the current position and do not wait for completion\
mg1.spin_for(FORWARD, 180, DEGREES, wait=False)
Source code in vex.py
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
def spin_for(self, direction, rotation, units:RotationTimeUnits=RotationUnits.DEG,
             velocity=None, units_v:VelocityPercentUnits=VelocityUnits.RPM, wait=True):
    '''### Spin all motors in the group to a relative position using the provided arguments
    Move the motor to the requested position or for the specified amount of time.\\
    The position is relative (ie. an offset) to the current position\\
    This function supports keyword arguments.

    #### Arguments:
        direction : The direction to spin the motor, FORWARD or REVERSE
        rotation : The relative position to spin the motor to or tha amount of time to spin for
        units (optional) : The units for the provided position or time, the default is DEGREES or MSEC
        velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
        units_v (optional) : The units of the provided velocity, default is RPM
        wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.

    #### Returns:
        None

    #### Examples:
        # spin 180 degrees from the current position\\
        mg1.spin_for(FORWARD, 180)\n
        # spin reverse 2 TURNS (revolutions) from the current position\\
        mg1.spin_for(REVERSE, 2, TURNS)\n
        # spin 180 degrees from the current position at 25 rpm\\
        mg1.spin_for(FORWARD, 180, DEGREES, 25, RPM)\n
        # spin 180 degrees  from the current position and do not wait for completion\\
        mg1.spin_for(FORWARD, 180, DEGREES, False)\n
        # spin 180 degrees  from the current position and do not wait for completion\\
        mg1.spin_for(FORWARD, 180, DEGREES, wait=False)
    '''
    if isinstance(units, TimeUnits):
        time = rotation
        self.__spin_for_time(direction, time, units, velocity, units_v)
    else:
        self.__spin_for_distance(
            direction, rotation, units, velocity, units_v, wait)

spin_to_position(rotation, units=RotationUnits.DEG, velocity=None, units_v=VelocityUnits.RPM, wait=True)

Spin all motors in the group to an absolute position using the provided arguments

Move the motor to the requested position.\ This function supports keyword arguments.

Arguments:
rotation : The position to spin the motor to
units (optional) : The units for the provided position, the default is DEGREES
velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
units_v (optional) : The units of the provided velocity, default is RPM
wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.
Returns:
None
Examples:
# spin to 180 degrees\
mg1.spin_to_position(180)

# spin to 2 TURNS (revolutions)\
mg1.spin_to_position(2, TURNS)

# spin to 180 degrees at 25 rpm\
mg1.spin_to_position(180, DEGREES, 25, RPM)

# spin to 180 degrees and do not wait for completion\
mg1.spin_to_position(180, DEGREES, False)

# spin to 180 degrees and do not wait for completion\
mg1.spin_to_position(180, DEGREES, wait=False)
Source code in vex.py
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
def spin_to_position(self, rotation, units=RotationUnits.DEG,
                     velocity=None, units_v:VelocityPercentUnits=VelocityUnits.RPM, wait=True):
    '''### Spin all motors in the group to an absolute position using the provided arguments
    Move the motor to the requested position.\\
    This function supports keyword arguments.

    #### Arguments:
        rotation : The position to spin the motor to
        units (optional) : The units for the provided position, the default is DEGREES
        velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
        units_v (optional) : The units of the provided velocity, default is RPM
        wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.

    #### Returns:
        None

    #### Examples:
        # spin to 180 degrees\\
        mg1.spin_to_position(180)\n
        # spin to 2 TURNS (revolutions)\\
        mg1.spin_to_position(2, TURNS) \n
        # spin to 180 degrees at 25 rpm\\
        mg1.spin_to_position(180, DEGREES, 25, RPM)\n
        # spin to 180 degrees and do not wait for completion\\
        mg1.spin_to_position(180, DEGREES, False)\n
        # spin to 180 degrees and do not wait for completion\\
        mg1.spin_to_position(180, DEGREES, wait=False)
    '''
    for m in self._motors:
        m.spin_to_position(rotation, units, velocity, units_v, False)

    if wait:
        return self.__waitForCompletionAll()

    return False

stop(mode=None)

Stop all motors in the group, set to 0 velocity and set current stopping_mode

The motor will be stopped and set to COAST, BRAKE or HOLD

Arguments:
None
Returns:
None
Source code in vex.py
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
def stop(self, mode=None):
    '''### Stop all motors in the group, set to 0 velocity and set current stopping_mode
    The motor will be stopped and set to COAST, BRAKE or HOLD

    #### Arguments:
        None

    #### Returns:
        None
    '''
    for m in self._motors:
        m.stop(mode)

temperature(units=TemperatureUnits.CELSIUS)

Returns the temperature of the first motor
Arguments:
units (optional) : The units for the returned temperature, the default is CELSIUS
Returns:
The motor temperature in provided units
Source code in vex.py
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
def temperature(self, units=TemperatureUnits.CELSIUS):
    '''### Returns the temperature of the first motor

    #### Arguments:
        units (optional) : The units for the returned temperature, the default is CELSIUS

    #### Returns:
        The motor temperature in provided units
    '''
    return self._motors[0].temperature(units)

torque(units=TorqueUnits.NM)

Returns the torque the first motor is providing
Arguments:
units (optional) : The units for the returned torque, the default is NM
Returns:
The motor torque in provided units
Source code in vex.py
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
def torque(self, units:TorquePercentCurrentUnits=TorqueUnits.NM):
    '''### Returns the torque the first motor is providing

    #### Arguments:
        units (optional) : The units for the returned torque, the default is NM

    #### Returns:
        The motor torque in provided units
    '''
    return self._motors[0].torque(units)

velocity(units=VelocityUnits.RPM)

Returns the velocity of the first motor
Arguments:
units (optional) : The units for the returned velocity, the default is RPM
Returns:
The motor velocity in provided units
Source code in vex.py
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
def velocity(self, units:VelocityPercentUnits=VelocityUnits.RPM):
    '''### Returns the velocity of the first motor

    #### Arguments:
        units (optional) : The units for the returned velocity, the default is RPM

    #### Returns:
        The motor velocity in provided units
    '''
    return self._motors[0].velocity(units)

DriveTrain

vex.DriveTrain

DriveTrain class - use this to create a simple drivetrain
Arguments:
lm : Left motor or motorgroup
rm : Right motor or motorgroup
wheelTravel (optional) : The circumference of the driven wheels, default is 300 mm
trackWidth (optional) : The trackwidth of the drivetrain, default is 320 mm
wheelBase (optional) : The wheelBase of the drivetrain, default is 320 mm
units (optional) : The units that wheelTravel, trackWidth and wheelBase are specified in, default is MM.
externalGearRatio (optional) : An optional gear ratio used to compensate drive distances if gearing is used.
Returns:
A new DriveTrain object.
Examples:
# A simple two motor drivetrain using default values\
motor1 = Motor(Ports.PORT1)\
motor2 = Motor(Ports.PORT2, True)\
drive1 = DriveTrain(motor1, motor2)

# A four motor drivetrain using custom values\
motor1 = Motor(Ports.PORT1)\
motor2 = Motor(Ports.PORT2)\
motor3 = Motor(Ports.PORT3, True)\
motor4 = Motor(Ports.PORT4, True)\
mgl = MotorGroup(motor1, motor3)\
mgr = MotorGroup(motor2, motor4)\
drive1 = DriveTrain(mgl, mgr, 8.6, 10, 12, INCHES)
Source code in vex.py
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
class DriveTrain:
    '''### DriveTrain class - use this to create a simple drivetrain

    #### Arguments:
        lm : Left motor or motorgroup
        rm : Right motor or motorgroup
        wheelTravel (optional) : The circumference of the driven wheels, default is 300 mm
        trackWidth (optional) : The trackwidth of the drivetrain, default is 320 mm
        wheelBase (optional) : The wheelBase of the drivetrain, default is 320 mm
        units (optional) : The units that wheelTravel, trackWidth and wheelBase are specified in, default is MM.
        externalGearRatio (optional) : An optional gear ratio used to compensate drive distances if gearing is used.

    #### Returns:
        A new DriveTrain object.

    #### Examples:
        # A simple two motor drivetrain using default values\\
        motor1 = Motor(Ports.PORT1)\\
        motor2 = Motor(Ports.PORT2, True)\\
        drive1 = DriveTrain(motor1, motor2)

        # A four motor drivetrain using custom values\\
        motor1 = Motor(Ports.PORT1)\\
        motor2 = Motor(Ports.PORT2)\\
        motor3 = Motor(Ports.PORT3, True)\\
        motor4 = Motor(Ports.PORT4, True)\\
        mgl = MotorGroup(motor1, motor3)\\
        mgr = MotorGroup(motor2, motor4)\\
        drive1 = DriveTrain(mgl, mgr, 8.6, 10, 12, INCHES)
    '''
    def __init__(self, lm, rm, wheelTravel:vexnumber=300, trackWidth:vexnumber=320, wheelBase:vexnumber=320,
                 units=DistanceUnits.MM, externalGearRatio=1.0):
        if(not (isinstance(lm, Motor) or isinstance(lm, MotorGroup)) or
           not (isinstance(rm, Motor) or isinstance(rm, MotorGroup))):
            raise TypeError('must pass two motors or motor groups')

        # motors or motor groups
        self.lm = lm
        self.rm = rm

# ----------------------------------------------------------------------------
    def set_drive_velocity(self, velocity, units:VelocityPercentUnits=VelocityUnits.RPM):
        '''### Set default velocity for drive commands
        This will be the velocity used for subsequent calls to drive if a velocity is not provided
        to that function.

        #### Arguments:
            velocity : The new velocity
            units : The units for the supplied velocity, the default is RPM

        #### Returns:
            None
        '''
        pass
# ----------------------------------------------------------------------------

    def set_turn_velocity(self, velocity, units:VelocityPercentUnits=VelocityUnits.RPM):
        '''### Set default velocity for turn commands
        This will be the velocity used for subsequent calls to turn if a velocity is not provided
        to that function.

        #### Arguments:
            velocity : The new velocity
            units : The units for the supplied velocity, the default is RPM

        #### Returns:
            None
        '''
        pass

# ----------------------------------------------------------------------------
    def set_stopping(self, mode=BrakeType.COAST):
        '''### Set the stopping mode for all motors on the drivetrain
        Setting the action for the motors when stopped.

        #### Arguments:
            mode : The stopping mode, COAST, BRAKE or HOLD

        #### Returns:
            None
        '''
        pass

# ----------------------------------------------------------------------------
    def set_timeout(self, timeout, units=TimeUnits.MSEC):
        '''### Set the timeout value used all motors on the drivetrain
        The timeout value is used when performing drive_for and turn_for commands.  If timeout is
         reached and the motor has not completed moving, then the function will return False.

        #### Arguments:
            timeout : The new timeout
            units : The units for the provided timeout, the default is MSEC

        #### Returns:
            None
        '''
        pass

# ----------------------------------------------------------------------------
    def get_timeout(self):
        '''### Get the current timeout value used by the drivetrain

        #### Arguments:
            None

        #### Returns:
            Timeout value in mS
        '''
        return 1000

# ----------------------------------------------------------------------------
    def drive(self, direction, velocity=None, units:VelocityPercentUnits=VelocityUnits.RPM):
        '''### drive the drivetrain using the provided arguments

        The drive command is similar to the motor spin command.\\
        all drive motors are commanded using the provided parameters.

        #### Arguments:
            direction : The direction to drive, FORWARD or REVERSE
            velocity (optional) : spin the motors using this velocity, the default velocity set by set_velocity will be used if not provided.
            units (optional) : The units of the provided velocity, default is RPM

        #### Returns:
            None

        #### Examples:
            # drive forward at velocity set with set_velocity\\
            drive1.drive(FORWARD)\n
            # drive forward at 50 rpm\\
            drive1.drive(FORWARD, 50)\n
            # drive with negative velocity, ie. backwards\\
            drive1.drive(FORWARD, -20)\n
            # drive forwards with 100% velocity\\
            drive1.drive(FORWARD, 100, PERCENT)\n
            # drive forwards at 50 rpm\\
            drive1.drive(FORWARD, 50, RPM)\n
            # drive forwards at 360 dps\\
            drive1.drive(FORWARD, 360.0, VelocityUnits.DPS)
        '''
        pass

# ----------------------------------------------------------------------------
    def drive_for(self, direction, distance, units=DistanceUnits.IN,
                  velocity=None, units_v:VelocityPercentUnits=VelocityUnits.RPM, wait=True):
        '''### move the drivetrain using the provided arguments

        The drive_for command is similar to the motor spin_for command,\\
        however, the drivetrain is commanded to move a distance.

        #### Arguments:
            direction : The direction to drive
            distance : The distance to drive
            units (optional) : The units for the provided distance, the default is INCHES
            velocity (optional) : drive using this velocity, the default velocity set by set_drive_velocity will be used if not provided.
            units_v (optional) : The units of the provided velocity, default is RPM
            wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.

        #### Returns:
            None or if wait is True then completion success or failure

        #### Examples:
            # drive forward 10 inches from the current position\\
            drive1.drive_for(FORWARD, 10, INCHES)\n
            # drive reverse 1000mm from the current position with motors at 50 rpm\\
            drive1.drive_for(REVERSE, 10000, MM, 50, RPM)
        '''
        pass

# ----------------------------------------------------------------------------
    def turn(self, direction, velocity=None, units:VelocityPercentUnits=VelocityUnits.RPM):
        '''### turn the drivetrain using the provided arguments

        The drive command is similar to the motor spin command.\\
        all drive motors are commanded using the provided parameters.

        #### Arguments:
            direction : The turn direction, LEFT or RIGHT
            velocity (optional) : spin the motors using this velocity, the default velocity set by set_turn_velocity will be used if not provided.
            units (optional) : The units of the provided velocity, default is RPM

        #### Returns:
            None

        #### Examples:
            # turn left at velocity set with set_turn_velocity\\
            drive1.turn(LEFT)\n
            # drive right at 50 rpm\\
            drive1.turn(RIGHT, 50)\n
            # turn right with 100% velocity\\
            drive1.turn(RIGHT, 100, PERCENT)\n
            # turn right at 50 rpm\\
            drive1.turn(RIGHT, 50, RPM)\n
            # turn right at 360 dps\\
            drive1.turn(RIGHT, 360.0, VelocityUnits.DPS)
        '''
        pass

# ----------------------------------------------------------------------------
    def turn_for(self, direction, angle, units=RotationUnits.DEG,
                 velocity=None, units_v:VelocityPercentUnits=VelocityUnits.RPM, wait=True):
        '''### turn the drivetrain using the provided arguments

        The turn_for command is similar to the motor spin_for command,\\
        however, the drivetrain is commanded to turn a specified angle.

        #### Arguments:
            direction : The direction to turn, LEFT or RIGHT
            angle : The angle to turn
            units (optional) : The units for the provided angle, the default is DEGREES
            velocity (optional) : drive using this velocity, the default velocity set by set_drive_velocity will be used if not provided.
            units_v (optional) : The units of the provided velocity, default is RPM
            wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.

        #### Returns:
            None or if wait is True then completion success or failure

        #### Examples:
            # turn right 90 degrees\\
            drive1.turn_for(RIGHT, 90, DEGREES)\n
            # turn left 180 degrees with motors at 50 rpm\\
            drive1.turn_for(LEFT, 180, DEGREES, 50, RPM)
        '''
        pass

# ----------------------------------------------------------------------------
    def is_moving(self):
        '''### Returns the current status of the drive_for or turn_for command
        This function is used when False has been passed as the wait parameter to drive_for or turn_for\\
        It will return True if the drivetrain is still moving or False if it has completed the move or a timeout occurred.

        #### Arguments:
            None

        #### Returns:
            The current drive_for or turn_for status
        '''
        return False

# ----------------------------------------------------------------------------
    def is_done(self):
        '''### Returns the current status of the drive_for or turn_for command
        This function is used when False has been passed as the wait parameter to drive_for or turn_for\\
        It will return False if the drivetrain is still moving or True if it has completed the move or a timeout occurred.

        #### Arguments:
            None

        #### Returns:
            The current drive_for or turn_for status
        '''
        return True

# ----------------------------------------------------------------------------

    def stop(self, mode=None):
        '''### Stop the drivetrain, set to 0 velocity and set current stopping_mode
        The motors will be stopped and set to COAST, BRAKE or HOLD

        #### Arguments:
            None

        #### Returns:
            None
        '''
        pass

# ----------------------------------------------------------------------------
    def velocity(self, units:VelocityPercentUnits=VelocityUnits.RPM):
        '''### Returns average velocity of the left and right motors

        #### Arguments:
            units (optional) : The units for the returned velocity, the default is RPM

        #### Returns:
            The drivetrain velocity in provided units
        '''
        return 0

# ----------------------------------------------------------------------------
    def current(self, units=CurrentUnits.AMP):
        '''### Returns the total current all drivetrain motors are using

        #### Arguments:
            units (optional) : The units for the returned current, the default is AMP

        #### Returns:
            The drivetrain current in provided units
        '''
        return 0

# ----------------------------------------------------------------------------
    def power(self, units=PowerUnits.WATT):
        '''### Returns the total power all drivetrain motors are using

        This command only considers the first motor for left and right sides of the drive.

        #### Arguments:
            units (optional) : The units for the returned power, the default is WATT

        #### Returns:
            The drivetrain power in provided units
        '''
        return 0

# ----------------------------------------------------------------------------
    def torque(self, units=TorqueUnits.NM):
        '''### Returns the total torque all drivetrain motors are using

        This command only considers the first motor for left and right sides of the drive.

        #### Arguments:
            units (optional) : The units for the returned torque, the default is NM

        #### Returns:
            The motor torque in provided units
        '''
        return 0

# ----------------------------------------------------------------------------
    def efficiency(self, units=PercentUnits.PERCENT):
        '''### Returns the average efficiency of the left and right motors

        This command only considers the first motor for left and right sides of the drive.

        #### Arguments:
            units (optional) : The units for the efficiency, the only valid value is PERCENT

        #### Returns:
            The motor efficiency in percent
        '''
        return 0

# ----------------------------------------------------------------------------
    def temperature(self, units=TemperatureUnits.CELSIUS):
        '''### Returns the average temperature of the left and right motors

        This command only considers the first motor for left and right sides of the drive.

        #### Arguments:
            units (optional) : The units for the returned temperature, the default is CELSIUS

        #### Returns:
            The motor temperature in provided units
        '''
        return 0

current(units=CurrentUnits.AMP)

Returns the total current all drivetrain motors are using
Arguments:
units (optional) : The units for the returned current, the default is AMP
Returns:
The drivetrain current in provided units
Source code in vex.py
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
def current(self, units=CurrentUnits.AMP):
    '''### Returns the total current all drivetrain motors are using

    #### Arguments:
        units (optional) : The units for the returned current, the default is AMP

    #### Returns:
        The drivetrain current in provided units
    '''
    return 0

drive(direction, velocity=None, units=VelocityUnits.RPM)

drive the drivetrain using the provided arguments

The drive command is similar to the motor spin command.\ all drive motors are commanded using the provided parameters.

Arguments:
direction : The direction to drive, FORWARD or REVERSE
velocity (optional) : spin the motors using this velocity, the default velocity set by set_velocity will be used if not provided.
units (optional) : The units of the provided velocity, default is RPM
Returns:
None
Examples:
# drive forward at velocity set with set_velocity\
drive1.drive(FORWARD)

# drive forward at 50 rpm\
drive1.drive(FORWARD, 50)

# drive with negative velocity, ie. backwards\
drive1.drive(FORWARD, -20)

# drive forwards with 100% velocity\
drive1.drive(FORWARD, 100, PERCENT)

# drive forwards at 50 rpm\
drive1.drive(FORWARD, 50, RPM)

# drive forwards at 360 dps\
drive1.drive(FORWARD, 360.0, VelocityUnits.DPS)
Source code in vex.py
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
def drive(self, direction, velocity=None, units:VelocityPercentUnits=VelocityUnits.RPM):
    '''### drive the drivetrain using the provided arguments

    The drive command is similar to the motor spin command.\\
    all drive motors are commanded using the provided parameters.

    #### Arguments:
        direction : The direction to drive, FORWARD or REVERSE
        velocity (optional) : spin the motors using this velocity, the default velocity set by set_velocity will be used if not provided.
        units (optional) : The units of the provided velocity, default is RPM

    #### Returns:
        None

    #### Examples:
        # drive forward at velocity set with set_velocity\\
        drive1.drive(FORWARD)\n
        # drive forward at 50 rpm\\
        drive1.drive(FORWARD, 50)\n
        # drive with negative velocity, ie. backwards\\
        drive1.drive(FORWARD, -20)\n
        # drive forwards with 100% velocity\\
        drive1.drive(FORWARD, 100, PERCENT)\n
        # drive forwards at 50 rpm\\
        drive1.drive(FORWARD, 50, RPM)\n
        # drive forwards at 360 dps\\
        drive1.drive(FORWARD, 360.0, VelocityUnits.DPS)
    '''
    pass

drive_for(direction, distance, units=DistanceUnits.IN, velocity=None, units_v=VelocityUnits.RPM, wait=True)

move the drivetrain using the provided arguments

The drive_for command is similar to the motor spin_for command,\ however, the drivetrain is commanded to move a distance.

Arguments:
direction : The direction to drive
distance : The distance to drive
units (optional) : The units for the provided distance, the default is INCHES
velocity (optional) : drive using this velocity, the default velocity set by set_drive_velocity will be used if not provided.
units_v (optional) : The units of the provided velocity, default is RPM
wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.
Returns:
None or if wait is True then completion success or failure
Examples:
# drive forward 10 inches from the current position\
drive1.drive_for(FORWARD, 10, INCHES)

# drive reverse 1000mm from the current position with motors at 50 rpm\
drive1.drive_for(REVERSE, 10000, MM, 50, RPM)
Source code in vex.py
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
def drive_for(self, direction, distance, units=DistanceUnits.IN,
              velocity=None, units_v:VelocityPercentUnits=VelocityUnits.RPM, wait=True):
    '''### move the drivetrain using the provided arguments

    The drive_for command is similar to the motor spin_for command,\\
    however, the drivetrain is commanded to move a distance.

    #### Arguments:
        direction : The direction to drive
        distance : The distance to drive
        units (optional) : The units for the provided distance, the default is INCHES
        velocity (optional) : drive using this velocity, the default velocity set by set_drive_velocity will be used if not provided.
        units_v (optional) : The units of the provided velocity, default is RPM
        wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.

    #### Returns:
        None or if wait is True then completion success or failure

    #### Examples:
        # drive forward 10 inches from the current position\\
        drive1.drive_for(FORWARD, 10, INCHES)\n
        # drive reverse 1000mm from the current position with motors at 50 rpm\\
        drive1.drive_for(REVERSE, 10000, MM, 50, RPM)
    '''
    pass

efficiency(units=PercentUnits.PERCENT)

Returns the average efficiency of the left and right motors

This command only considers the first motor for left and right sides of the drive.

Arguments:
units (optional) : The units for the efficiency, the only valid value is PERCENT
Returns:
The motor efficiency in percent
Source code in vex.py
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
def efficiency(self, units=PercentUnits.PERCENT):
    '''### Returns the average efficiency of the left and right motors

    This command only considers the first motor for left and right sides of the drive.

    #### Arguments:
        units (optional) : The units for the efficiency, the only valid value is PERCENT

    #### Returns:
        The motor efficiency in percent
    '''
    return 0

get_timeout()

Get the current timeout value used by the drivetrain
Arguments:
None
Returns:
Timeout value in mS
Source code in vex.py
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
def get_timeout(self):
    '''### Get the current timeout value used by the drivetrain

    #### Arguments:
        None

    #### Returns:
        Timeout value in mS
    '''
    return 1000

is_done()

Returns the current status of the drive_for or turn_for command

This function is used when False has been passed as the wait parameter to drive_for or turn_for\ It will return False if the drivetrain is still moving or True if it has completed the move or a timeout occurred.

Arguments:
None
Returns:
The current drive_for or turn_for status
Source code in vex.py
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
def is_done(self):
    '''### Returns the current status of the drive_for or turn_for command
    This function is used when False has been passed as the wait parameter to drive_for or turn_for\\
    It will return False if the drivetrain is still moving or True if it has completed the move or a timeout occurred.

    #### Arguments:
        None

    #### Returns:
        The current drive_for or turn_for status
    '''
    return True

is_moving()

Returns the current status of the drive_for or turn_for command

This function is used when False has been passed as the wait parameter to drive_for or turn_for\ It will return True if the drivetrain is still moving or False if it has completed the move or a timeout occurred.

Arguments:
None
Returns:
The current drive_for or turn_for status
Source code in vex.py
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
def is_moving(self):
    '''### Returns the current status of the drive_for or turn_for command
    This function is used when False has been passed as the wait parameter to drive_for or turn_for\\
    It will return True if the drivetrain is still moving or False if it has completed the move or a timeout occurred.

    #### Arguments:
        None

    #### Returns:
        The current drive_for or turn_for status
    '''
    return False

power(units=PowerUnits.WATT)

Returns the total power all drivetrain motors are using

This command only considers the first motor for left and right sides of the drive.

Arguments:
units (optional) : The units for the returned power, the default is WATT
Returns:
The drivetrain power in provided units
Source code in vex.py
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
def power(self, units=PowerUnits.WATT):
    '''### Returns the total power all drivetrain motors are using

    This command only considers the first motor for left and right sides of the drive.

    #### Arguments:
        units (optional) : The units for the returned power, the default is WATT

    #### Returns:
        The drivetrain power in provided units
    '''
    return 0

set_drive_velocity(velocity, units=VelocityUnits.RPM)

Set default velocity for drive commands

This will be the velocity used for subsequent calls to drive if a velocity is not provided to that function.

Arguments:
velocity : The new velocity
units : The units for the supplied velocity, the default is RPM
Returns:
None
Source code in vex.py
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
def set_drive_velocity(self, velocity, units:VelocityPercentUnits=VelocityUnits.RPM):
    '''### Set default velocity for drive commands
    This will be the velocity used for subsequent calls to drive if a velocity is not provided
    to that function.

    #### Arguments:
        velocity : The new velocity
        units : The units for the supplied velocity, the default is RPM

    #### Returns:
        None
    '''
    pass

set_stopping(mode=BrakeType.COAST)

Set the stopping mode for all motors on the drivetrain

Setting the action for the motors when stopped.

Arguments:
mode : The stopping mode, COAST, BRAKE or HOLD
Returns:
None
Source code in vex.py
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
def set_stopping(self, mode=BrakeType.COAST):
    '''### Set the stopping mode for all motors on the drivetrain
    Setting the action for the motors when stopped.

    #### Arguments:
        mode : The stopping mode, COAST, BRAKE or HOLD

    #### Returns:
        None
    '''
    pass

set_timeout(timeout, units=TimeUnits.MSEC)

Set the timeout value used all motors on the drivetrain

The timeout value is used when performing drive_for and turn_for commands. If timeout is reached and the motor has not completed moving, then the function will return False.

Arguments:
timeout : The new timeout
units : The units for the provided timeout, the default is MSEC
Returns:
None
Source code in vex.py
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
def set_timeout(self, timeout, units=TimeUnits.MSEC):
    '''### Set the timeout value used all motors on the drivetrain
    The timeout value is used when performing drive_for and turn_for commands.  If timeout is
     reached and the motor has not completed moving, then the function will return False.

    #### Arguments:
        timeout : The new timeout
        units : The units for the provided timeout, the default is MSEC

    #### Returns:
        None
    '''
    pass

set_turn_velocity(velocity, units=VelocityUnits.RPM)

Set default velocity for turn commands

This will be the velocity used for subsequent calls to turn if a velocity is not provided to that function.

Arguments:
velocity : The new velocity
units : The units for the supplied velocity, the default is RPM
Returns:
None
Source code in vex.py
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
def set_turn_velocity(self, velocity, units:VelocityPercentUnits=VelocityUnits.RPM):
    '''### Set default velocity for turn commands
    This will be the velocity used for subsequent calls to turn if a velocity is not provided
    to that function.

    #### Arguments:
        velocity : The new velocity
        units : The units for the supplied velocity, the default is RPM

    #### Returns:
        None
    '''
    pass

stop(mode=None)

Stop the drivetrain, set to 0 velocity and set current stopping_mode

The motors will be stopped and set to COAST, BRAKE or HOLD

Arguments:
None
Returns:
None
Source code in vex.py
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
def stop(self, mode=None):
    '''### Stop the drivetrain, set to 0 velocity and set current stopping_mode
    The motors will be stopped and set to COAST, BRAKE or HOLD

    #### Arguments:
        None

    #### Returns:
        None
    '''
    pass

temperature(units=TemperatureUnits.CELSIUS)

Returns the average temperature of the left and right motors

This command only considers the first motor for left and right sides of the drive.

Arguments:
units (optional) : The units for the returned temperature, the default is CELSIUS
Returns:
The motor temperature in provided units
Source code in vex.py
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
def temperature(self, units=TemperatureUnits.CELSIUS):
    '''### Returns the average temperature of the left and right motors

    This command only considers the first motor for left and right sides of the drive.

    #### Arguments:
        units (optional) : The units for the returned temperature, the default is CELSIUS

    #### Returns:
        The motor temperature in provided units
    '''
    return 0

torque(units=TorqueUnits.NM)

Returns the total torque all drivetrain motors are using

This command only considers the first motor for left and right sides of the drive.

Arguments:
units (optional) : The units for the returned torque, the default is NM
Returns:
The motor torque in provided units
Source code in vex.py
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
def torque(self, units=TorqueUnits.NM):
    '''### Returns the total torque all drivetrain motors are using

    This command only considers the first motor for left and right sides of the drive.

    #### Arguments:
        units (optional) : The units for the returned torque, the default is NM

    #### Returns:
        The motor torque in provided units
    '''
    return 0

turn(direction, velocity=None, units=VelocityUnits.RPM)

turn the drivetrain using the provided arguments

The drive command is similar to the motor spin command.\ all drive motors are commanded using the provided parameters.

Arguments:
direction : The turn direction, LEFT or RIGHT
velocity (optional) : spin the motors using this velocity, the default velocity set by set_turn_velocity will be used if not provided.
units (optional) : The units of the provided velocity, default is RPM
Returns:
None
Examples:
# turn left at velocity set with set_turn_velocity\
drive1.turn(LEFT)

# drive right at 50 rpm\
drive1.turn(RIGHT, 50)

# turn right with 100% velocity\
drive1.turn(RIGHT, 100, PERCENT)

# turn right at 50 rpm\
drive1.turn(RIGHT, 50, RPM)

# turn right at 360 dps\
drive1.turn(RIGHT, 360.0, VelocityUnits.DPS)
Source code in vex.py
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
def turn(self, direction, velocity=None, units:VelocityPercentUnits=VelocityUnits.RPM):
    '''### turn the drivetrain using the provided arguments

    The drive command is similar to the motor spin command.\\
    all drive motors are commanded using the provided parameters.

    #### Arguments:
        direction : The turn direction, LEFT or RIGHT
        velocity (optional) : spin the motors using this velocity, the default velocity set by set_turn_velocity will be used if not provided.
        units (optional) : The units of the provided velocity, default is RPM

    #### Returns:
        None

    #### Examples:
        # turn left at velocity set with set_turn_velocity\\
        drive1.turn(LEFT)\n
        # drive right at 50 rpm\\
        drive1.turn(RIGHT, 50)\n
        # turn right with 100% velocity\\
        drive1.turn(RIGHT, 100, PERCENT)\n
        # turn right at 50 rpm\\
        drive1.turn(RIGHT, 50, RPM)\n
        # turn right at 360 dps\\
        drive1.turn(RIGHT, 360.0, VelocityUnits.DPS)
    '''
    pass

turn_for(direction, angle, units=RotationUnits.DEG, velocity=None, units_v=VelocityUnits.RPM, wait=True)

turn the drivetrain using the provided arguments

The turn_for command is similar to the motor spin_for command,\ however, the drivetrain is commanded to turn a specified angle.

Arguments:
direction : The direction to turn, LEFT or RIGHT
angle : The angle to turn
units (optional) : The units for the provided angle, the default is DEGREES
velocity (optional) : drive using this velocity, the default velocity set by set_drive_velocity will be used if not provided.
units_v (optional) : The units of the provided velocity, default is RPM
wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.
Returns:
None or if wait is True then completion success or failure
Examples:
# turn right 90 degrees\
drive1.turn_for(RIGHT, 90, DEGREES)

# turn left 180 degrees with motors at 50 rpm\
drive1.turn_for(LEFT, 180, DEGREES, 50, RPM)
Source code in vex.py
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
def turn_for(self, direction, angle, units=RotationUnits.DEG,
             velocity=None, units_v:VelocityPercentUnits=VelocityUnits.RPM, wait=True):
    '''### turn the drivetrain using the provided arguments

    The turn_for command is similar to the motor spin_for command,\\
    however, the drivetrain is commanded to turn a specified angle.

    #### Arguments:
        direction : The direction to turn, LEFT or RIGHT
        angle : The angle to turn
        units (optional) : The units for the provided angle, the default is DEGREES
        velocity (optional) : drive using this velocity, the default velocity set by set_drive_velocity will be used if not provided.
        units_v (optional) : The units of the provided velocity, default is RPM
        wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.

    #### Returns:
        None or if wait is True then completion success or failure

    #### Examples:
        # turn right 90 degrees\\
        drive1.turn_for(RIGHT, 90, DEGREES)\n
        # turn left 180 degrees with motors at 50 rpm\\
        drive1.turn_for(LEFT, 180, DEGREES, 50, RPM)
    '''
    pass

velocity(units=VelocityUnits.RPM)

Returns average velocity of the left and right motors
Arguments:
units (optional) : The units for the returned velocity, the default is RPM
Returns:
The drivetrain velocity in provided units
Source code in vex.py
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
def velocity(self, units:VelocityPercentUnits=VelocityUnits.RPM):
    '''### Returns average velocity of the left and right motors

    #### Arguments:
        units (optional) : The units for the returned velocity, the default is RPM

    #### Returns:
        The drivetrain velocity in provided units
    '''
    return 0

SmartDrive

vex.SmartDrive

Bases: DriveTrain

SmartDrive class - use this to create a smart drivetrain

A smart drivetrain uses a gyro or similar sensor to turn more accurately.\ The smartdrive inherits all drivetrain functions.

Arguments:
lm : Left motor or motorgroup
rm : Right motor or motorgroup
g : The gyro, inertial sensor or gps to use for turns
wheelTravel (optional) : The circumference of the driven wheels, default is 300 mm
trackWidth (optional) : The trackwidth of the drivetrain, default is 320 mm
wheelBase (optional) : The wheelBase of the drivetrain, default is 320 mm
units (optional) : The units that wheelTravel, trackWidth and wheelBase are specified in, default is MM.
externalGearRatio (optional) : An optional gear ratio used to compensate drive distances if gearing is used.
Returns:
A new SmartDrive object.
Examples:
# A simple two motor smart drivetrain using default values\
motor1 = Motor(Ports.PORT1)\
motor2 = Motor(Ports.PORT2, True)\
imu1 = Inertial(Ports.PORT9)\
smart1 = SmartDrive(motor1, motor2, imu1)

# A four motor smart drivetrain using custom values\
motor1 = Motor(Ports.PORT1)\
motor2 = Motor(Ports.PORT2)\
motor3 = Motor(Ports.PORT3, True)\
motor4 = Motor(Ports.PORT4, True)\
imu1 = Inertial(Ports.PORT9)\
mgl = MotorGroup(motor1, motor3)\
mgr = MotorGroup(motor2, motor4)\
smart1 = SmartDrive(mgl, mgr, imu1, 8.6, 10, 12, INCHES)
Source code in vex.py
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
class SmartDrive(DriveTrain):
    '''### SmartDrive class - use this to create a smart drivetrain

    A smart drivetrain uses a gyro or similar sensor to turn more accurately.\\
    The smartdrive inherits all drivetrain functions.

    #### Arguments:
        lm : Left motor or motorgroup
        rm : Right motor or motorgroup
        g : The gyro, inertial sensor or gps to use for turns
        wheelTravel (optional) : The circumference of the driven wheels, default is 300 mm
        trackWidth (optional) : The trackwidth of the drivetrain, default is 320 mm
        wheelBase (optional) : The wheelBase of the drivetrain, default is 320 mm
        units (optional) : The units that wheelTravel, trackWidth and wheelBase are specified in, default is MM.
        externalGearRatio (optional) : An optional gear ratio used to compensate drive distances if gearing is used.

    #### Returns:
        A new SmartDrive object.

    #### Examples:
        # A simple two motor smart drivetrain using default values\\
        motor1 = Motor(Ports.PORT1)\\
        motor2 = Motor(Ports.PORT2, True)\\
        imu1 = Inertial(Ports.PORT9)\\
        smart1 = SmartDrive(motor1, motor2, imu1)

        # A four motor smart drivetrain using custom values\\
        motor1 = Motor(Ports.PORT1)\\
        motor2 = Motor(Ports.PORT2)\\
        motor3 = Motor(Ports.PORT3, True)\\
        motor4 = Motor(Ports.PORT4, True)\\
        imu1 = Inertial(Ports.PORT9)\\
        mgl = MotorGroup(motor1, motor3)\\
        mgr = MotorGroup(motor2, motor4)\\
        smart1 = SmartDrive(mgl, mgr, imu1, 8.6, 10, 12, INCHES)
    '''
    def __init__(self, lm, rm, g, wheelTravel:vexnumber=300, trackWidth:vexnumber=320,
                 wheelBase:vexnumber=320, units=DistanceUnits.MM,
                 externalGearRatio=1.0):

        if(not (isinstance(lm, Motor) or isinstance(lm, MotorGroup)) or
           not (isinstance(rm, Motor) or isinstance(rm, MotorGroup))):
            raise TypeError('must pass two motors or motor groups')

        if not (isinstance(g, Gyro) or isinstance(g, Inertial) or isinstance(g, Gps)):
            raise TypeError('must pass Gyro, Inertial or Gps instance')

        DriveTrain.__init__(self, lm, rm, wheelTravel,
                            trackWidth, wheelBase, units, externalGearRatio)
        self.g = g

# ----------------------------------------------------------
    def set_turn_threshold(self, value):
        '''### Set the turning threshold for the smartdrive

        This is the threshold value used to determine that turns are complete.\\
        If this is too large then turns will not be accurate, if too small then turns ma\\
        not complete.

        #### Arguments:
            value : The new turn threshold in degrees, the default for a smartdrive is 1 degree

        #### Returns:
            None
        '''
        pass

# ----------------------------------------------------------
    def set_turn_constant(self, value):
        '''### Set the turning constant for the smartdrive

        The smartdrive uses a simple P controller when doing turns.\\
        This constant, generally known as kp, is the gain used in the equation that\\
        turns angular error into motor velocity.

        #### Arguments:
            value : The new turn constant in the range 0.1 - 4.0, the default is 1.0

        #### Returns:
            None
        '''
        pass

# ----------------------------------------------------------
    def set_turn_direction_reverse(self, value):
        '''### Set the expected turn direction for positive heading change

        #### Arguments:
            value : True or False

        #### Returns:
            None
        '''
        pass

# ----------------------------------------------------------
    def set_heading(self, value, units=RotationUnits.DEG):
        '''### set the smartdrive heading to a new value

        The new value for heading should be in the range 0 - 359.99 degrees.

        #### Arguments:
            value : The new value to use for heading.
            units (optional) : The rotation units type for value, the default is DEGREES

        #### Returns:
            None

        #### Examples:
            # set the value of heading to 180 degrees\\
            smart1.set_heading(180)
        '''
        pass
# ----------------------------------------------------------

    def heading(self, units=RotationUnits.DEG):
        '''### read the current heading of the smartdrive

        heading will be returned in the range 0 - 359.99 degrees

        #### Arguments:
            units (optional) : The units to return the heading in, default is DEGREES

        #### Returns:
            A value for heading in the range that is specified by the units.

        #### Examples:
            # get the current heading for the smartdrive\\
            value = smart1.heading()
        '''
        return 0

# ----------------------------------------------------------
    def set_rotation(self, value, units=RotationUnits.DEG):
        '''### set the smartdrive rotation to a new value

        #### Arguments:
            value : The new value to use for rotation.
            units (optional) : The rotation units type for value, the default is DEGREES

        #### Returns:
            None

        #### Examples:
            # set the value of rotation to 180 degrees\\
            smart1.set_rotation(180)
        '''
        pass

# ----------------------------------------------------------
    def rotation(self, units=RotationUnits.DEG):
        '''### read the current rotation of the smartdrive

        rotation is not limited, it can be both positive and negative and shows the absolute angle of the gyro.

        #### Arguments:
            units (optional) : The units to return the rotation in, default is DEGREES

        #### Returns:
            A value for heading in the range that is specified by the units.

        #### Examples:
            # get the current rotation for the smartdrive\\
            value = smart1.rotation()
        '''
        return self.g.rotation(units)

# ----------------------------------------------------------
    def turn_to_heading(self, angle, units=RotationUnits.DEG,
                        velocity=None, units_v:VelocityPercentUnits=VelocityUnits.RPM, wait=True):
        '''### turn the smartdrive to an absolute position using the provided arguments

        The turn_to_heading command is similar to the motor spin_to_position command,\\
        however, the smartdrive is commanded to turn to a specified angle.\\
        This function uses the value of heading() when turning the smartdrive\\
        This function supports keyword arguments.

        #### Arguments:
            angle : The angle to turn to
            units (optional) : The units for the provided angle, the default is DEGREES
            velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
            units_v (optional) : The units of the provided velocity, default is RPM
            wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.

        #### Returns:
            None

        #### Examples:
            # turn to heading 180 degrees\\
            smart1.turn_to_heading(180)\n
            # turn to heading 180 degrees at 25 rpm\\
            smart1.turn_to_heading(180, DEGREES, 25, RPM)\n
            # turn to heading 180 degrees and do not wait for completion\\
            smart1.turn_to_heading(180, DEGREES, False)\n
            # turn to heading 180 degrees and do not wait for completion\\
            smart1.turn_to_heading(180, DEGREES, wait=False)
        '''
        return True

# ----------------------------------------------------------
    def turn_to_rotation(self, angle, units=RotationUnits.DEG,
                         velocity=None, units_v:VelocityPercentUnits=VelocityUnits.RPM, wait=True):
        '''### turn the smartdrive to an absolute position using the provided arguments

        The turn_to_rotation command is similar to the motor spin_to_position command,\\
        however, the smartdrive is commanded to turn to a specified angle.\\
        This function uses the value of rotation() when turning the smartdrive\\
        This function supports keyword arguments.

        #### Arguments:
            angle : The angle to turn to
            units (optional) : The units for the provided angle, the default is DEGREES
            velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
            units_v (optional) : The units of the provided velocity, default is RPM
            wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.

        #### Returns:
            None

        #### Examples:
            # turn to rotation 180 degrees\\
            smart1.turn_to_rotation(180)\n
            # turn to rotation 400 degrees at 25 rpm\\
            smart1.turn_to_rotation(400, DEGREES, 25, RPM)\n
            # turn to rotation 180 degrees and do not wait for completion\\
            smart1.turn_to_rotation(180, DEGREES, False)\n
            # turn to rotation 180 degrees and do not wait for completion\\
            smart1.turn_to_rotation(180, DEGREES, wait=False)
        '''
        return True

# ----------------------------------------------------------
    def turn_for(self, direction, angle, units=RotationUnits.DEG,
                 velocity=None, units_v:VelocityPercentUnits=VelocityUnits.RPM, wait=True):
        '''### turn the smartdrive using the provided arguments

        The turn_for command is similar to the motor spin_for command,\\
        however, the smartdrive is commanded to turn a specified angle.

        #### Arguments:
            direction : The direction to turn, LEFT or RIGHT
            angle : The angle to turn
            units (optional) : The units for the provided angle, the default is DEGREES
            velocity (optional) : drive using this velocity, the default velocity set by set_drive_velocity will be used if not provided.
            units_v (optional) : The units of the provided velocity, default is RPM
            wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.

        #### Returns:
            None or if wait is True then completion success or failure

        #### Examples:
            # turn right 90 degrees\\
            smart1.turn_for(RIGHT, 90, DEGREES)\n
            # turn left 180 degrees with motors at 50 rpm\\
            smart1.turn_for(LEFT, 180, DEGREES, 50, RPM)
        '''
        return True

# ----------------------------------------------------------
    def is_turning(self):
        '''### Returns the current status of the turn_to_heading, turn_to_rotation or turn_for command
        This function is used when False has been passed as the wait parameter to turn_to_heading or turn_for\\
        It will return True if the drivetrain is still moving or False if it has completed the move or a timeout occurred.

        #### Arguments:
            None

        #### Returns:
            The current turn_to_heading, turn_to_rotation or turn_for status
        '''
        return False

# ----------------------------------------------------------
    def is_moving(self):
        '''### Returns the current status of the drive_for command
        This function is used when False has been passed as the wait parameter to drive_for\\
        It will return True if the drivetrain is still moving or False if it has completed the move or a timeout occurred.

        #### Arguments:
            None

        #### Returns:
            The current drive_for status
        '''
        return False

heading(units=RotationUnits.DEG)

read the current heading of the smartdrive

heading will be returned in the range 0 - 359.99 degrees

Arguments:
units (optional) : The units to return the heading in, default is DEGREES
Returns:
A value for heading in the range that is specified by the units.
Examples:
# get the current heading for the smartdrive\
value = smart1.heading()
Source code in vex.py
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
def heading(self, units=RotationUnits.DEG):
    '''### read the current heading of the smartdrive

    heading will be returned in the range 0 - 359.99 degrees

    #### Arguments:
        units (optional) : The units to return the heading in, default is DEGREES

    #### Returns:
        A value for heading in the range that is specified by the units.

    #### Examples:
        # get the current heading for the smartdrive\\
        value = smart1.heading()
    '''
    return 0

is_moving()

Returns the current status of the drive_for command

This function is used when False has been passed as the wait parameter to drive_for\ It will return True if the drivetrain is still moving or False if it has completed the move or a timeout occurred.

Arguments:
None
Returns:
The current drive_for status
Source code in vex.py
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
def is_moving(self):
    '''### Returns the current status of the drive_for command
    This function is used when False has been passed as the wait parameter to drive_for\\
    It will return True if the drivetrain is still moving or False if it has completed the move or a timeout occurred.

    #### Arguments:
        None

    #### Returns:
        The current drive_for status
    '''
    return False

is_turning()

Returns the current status of the turn_to_heading, turn_to_rotation or turn_for command

This function is used when False has been passed as the wait parameter to turn_to_heading or turn_for\ It will return True if the drivetrain is still moving or False if it has completed the move or a timeout occurred.

Arguments:
None
Returns:
The current turn_to_heading, turn_to_rotation or turn_for status
Source code in vex.py
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
def is_turning(self):
    '''### Returns the current status of the turn_to_heading, turn_to_rotation or turn_for command
    This function is used when False has been passed as the wait parameter to turn_to_heading or turn_for\\
    It will return True if the drivetrain is still moving or False if it has completed the move or a timeout occurred.

    #### Arguments:
        None

    #### Returns:
        The current turn_to_heading, turn_to_rotation or turn_for status
    '''
    return False

rotation(units=RotationUnits.DEG)

read the current rotation of the smartdrive

rotation is not limited, it can be both positive and negative and shows the absolute angle of the gyro.

Arguments:
units (optional) : The units to return the rotation in, default is DEGREES
Returns:
A value for heading in the range that is specified by the units.
Examples:
# get the current rotation for the smartdrive\
value = smart1.rotation()
Source code in vex.py
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
def rotation(self, units=RotationUnits.DEG):
    '''### read the current rotation of the smartdrive

    rotation is not limited, it can be both positive and negative and shows the absolute angle of the gyro.

    #### Arguments:
        units (optional) : The units to return the rotation in, default is DEGREES

    #### Returns:
        A value for heading in the range that is specified by the units.

    #### Examples:
        # get the current rotation for the smartdrive\\
        value = smart1.rotation()
    '''
    return self.g.rotation(units)

set_heading(value, units=RotationUnits.DEG)

set the smartdrive heading to a new value

The new value for heading should be in the range 0 - 359.99 degrees.

Arguments:
value : The new value to use for heading.
units (optional) : The rotation units type for value, the default is DEGREES
Returns:
None
Examples:
# set the value of heading to 180 degrees\
smart1.set_heading(180)
Source code in vex.py
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
def set_heading(self, value, units=RotationUnits.DEG):
    '''### set the smartdrive heading to a new value

    The new value for heading should be in the range 0 - 359.99 degrees.

    #### Arguments:
        value : The new value to use for heading.
        units (optional) : The rotation units type for value, the default is DEGREES

    #### Returns:
        None

    #### Examples:
        # set the value of heading to 180 degrees\\
        smart1.set_heading(180)
    '''
    pass

set_rotation(value, units=RotationUnits.DEG)

set the smartdrive rotation to a new value
Arguments:
value : The new value to use for rotation.
units (optional) : The rotation units type for value, the default is DEGREES
Returns:
None
Examples:
# set the value of rotation to 180 degrees\
smart1.set_rotation(180)
Source code in vex.py
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
def set_rotation(self, value, units=RotationUnits.DEG):
    '''### set the smartdrive rotation to a new value

    #### Arguments:
        value : The new value to use for rotation.
        units (optional) : The rotation units type for value, the default is DEGREES

    #### Returns:
        None

    #### Examples:
        # set the value of rotation to 180 degrees\\
        smart1.set_rotation(180)
    '''
    pass

set_turn_constant(value)

Set the turning constant for the smartdrive

The smartdrive uses a simple P controller when doing turns.\ This constant, generally known as kp, is the gain used in the equation that\ turns angular error into motor velocity.

Arguments:
value : The new turn constant in the range 0.1 - 4.0, the default is 1.0
Returns:
None
Source code in vex.py
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
def set_turn_constant(self, value):
    '''### Set the turning constant for the smartdrive

    The smartdrive uses a simple P controller when doing turns.\\
    This constant, generally known as kp, is the gain used in the equation that\\
    turns angular error into motor velocity.

    #### Arguments:
        value : The new turn constant in the range 0.1 - 4.0, the default is 1.0

    #### Returns:
        None
    '''
    pass

set_turn_direction_reverse(value)

Set the expected turn direction for positive heading change
Arguments:
value : True or False
Returns:
None
Source code in vex.py
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
def set_turn_direction_reverse(self, value):
    '''### Set the expected turn direction for positive heading change

    #### Arguments:
        value : True or False

    #### Returns:
        None
    '''
    pass

set_turn_threshold(value)

Set the turning threshold for the smartdrive

This is the threshold value used to determine that turns are complete.\ If this is too large then turns will not be accurate, if too small then turns ma\ not complete.

Arguments:
value : The new turn threshold in degrees, the default for a smartdrive is 1 degree
Returns:
None
Source code in vex.py
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
def set_turn_threshold(self, value):
    '''### Set the turning threshold for the smartdrive

    This is the threshold value used to determine that turns are complete.\\
    If this is too large then turns will not be accurate, if too small then turns ma\\
    not complete.

    #### Arguments:
        value : The new turn threshold in degrees, the default for a smartdrive is 1 degree

    #### Returns:
        None
    '''
    pass

turn_for(direction, angle, units=RotationUnits.DEG, velocity=None, units_v=VelocityUnits.RPM, wait=True)

turn the smartdrive using the provided arguments

The turn_for command is similar to the motor spin_for command,\ however, the smartdrive is commanded to turn a specified angle.

Arguments:
direction : The direction to turn, LEFT or RIGHT
angle : The angle to turn
units (optional) : The units for the provided angle, the default is DEGREES
velocity (optional) : drive using this velocity, the default velocity set by set_drive_velocity will be used if not provided.
units_v (optional) : The units of the provided velocity, default is RPM
wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.
Returns:
None or if wait is True then completion success or failure
Examples:
# turn right 90 degrees\
smart1.turn_for(RIGHT, 90, DEGREES)

# turn left 180 degrees with motors at 50 rpm\
smart1.turn_for(LEFT, 180, DEGREES, 50, RPM)
Source code in vex.py
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
def turn_for(self, direction, angle, units=RotationUnits.DEG,
             velocity=None, units_v:VelocityPercentUnits=VelocityUnits.RPM, wait=True):
    '''### turn the smartdrive using the provided arguments

    The turn_for command is similar to the motor spin_for command,\\
    however, the smartdrive is commanded to turn a specified angle.

    #### Arguments:
        direction : The direction to turn, LEFT or RIGHT
        angle : The angle to turn
        units (optional) : The units for the provided angle, the default is DEGREES
        velocity (optional) : drive using this velocity, the default velocity set by set_drive_velocity will be used if not provided.
        units_v (optional) : The units of the provided velocity, default is RPM
        wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.

    #### Returns:
        None or if wait is True then completion success or failure

    #### Examples:
        # turn right 90 degrees\\
        smart1.turn_for(RIGHT, 90, DEGREES)\n
        # turn left 180 degrees with motors at 50 rpm\\
        smart1.turn_for(LEFT, 180, DEGREES, 50, RPM)
    '''
    return True

turn_to_heading(angle, units=RotationUnits.DEG, velocity=None, units_v=VelocityUnits.RPM, wait=True)

turn the smartdrive to an absolute position using the provided arguments

The turn_to_heading command is similar to the motor spin_to_position command,\ however, the smartdrive is commanded to turn to a specified angle.\ This function uses the value of heading() when turning the smartdrive\ This function supports keyword arguments.

Arguments:
angle : The angle to turn to
units (optional) : The units for the provided angle, the default is DEGREES
velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
units_v (optional) : The units of the provided velocity, default is RPM
wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.
Returns:
None
Examples:
# turn to heading 180 degrees\
smart1.turn_to_heading(180)

# turn to heading 180 degrees at 25 rpm\
smart1.turn_to_heading(180, DEGREES, 25, RPM)

# turn to heading 180 degrees and do not wait for completion\
smart1.turn_to_heading(180, DEGREES, False)

# turn to heading 180 degrees and do not wait for completion\
smart1.turn_to_heading(180, DEGREES, wait=False)
Source code in vex.py
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
def turn_to_heading(self, angle, units=RotationUnits.DEG,
                    velocity=None, units_v:VelocityPercentUnits=VelocityUnits.RPM, wait=True):
    '''### turn the smartdrive to an absolute position using the provided arguments

    The turn_to_heading command is similar to the motor spin_to_position command,\\
    however, the smartdrive is commanded to turn to a specified angle.\\
    This function uses the value of heading() when turning the smartdrive\\
    This function supports keyword arguments.

    #### Arguments:
        angle : The angle to turn to
        units (optional) : The units for the provided angle, the default is DEGREES
        velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
        units_v (optional) : The units of the provided velocity, default is RPM
        wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.

    #### Returns:
        None

    #### Examples:
        # turn to heading 180 degrees\\
        smart1.turn_to_heading(180)\n
        # turn to heading 180 degrees at 25 rpm\\
        smart1.turn_to_heading(180, DEGREES, 25, RPM)\n
        # turn to heading 180 degrees and do not wait for completion\\
        smart1.turn_to_heading(180, DEGREES, False)\n
        # turn to heading 180 degrees and do not wait for completion\\
        smart1.turn_to_heading(180, DEGREES, wait=False)
    '''
    return True

turn_to_rotation(angle, units=RotationUnits.DEG, velocity=None, units_v=VelocityUnits.RPM, wait=True)

turn the smartdrive to an absolute position using the provided arguments

The turn_to_rotation command is similar to the motor spin_to_position command,\ however, the smartdrive is commanded to turn to a specified angle.\ This function uses the value of rotation() when turning the smartdrive\ This function supports keyword arguments.

Arguments:
angle : The angle to turn to
units (optional) : The units for the provided angle, the default is DEGREES
velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
units_v (optional) : The units of the provided velocity, default is RPM
wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.
Returns:
None
Examples:
# turn to rotation 180 degrees\
smart1.turn_to_rotation(180)

# turn to rotation 400 degrees at 25 rpm\
smart1.turn_to_rotation(400, DEGREES, 25, RPM)

# turn to rotation 180 degrees and do not wait for completion\
smart1.turn_to_rotation(180, DEGREES, False)

# turn to rotation 180 degrees and do not wait for completion\
smart1.turn_to_rotation(180, DEGREES, wait=False)
Source code in vex.py
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
def turn_to_rotation(self, angle, units=RotationUnits.DEG,
                     velocity=None, units_v:VelocityPercentUnits=VelocityUnits.RPM, wait=True):
    '''### turn the smartdrive to an absolute position using the provided arguments

    The turn_to_rotation command is similar to the motor spin_to_position command,\\
    however, the smartdrive is commanded to turn to a specified angle.\\
    This function uses the value of rotation() when turning the smartdrive\\
    This function supports keyword arguments.

    #### Arguments:
        angle : The angle to turn to
        units (optional) : The units for the provided angle, the default is DEGREES
        velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
        units_v (optional) : The units of the provided velocity, default is RPM
        wait (optional) : This indicates if the function should wait for the command to complete or return immediately, default is True.

    #### Returns:
        None

    #### Examples:
        # turn to rotation 180 degrees\\
        smart1.turn_to_rotation(180)\n
        # turn to rotation 400 degrees at 25 rpm\\
        smart1.turn_to_rotation(400, DEGREES, 25, RPM)\n
        # turn to rotation 180 degrees and do not wait for completion\\
        smart1.turn_to_rotation(180, DEGREES, False)\n
        # turn to rotation 180 degrees and do not wait for completion\\
        smart1.turn_to_rotation(180, DEGREES, wait=False)
    '''
    return True

Motor29

vex.Motor29

Motor29 class - create a new pwm motor output

The Motor29 class will create raw RC style pwm waveform.\ This is primarily for use with the VEX MC29 motor controller\ To minimize current draw, new values sent to the motor will have slew rate control applied

Arguments:
port : The 3wire port to use for the motor controller
reverse_flag (optional) : set reverse flag for this motor, spin commands will cause opposite rotation if set True.  default is False.
Returns:
An instance of the Motor29 class
Examples:
motor1 = Motor29(brain.three_wire_port.a)
Source code in vex.py
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
class Motor29:
    '''### Motor29 class - create a new pwm motor output

    The Motor29 class will create raw RC style pwm waveform.\\
    This is primarily for use with the VEX MC29 motor controller\\
    To minimize current draw, new values sent to the motor will have slew rate control applied

    #### Arguments:
        port : The 3wire port to use for the motor controller
        reverse_flag (optional) : set reverse flag for this motor, spin commands will cause opposite rotation if set True.  default is False.

    #### Returns:
        An instance of the Motor29 class

    #### Examples:
        motor1 = Motor29(brain.three_wire_port.a)
    '''
    def __init__(self, port, reverse_flag=False):
        self._index = port
        self._velocity = 50

    def value(self):
        '''### Read the current raw motor controller pwm value.

        This is the raw internal pwm value\\
        A motor velocity of 0 will return 127\\
        A maximum positive motor velocity will return 255

        #### Arguments:
            None

        #### Returns:
            A value in the range 0 to 255.

        #### Examples:
            # get motor current pwm value\\
            value = motor1.value()
        '''
        return 0

    def type(self):
        return 0

    def set_velocity(self, value, units:VelocityPercentUnits=VelocityUnits.RPM):
        '''### Set default velocity for the motor
        This will be the velocity used for subsequent calls to spin of a velocity is not provided
        to that function.

        #### Arguments:
            value : The new velocity
            units : The units for the supplied velocity, the default is RPM

        #### Returns:
            None
        '''
        self._velocity = value

    def set_reversed(self, value):
        '''### Set the reversed flag for the motor

        #### Arguments:
            value : 1, 0, True or False

        #### Returns:
            None

        #### Examples:
            # set motor reversed flag True\\
            motor1.set_reversed(True)
        '''
        pass

    def spin(self, direction: DirectionType.DirectionType, velocity=None, units=None):
        '''### Spin the motor using the provided arguments

        The motor is assumed to have a maximum velocity of 100 rpm.

        #### Arguments:
            direction : The direction to spin the motor, FORWARD or REVERSE
            velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
            units (optional) : The units of the provided velocity, default is RPM

        #### Returns:
            None

        #### Examples:
            # spin motor forward at velocity set with set_velocity\\
            motor1.spin(FORWARD)\n
            # spin motor forward at 50 rpm\\
            motor1.spin(FORWARD, 50)\n
            # spin with negative velocity, ie. backwards\\
            motor1.spin(FORWARD, -20)\n
            # spin motor forwards with 100% velocity\\
            motor1.spin(FORWARD, 100, PERCENT)\n
            # spin motor forwards at 50 rpm\\
            motor1.spin(FORWARD, 50, RPM)\n
            # spin motor forwards at 360 dps\\
            motor1.spin(FORWARD, 360.0, VelocityUnits.DPS)
        '''
        pass

    def stop(self):
        '''### Stop the  motor, set to 0 velocity

        #### Arguments:
            None

        #### Returns:
            None
        '''
        pass

set_reversed(value)

Set the reversed flag for the motor
Arguments:
value : 1, 0, True or False
Returns:
None
Examples:
# set motor reversed flag True\
motor1.set_reversed(True)
Source code in vex.py
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
def set_reversed(self, value):
    '''### Set the reversed flag for the motor

    #### Arguments:
        value : 1, 0, True or False

    #### Returns:
        None

    #### Examples:
        # set motor reversed flag True\\
        motor1.set_reversed(True)
    '''
    pass

set_velocity(value, units=VelocityUnits.RPM)

Set default velocity for the motor

This will be the velocity used for subsequent calls to spin of a velocity is not provided to that function.

Arguments:
value : The new velocity
units : The units for the supplied velocity, the default is RPM
Returns:
None
Source code in vex.py
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
def set_velocity(self, value, units:VelocityPercentUnits=VelocityUnits.RPM):
    '''### Set default velocity for the motor
    This will be the velocity used for subsequent calls to spin of a velocity is not provided
    to that function.

    #### Arguments:
        value : The new velocity
        units : The units for the supplied velocity, the default is RPM

    #### Returns:
        None
    '''
    self._velocity = value

spin(direction, velocity=None, units=None)

Spin the motor using the provided arguments

The motor is assumed to have a maximum velocity of 100 rpm.

Arguments:
direction : The direction to spin the motor, FORWARD or REVERSE
velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
units (optional) : The units of the provided velocity, default is RPM
Returns:
None
Examples:
# spin motor forward at velocity set with set_velocity\
motor1.spin(FORWARD)

# spin motor forward at 50 rpm\
motor1.spin(FORWARD, 50)

# spin with negative velocity, ie. backwards\
motor1.spin(FORWARD, -20)

# spin motor forwards with 100% velocity\
motor1.spin(FORWARD, 100, PERCENT)

# spin motor forwards at 50 rpm\
motor1.spin(FORWARD, 50, RPM)

# spin motor forwards at 360 dps\
motor1.spin(FORWARD, 360.0, VelocityUnits.DPS)
Source code in vex.py
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
def spin(self, direction: DirectionType.DirectionType, velocity=None, units=None):
    '''### Spin the motor using the provided arguments

    The motor is assumed to have a maximum velocity of 100 rpm.

    #### Arguments:
        direction : The direction to spin the motor, FORWARD or REVERSE
        velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
        units (optional) : The units of the provided velocity, default is RPM

    #### Returns:
        None

    #### Examples:
        # spin motor forward at velocity set with set_velocity\\
        motor1.spin(FORWARD)\n
        # spin motor forward at 50 rpm\\
        motor1.spin(FORWARD, 50)\n
        # spin with negative velocity, ie. backwards\\
        motor1.spin(FORWARD, -20)\n
        # spin motor forwards with 100% velocity\\
        motor1.spin(FORWARD, 100, PERCENT)\n
        # spin motor forwards at 50 rpm\\
        motor1.spin(FORWARD, 50, RPM)\n
        # spin motor forwards at 360 dps\\
        motor1.spin(FORWARD, 360.0, VelocityUnits.DPS)
    '''
    pass

stop()

Stop the motor, set to 0 velocity
Arguments:
None
Returns:
None
Source code in vex.py
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
def stop(self):
    '''### Stop the  motor, set to 0 velocity

    #### Arguments:
        None

    #### Returns:
        None
    '''
    pass

value()

Read the current raw motor controller pwm value.

This is the raw internal pwm value\ A motor velocity of 0 will return 127\ A maximum positive motor velocity will return 255

Arguments:
None
Returns:
A value in the range 0 to 255.
Examples:
# get motor current pwm value\
value = motor1.value()
Source code in vex.py
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
def value(self):
    '''### Read the current raw motor controller pwm value.

    This is the raw internal pwm value\\
    A motor velocity of 0 will return 127\\
    A maximum positive motor velocity will return 255

    #### Arguments:
        None

    #### Returns:
        A value in the range 0 to 255.

    #### Examples:
        # get motor current pwm value\\
        value = motor1.value()
    '''
    return 0

MotorVictor

vex.MotorVictor

MotorVictor class - create a new pwm motor output

The MotorVictor class will create raw RC style pwm waveform.\ This is primarily for use with the VEX Victor motor controller\

Arguments:
port : The 3wire port to use for the motor controller
reverse_flag (optional) : set reverse flag for this motor, spin commands will cause opposite rotation if set True.  default is False.
Returns:
An instance of the MotorVictor class
Examples:
motor1 = MotorVictor(brain.three_wire_port.a)
Source code in vex.py
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
class MotorVictor:
    '''### MotorVictor class - create a new pwm motor output

    The MotorVictor class will create raw RC style pwm waveform.\\
    This is primarily for use with the VEX Victor motor controller\\

    #### Arguments:
        port : The 3wire port to use for the motor controller
        reverse_flag (optional) : set reverse flag for this motor, spin commands will cause opposite rotation if set True.  default is False.

    #### Returns:
        An instance of the MotorVictor class

    #### Examples:
        motor1 = MotorVictor(brain.three_wire_port.a)
    '''
    def __init__(self, port, reverse_flag=False):
        self._index = port
        self._velocity = 50

    def value(self):
        '''### Read the current raw motor controller pwm value.

        This is the raw internal pwm value\\
        A motor velocity of 0 will return 127\\
        A maximum positive motor velocity will return 255

        #### Arguments:
            None

        #### Returns:
            A value in the range 0 to 255.

        #### Examples:
            # get motor current pwm value\\
            value = motor1.value()
        '''
        return 0

    def type(self):
        return 0

    def set_velocity(self, value, units:VelocityPercentUnits=VelocityUnits.RPM):
        '''### Set default velocity for the motor
        This will be the velocity used for subsequent calls to spin of a velocity is not provided
        to that function.

        #### Arguments:
            value : The new velocity
            units : The units for the supplied velocity, the default is RPM

        #### Returns:
            None
        '''
        self._velocity = value

    def set_reversed(self, value):
        '''### Set the reversed flag for the motor

        #### Arguments:
            value : 1, 0, True or False

        #### Returns:
            None

        #### Examples:
            # set motor reversed flag True\\
            motor1.set_reversed(True)
        '''
        pass

    def spin(self, direction, velocity=None, units=None):
        '''### Spin the motor using the provided arguments

        The motor is assumed to have a maximum velocity of 100 rpm.

        #### Arguments:
            direction : The direction to spin the motor, FORWARD or REVERSE
            velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
            units (optional) : The units of the provided velocity, default is RPM

        #### Returns:
            None

        #### Examples:
            # spin motor forward at velocity set with set_velocity\\
            motor1.spin(FORWARD)\n
            # spin motor forward at 50 rpm\\
            motor1.spin(FORWARD, 50)\n
            # spin with negative velocity, ie. backwards\\
            motor1.spin(FORWARD, -20)\n
            # spin motor forwards with 100% velocity\\
            motor1.spin(FORWARD, 100, PERCENT)\n
            # spin motor forwards at 50 rpm\\
            motor1.spin(FORWARD, 50, RPM)\n
            # spin motor forwards at 360 dps\\
            motor1.spin(FORWARD, 360.0, VelocityUnits.DPS)
        '''
        pass

    def stop(self):
        '''### Stop the  motor, set to 0 velocity

        #### Arguments:
            None

        #### Returns:
            None
        '''
        pass

set_reversed(value)

Set the reversed flag for the motor
Arguments:
value : 1, 0, True or False
Returns:
None
Examples:
# set motor reversed flag True\
motor1.set_reversed(True)
Source code in vex.py
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
def set_reversed(self, value):
    '''### Set the reversed flag for the motor

    #### Arguments:
        value : 1, 0, True or False

    #### Returns:
        None

    #### Examples:
        # set motor reversed flag True\\
        motor1.set_reversed(True)
    '''
    pass

set_velocity(value, units=VelocityUnits.RPM)

Set default velocity for the motor

This will be the velocity used for subsequent calls to spin of a velocity is not provided to that function.

Arguments:
value : The new velocity
units : The units for the supplied velocity, the default is RPM
Returns:
None
Source code in vex.py
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
def set_velocity(self, value, units:VelocityPercentUnits=VelocityUnits.RPM):
    '''### Set default velocity for the motor
    This will be the velocity used for subsequent calls to spin of a velocity is not provided
    to that function.

    #### Arguments:
        value : The new velocity
        units : The units for the supplied velocity, the default is RPM

    #### Returns:
        None
    '''
    self._velocity = value

spin(direction, velocity=None, units=None)

Spin the motor using the provided arguments

The motor is assumed to have a maximum velocity of 100 rpm.

Arguments:
direction : The direction to spin the motor, FORWARD or REVERSE
velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
units (optional) : The units of the provided velocity, default is RPM
Returns:
None
Examples:
# spin motor forward at velocity set with set_velocity\
motor1.spin(FORWARD)

# spin motor forward at 50 rpm\
motor1.spin(FORWARD, 50)

# spin with negative velocity, ie. backwards\
motor1.spin(FORWARD, -20)

# spin motor forwards with 100% velocity\
motor1.spin(FORWARD, 100, PERCENT)

# spin motor forwards at 50 rpm\
motor1.spin(FORWARD, 50, RPM)

# spin motor forwards at 360 dps\
motor1.spin(FORWARD, 360.0, VelocityUnits.DPS)
Source code in vex.py
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
def spin(self, direction, velocity=None, units=None):
    '''### Spin the motor using the provided arguments

    The motor is assumed to have a maximum velocity of 100 rpm.

    #### Arguments:
        direction : The direction to spin the motor, FORWARD or REVERSE
        velocity (optional) : spin the motor using this velocity, the default velocity set by set_velocity will be used if not provided.
        units (optional) : The units of the provided velocity, default is RPM

    #### Returns:
        None

    #### Examples:
        # spin motor forward at velocity set with set_velocity\\
        motor1.spin(FORWARD)\n
        # spin motor forward at 50 rpm\\
        motor1.spin(FORWARD, 50)\n
        # spin with negative velocity, ie. backwards\\
        motor1.spin(FORWARD, -20)\n
        # spin motor forwards with 100% velocity\\
        motor1.spin(FORWARD, 100, PERCENT)\n
        # spin motor forwards at 50 rpm\\
        motor1.spin(FORWARD, 50, RPM)\n
        # spin motor forwards at 360 dps\\
        motor1.spin(FORWARD, 360.0, VelocityUnits.DPS)
    '''
    pass

stop()

Stop the motor, set to 0 velocity
Arguments:
None
Returns:
None
Source code in vex.py
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
def stop(self):
    '''### Stop the  motor, set to 0 velocity

    #### Arguments:
        None

    #### Returns:
        None
    '''
    pass

value()

Read the current raw motor controller pwm value.

This is the raw internal pwm value\ A motor velocity of 0 will return 127\ A maximum positive motor velocity will return 255

Arguments:
None
Returns:
A value in the range 0 to 255.
Examples:
# get motor current pwm value\
value = motor1.value()
Source code in vex.py
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
def value(self):
    '''### Read the current raw motor controller pwm value.

    This is the raw internal pwm value\\
    A motor velocity of 0 will return 127\\
    A maximum positive motor velocity will return 255

    #### Arguments:
        None

    #### Returns:
        A value in the range 0 to 255.

    #### Examples:
        # get motor current pwm value\\
        value = motor1.value()
    '''
    return 0