Is there a special way to program dr4b?

  1. 11 months ago

    Naman

    5 Dec 2017 A planet

    Is there a special way to program a dr4b? I am just using an if statement which will check if a button is pressed. If the button is pressed it will run all four motors on the dr4b at a speed. Is this method correct?

  2. Mystellianne

    5 Dec 2017 Miami, Florida 4411S

    This should work pretty well, depending on the direction your motors spin:

    motor[liftTopLeft] = /*Button to lift up*/ * 127 - /*Button to go down*/ * 127;
    motor[liftBottomLeft] = /*Button to lift up*/ * 127 - /*Button to go down*/ * 127;
    motor[liftTopRight] = /*Button to lift up*/ * 127 - /*Button to go down*/ * 127;
    motor[liftBottomRight] = /*Button to lift up*/ * 127 - /*Button to go down*/ * 127;

    This is the most basic you can get, but essentially, the buttons are either a 0 or a 1 depending on whether they are pressed or not, so if it's a 0, 127 * 0 = 0, and if it's 1, 127 * 1 = 127. This'll change based on what speed you want to go up at and the direction your motors spin, but it'll work perfectly to start with.

  3. Naman

    6 Dec 2017 A planet
    Edited 11 months ago by Naman

    Should the speed for going down be around 80? Since gravity is helping the dr4b to go down.

  4. Mystellianne

    6 Dec 2017 Miami, Florida 4411S

    @Naman Should the speed for going down be around 80? Since gravity is helping the dr4b to go down.

    Ideally, the speed for going up and down would actually be the same. Typically, dr4bs need to be rubber banded in order to be used most effectively. The best way to rubber band it is by putting on rubber bands one by one, until you notice that the lift can stay up by itself. This means that the tension the rubber bands cause has cancelled out the force of gravity.

    Because the rubber bands have essentially cancelled out the force of gravity, it will be a lot easier for the robot to go up, and since there is no force making it want to go in any direction, it will go down with the same speed, regardless of gravity "helping" it.

    However, this is the absolute ideal scenario, so it may [probably will] still go down faster than it goes up, but it won't be by much, so you can have it go down at full speed.

    Once you get into PID controls this won't even be an issue, but for now that's the best advice I can give you. Good luck!

  5. Evan56G

    6 Dec 2017 Cape Elizabeth, ME 56G

    @Mystellianne Once you get into PID controls this won't even be an issue, but for now that's the best advice I can give you. Good luck!

    If you can program a PID loop into your code for the dr4b do that. Life in working with PID for your dr4b becomes soooo much easier. If not you can use rubber bands as @Mystellianne said. I would get into working with PID if you have time but if not or proving to be challenging then stick with rubber bands. Good luck at future competitions.

 

or Sign Up to reply!