Can continuously Motor running after its stop?

Hi , I meet a problem. can anyone finger out which wrong.

Enviroement: V5
Motor: 4-wheel
My code:


int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  main_brain.Screen.print("Main function running...");

  //print all sensor value
  task displayTaskInstance(displayTask);

  repeat(2) {
    drive_train.driveFor(1000, mm);
    wait(1, sec);

    drive_train.setDriveVelocity(30, percent);

    drive_train.turnFor(90, degrees);
    wait(1, seconds);

    drive_train.turnFor(-90, degrees);
    wait(1, seconds);


  while (true) {

    //joystick 4 forword & back
    int axis_forward_back_value = main_controller.Axis3.value();,
                      abs(axis_forward_back_value), velocityUnits::pct);

    //joystick 4 turn left & right
    int axis_left_right_value = main_controller.Axis4.value();
    drive_train.turnFor(axis_left_right_value, degrees, false);
  return 0;

1.drive_train.stop(); invoked , the joystick will not work.
2.if i comment drive_train.stop(); the joystick can controller forword & back ,but not turn left & right.



Hm, so drive_train.turnFor is not designed to be used with a continuously variable input such as controller joystick values. drive_train. drive should work, but that was not a use case we tested. Generally, to control the drive train with a controller, access the motors (or motor groups) directly.

I’ll check tomorrow why drive_train.stop would have any impact, it really shouldn’t.


Thanks lots 4 quick reply.

I guess turnFor does not work cause of drive_train. drive always act. tonight i will try . is basically a wrapper that sends a spin command to left and right motors.
drive_train.turnFor is a wrapper that uses motor.spinFor on left and right motors (or motor groups). spinFor uses the motor’s internal PID code to move the motor to a new position, it doesn’t like to be repeatedly called with new values in a tight loop.

We do have a drive_train.arcade method available in text, it has code that looks like (more or less, not exactly) this.

drivetrain::arcade( double drivePower, double turnPower, percentUnits units ) {
    lm.spin( directionType::fwd, drivePower + turnPower, units );
    rm.spin( directionType::fwd, drivePower - turnPower, units );

but you can find the left and right motor instances and do the same thing in your own code.,


thanks again.

i can not found any arcade function desc from

and there is not any brief doc in …/include/vex_drivertrain.h

would u kindly post the arcade function implements here ?