Skip to content

Motion Control

Matthew Kirk edited this page Apr 25, 2016 · 5 revisions

Motion Control


A quick structure rundown:

roboclaw.py

for V5 of the roboclaws. It will not work with older versions.

mat.py and mat2.py

These files define the physical layout of the wheels on the robot, including which way they spin. The only difference between mat.py and mat2.py is what is called motor 1, motor 2, etc. This is because upon rebuilding the robot, wheels got switched around. Instead of rebuilding the robot, it was easier to just change what each motor was called.

mlib.py

stands for motor library. This is an abstraction for various motor functions. It exists so that instead of having to call (address,1), (address,2), etc, you can just call movement commands by assigned motor name. The wheel locations are imported from either mat or mat2 as mat. mlib.goXYOmegaWorld(x,y,omega,theta) tells the robot to go in a specific xy direction given a current rotation from the world frame. This is the bread and butter movement function.

globals.py

This contains values accessed by various different files like pid constants and limiting values.

manual.py

Allows for manual control of the robot. Reads keyboard input using getch and translates received input into a motor command.

w: Forward

a: Left

s: Back

d: Right

q: Rotate counter-clockwise

e: Rotate clockwise

f: Kick

space: Stop

k: Kill (stop robot)

roboControl.py

Parses ROS msg from subscriber to determine command and location data.

sample_pid.py

The actual implementation of the movement PID controller.

Clone this wiki locally