Example 6 Getting Values
Simulation
The data collected by the code will show up in the bottom right in the console. In this case, the values 16320 and 23095 have been recorded.
Real Life
The data collected by the code will show up on the hub.
What does the code do?
This code gives the motor values, and prints the values in the console.
Functions Used
print( Inputted message)
gmpc( get_motor_position)
Function Implementation
1#!/usr/bin/python3
2import os, sys
3sys.path.append("/usr/lib")
4from kipr import*
5
6def main():
7 print("this is the value of the wheel:", gmpc(0))
8 print("this is the value of the wheel:", gmpc(3))
9
10if __name__ == "__main__":
11 main()
Rookie Tip
By printing the gmpc, you can know the exact position the robot motors are at.