PID for V5 motors

  1. last week

    abennett5139

    Sep 13 Concord, NC 5139

    Hey so I was wondering if anyone had any example code or any help to help me learn how to make a PID for my Autonomous. Example codes in any programming language (RobotC, RobotMesh, or VCS) would be appreciated. Thanks

  2. It's built in to the V5 motors. In RMS, we have a Drivetrain class that helps with wrangling two motors at the same time, doing encoder turns, and doing distance-based driving. Check out this example project for a dead-reckoning autonomous with V5 in Robot Mesh Studio C++. I also wrote a version of this in Blockly and in Python .

  3. abennett5139

    Sep 13 Concord, NC 5139

    @John TYler It's built in to the V5 motors. In RMS, we have a Drivetrain class that helps with wrangling two motors at the same time, doing encoder turns, and doing distance-based driving. Check out this example project for a dead-reckoning autonomous with V5 in Robot Mesh Studio C++. I also wrote a version of this in Blockly and in Python .

    So when you made the dt what were the numbers 319.1764, 292.1 for?

  4. tabor473

    Sep 13 V5 Beta Tester OYES, WPI

    @abennett5139 So when you made the dt what were the numbers 319.1764, 292.1 for?

    From the Robot Mesh API

    vex::drivetrain::drivetrain	(	motor & 	leftMotor,
    motor & 	rightMotor,
    float 	wheelTravel = 319.1764,
    float 	trackWidth = 292.1,
    distanceUnits 	unit = distanceUnits::mm 
    )	
  5. Edited last week by John TYler

    Wheel circumference and drive train width, in millimeters. When you are setting up a drivetrain with the configuration tool on the right side it asks for those values and tells you what it's asking for.

  6. abennett5139

    Sep 13 Concord, NC 5139

    @tabor473 From the Robot Mesh API

    vex::drivetrain::drivetrain ( motor & leftMotor, motor & rightMotor, float wheelTravel = 319.1764, float trackWidth = 292.1, distanceUnits unit = distanceUnits::mm )

    Ok so the dead reckoning program isn't a PID per say like it isn't accounting for motor variances and one motor being slightly slower than the other it is just linking them together and setting their velocity's the same. But it could curve one way or the other due to not every motor being exactly the same, correct?

  7. tabor473

    Sep 13 V5 Beta Tester OYES, WPI

    @abennett5139 Ok so the dead reckoning program isn't a PID per say like it isn't accounting for motor variances and one motor being slightly slower than the other it is just linking them together and setting their velocity's the same. But it could curve one way or the other due to not every motor being exactly the same, correct?

    So with V5 motors when you tell them to go at "50 rpm" they do PID to achieve that 50 RPM. This program just helps organize low level motor PID into high level commands like "drive straight 1 meter"

  8. The motors handle doing PID on their end. The program asks them to move to a position, and the motors handle things from there. The Drivetrain class handles the math of translating linear and rotational units to motor movement positions based on the configuration.

  9. 6 days ago

    M8R

    Sep 14 Los Angeles, California 7700

    rtfm .
    That specific command will have the motors motion profile to their target.

  10. Rick TYler

    Sep 14 Teachers/Coaches, Event Partner, V5 Beta Moderator Redmond, Washington Founder of Exothermic Robotics

    @M8R rtfm .
    That specific command will have the motors motion profile to their target.

    While I appreciate any exhortation to RTM, not everyone is using VCS.

 

or Sign Up to reply!