Robot skills challenge in VEX IQ Challenge (VIQC) consist of Driving Skills Matches, which will be entirely driver controlled, and Programming Skills Matches, which will be autonomous with limited human interaction. In the programming skills matches, beginner teams have always struggled with unreliable autonomous routine. I have heard the same lines over and over again
This worked yesterday.
It worked at my home!
Kids are very frustrated with the unreliable autonomous routine, and choose to give up on autonomous and simply focus on Driving Skills Matches, because it’s more fun and under their control. 80%+ of VEX IQ teams in worlds don’t have or don’t know how to have a reliable autonomous program.
Latest VEX IQ Middle School World Skills Standings leader board, some of the top 50 teams in world (total 618 teams on the board) still suffer from unreliable programming skills code.
We have decided to publish a mini series of tutorials to help the teams to improve their Programming Skills Matches score.
839 coding tutorial
Drive straight code snippet for VEXcode Blocks.
Create a my block for driveStraight. We are implementing a simple PID controller (technically, this is only a P controller). PID (proportional–integral–derivative) controller is a control loop mechanism employing feedback that is widely used in industrial control systems and a variety of other applications requiring continuously modulated control. If you would like to know more PID controller’s algorithm, you can start with the Wikipedia page. Matlab has a great video tutorial published to explain PID control on YouTube.
Calling driveStraight my block
At the beginning of the program, make sure you set the motor brake mode to brake and calibrate the gyro for 2 seconds. Then you can simply call driveStraight we created earlier.
Distance: 500 – how far you want your robot to travel in degrees
Heading: 0 – target heading of the robot
Velocity: 60 – how fast you want your robot to travel, we recommend to start slow like 50 – 70 before you go full speed at 100. But it also depends on your robot’s gear ratio.
Kp: 2 – proportional control value, the bigger the number, the faster the robot correct itself, but if the value is too big, correction will overshoot, and you will see robot zigzag. Kp = 0 means there is no correction applied.