Coding with brakes (v5 using VCS)

  1. last week

    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.

  2. JuiceBox

    Jan 5 Ohio 6741E

    @mvas8037 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);

  3. @JuiceBox 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.

  4. jpearman

    Jan 6 Moderator, ROBOTC Tech Support, V5 Beta Moderator Los Angeles 8888

    @mvas8037 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 ?

  5. @jpearman 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.

  6. 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.

  7. jpearman

    Jan 6 Moderator, ROBOTC Tech Support, V5 Beta Moderator Los Angeles 8888
    Edited last week by jpearman

    @mvas8037 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.

    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.

  8. @jpearman 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?

  9. hotel

    Jan 7 V5 Beta Moderator HTTP 404 PROS Dev Team Lead

    @mvas8037 how would I do that?

    click a username and on the profile page there should be a link to "start a private conversation with ..."

  10. @hotel click a username and on the profile page there should be a link to "start a private conversation with ..."

    thanks

 

or Sign Up to reply!