Example 4 Moving Using mav

Simulation

not found

Real Life

not found

What does the code do?

In this code the robot moves forward for 1200 ms using mav (motor number, velocity) at 1500 velocity.

Functions Used

mav(motor port, velocity )

msleep(distance in ms)

Function Implementation

 1#!/usr/bin/python3
 2import os, sys
 3sys.path.append("/usr/lib")
 4from kipr import*
 5
 6def main():
 7   mav(0, 1500)
 8   mav(3, 1500)
 9   msleep(1200)
10
11if __name__ == "__main__":
12   main()

Rookie Tips

There are more than one way to move a robot. MAV (move_at_velocity) uses velocity (ticks per second) to move. We recommend mav for competitions, due to the fact that it is ticks per second while motor is percentage. This means mav will be much more specific than motor.

For more details on motor and mav, please search it up in our search bar, then go to motor.mav.

not found not found not found