How to program VEX IQ precise turn with VEXcode blocks

Last Updated: January 16th, 20211.9 min readCategories: VEX IQ, Robotics, Scratch

In part one drive straight with proportional control of the mini series on how to make reliable programming skills in VEX IQ Challenge. If you haven’t read that post yet, I recommend doing that and then coming back to this post. We will do a square test at the end of this post, which uses the drive straight my block from part one.

839 coding tutorial

Precise turn code snippet for VEXcode Blocks.

VEXcode blocks precise turn

Create a my block for turn. Robot will carry a momentum and continue turning even after the stop command has been sent, so we will stop the motor before robot reaches its target angle.

VEX IQ gyro rotation

Please note VEX IQ gyro sensor has a positive value when turning left, and negative when turning right. For more information about VEX IQ gyro sensor, please check VEX KB Using the VEX IQ Gyro Sensor.

Calling turn my block

VEXcode blocks square test

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 turn we created earlier.

  • Heading: 90 – target heading that robot should turn to
  • Velocity: 10 – how fast the robot should turn, please note this is an spot turn (left wheel and right wheel travelling at opposite speed at the same time, hense it’s 2x speed)
  • Momentum: 5 – how many degrees you are expecting the robot will carry after it’s stopped. e.g. turning into 90 degrees with 5 as momentum will stop the robot from moving at 85 degrees.

Combining with the part 1 – Drive straight with proportional control, we can do a square test of the robot, the result of the square test can be seen in the video tutorial.

Mini Series – How to make a reliable VEX IQ programming skills

This is the part 2 of the mini series.

  1. Drive straight with proportional control
  2. Precise turn with VEX IQ gyro

If you happen to locate in Markham, Richmond Hill or another towns in Greater Toronto Area, and would like to check out the best VEX IQ club in Ontario, please check out our robotics program in Caution Tape Robotics Club. Our world champion coaching team have years of VEX competitions experiences. We offer virtual classes and competitive program to get your kids involved in STEM education, competitive robotics program from age 8-17.

Did I mention that we do have FREE coding classes run by our high school students volunteers, that’s a great opportunity to get your kids started taking instructed coding classes with absolutely no cost.

If you have any questions or comments, please leave them below!

Share This Story!

5 2 votes
Article Rating
Subscribe
Notify of
guest
3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Lou

Thanks! This is super helpful! 😀

Ryan

When I use the program on my robot, sometimes it is very accurate and turns to 90 degrees exactly and sometimes it will just spin in circles until it thinks that it is at 90 degrees. This has been annoying our team because then we can’t program and when we go to a competition, we don’t know if it will work reliably. Do you think you could do a zoom or google meet to help us fix it sometime this week? We would really appreciate your time.

Archives

Categories

Recent Tweets

Join Our Champion Team to Start Your STEM Journey Today

Become Part of Caution Tape to Dream the Impossible.

Thank you for your message. It has been sent.
There was an error trying to send your message. Please try again later.

Partners, Sponsors and Features