JMotor
Loading...
Searching...
No Matches
JCurvatureDrive.h
Go to the documentation of this file.
1#ifndef J_CURVATURE_DRIVE_H
2#define J_CURVATURE_DRIVE_H
3#include "JTwoDTransform.h"
4#include <Arduino.h>
5
9namespace JCurvatureDrive {
19inline JTwoDTransform calculate(bool curvatureEnabled, JTwoDTransform input, float minRadius, bool reverseTurning = false)
20{
21 JTwoDTransform output = input;
22 if (reverseTurning)
23 output.theta = -output.theta;
24 if (curvatureEnabled) {
25 float speed = sqrt(sq(input.x) + sq(input.y));
26 output.theta = output.theta * speed / minRadius;
27 }
28
29 return output;
30}
31
32} // end of namespace
33#endif
Cheezy Drive! https://frc1756-argos.github.io/ArgoBot-Drive-Training/tutorials/4/#c.
Definition JCurvatureDrive.h:9
JTwoDTransform calculate(bool curvatureEnabled, JTwoDTransform input, float minRadius, bool reverseTurning=false)
Definition JCurvatureDrive.h:19
struct for storing a 2 dimensional transformation. Used for telling a drivetrain how to move.
Definition JTwoDTransform.h:9
float theta
clockwise- | counterclockwise+
Definition JTwoDTransform.h:21
float x
backwards- | forward+
Definition JTwoDTransform.h:13
float y
right- | left+
Definition JTwoDTransform.h:17