Coding with brakes (v5 using VCS)

I was coding a brake feature for one of the motors on the robot and it works fine however once I press the button on the controller for the brake to turn on, it continues on for the rest of the match. I was wondering if there is a brake release function that I’m not aware of or if there is a way to turn the brake of.

If you want to stop the brake you would just need to change brakeType back to coast which you can do by using motor.setStopping(brakeType::coast);

I’m aware of this coasting brake type but for some reason it significantly reduces the speed of the motor for the rest of the match.

It shouldn’t, any example code that demonstrates that ?

There is a screenshot of the code attached to this. I have run the robot without the code active and it is noticeably faster but the moment I download the code with the brake in it, the moment the button the button activates the brake, the speed is reduced significantly, even when its coasting. This is particularly true with turns, the bot turns much much slower when the brake is active and even after when its deactivated.

The brake does its job by the way, the robot will not move forward or backward when it gets pushed, it will create immense friction with the floor and the only way to move it is to slide it. For some reason, it intereferes with the driving throughout the match even when its coasting.

I ran this test code.


using namespace vex;

brain     Brain;
motor      m1( vex::PORT11 );
controller p;

int main() {

  while(1) {
    Brain.Screen.printAt( 10, 50, "Vel %6.1f", m1.velocity(velocityUnits::rpm) );
    
    if( p.ButtonLeft.pressing() ) {
      m1.stop( brakeType::brake );
    }
    else
    if( p.ButtonRight.pressing() ) {
      m1.stop( brakeType::coast );
    }
    else {
      m1.spin( fwd, p.Axis1.value(), velocityUnits::pct );
    }
    
    // Allow other tasks to run
    this_thread::sleep_for(10);
  }
}

I see no difference in motor velocity with either coast or brake mode activated.
perhaps send me the whole program as DM if you want to.

Not sure how to DM in the vex forum as I’ve never needed to, how would I do that?

click a username and on the profile page there should be a link to “start a private conversation with …”

1 Like

thanks