robolab/src/odometry.py

31 lines
978 B
Python

#!/usr/bin/env python3
# Suggestion: implement odometry as class that is not using the ev3dev.ev3 package
# establish value exchange with main driving class via getters and setters
import time
from planet import Direction
'''
Documentation:
good and simple explanation on how odometry works:
https://www.youtube.com/watch?v=qsdiIZncgqo
Summary:
axis a (measure distance where wheels have most friction)
calibration factor c = diameter/ticks_per_turn
distance d = ticks wheel * c (calculate for each wheel individually)
vector_length = (d_l + d_r)/2
vector_angle ~= (d_l + d_r)/a (only applicable for small distances)
Functionality that should be implemented in this class:
- tracking of relative distances
- track the roboters orientation
- maybe have seperate functions for vector length and orientation (only if it is beneficial)
- closest coordinate to relative distance estimation/calculation
'''
class Odometry:
def __init__(self, planet):
pass