In the previous post, we discovered how to successfully score Blocks into the Goals on the VIQC Full Volume Field and win points.
As we know, Full Volume is such a highly flexible Challenge. To find the best solution, we must explore various approaches, test new strategies, and optimize them accordingly. Imagine having to modify the parameters of each drivetrain behavior (drive or turn) in the project every time we make even a slight adjustment - it would be extremely arduous and time-consuming. Establishing a relative coordinate system for robot navigation and implementing modular programming can help us solve this problem effectively.
VIQC Virtual Skills Field provides us with precise dimensions and setup. Based on it, we can strategically select an origin point, create a coordinate system, and pinpoint specific positions on the Field.
To navigate the robot from its current position(x1, y1) to a particular position(x2, y2), two key factors must be determined: the driving direction and the distance to be covered.
- Find the driving direction – heading
Utilizing the coordinates of the robot (x1,y1), the specific position(x2,y2), and atan function, we can calculate the angle of the line connecting these two points.
According to the definition of the drivetrain heading, by utilizing the angle value, θ, we can find the corresponding heading (see image 4) that precisely directs the robot’s movement in the desired direction.
- Determine the distance to be covered.
Utilizing the Pythagorean Theorem to calculate the distance between the robot (x1,y1) and the target position(x2,y2) will help us find the driving distance required for navigation.
By passing the calculated heading to the turn to heading block and the calculated driving distance to the drive for block, we can precisely guide Virtual Byte from its current position (x1, y1) to the specific destination (x2, y2).
Attention: instructing the robot to collect a Block located at position (x2, y2) doesn’t mean driving Virtual Byte to the coordinates (x2, y2)! Instead, the objective is to align the Block with the Virtual Byte’s Intake Mechanism. For successful collection, we need to consider the Block size and the distance between the Intake and the robot’s center to set the desired driving distance.
Congratulations! Now we can drive Virtual Byte to a specific position in the game. How to navigate the robot to various locations to accomplish tasks efficiently? Implementing modular programming will help us simplify the entire project and save a lot of time!
Here is an example: define a function containing instructions to navigate the robot to a specific position. By calling this function using various coordinate parameters in the main program, we can drive the robot to different locations as needed.
Furthermore, we can also define a function that includes codes to instruct the robot to intake a Block positioned at a specific location. By calling this function using different coordinate parameters, we will control the robot to collect Blocks located at different positions as desired.
Modular programming empowers us with efficient project management capabilities. In the following example, by simply adjusting the module call sequence in the main program, we can easily modify the execution order of tasks.
Effective navigation and modular programming unleash our potential to excel in the game. In the next post, we will continue to explore how to optimize the scoring strategy in Full Volume Virtual Skills. Please let us know if you have any questions, comments, or feedback. Thank you!