forked from WPIRoboticsEngineering/RBE2002_template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDrivingChassis.cpp
112 lines (102 loc) · 3.28 KB
/
DrivingChassis.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
* DrivingChassis.cpp
*
* Created on: Jan 31, 2019
* Author: hephaestus
*/
#include "DrivingChassis.h"
/**
* Compute a delta in wheel angle to traverse a specific distance
*
* arc length = 2* Pi* R* (C/360)
*
* C is the central angle of the arc in degrees
* R is the radius of the arc
* Pi is Pi
*
* @param distance a distance for this wheel to travel in MM
* @return the wheel angle delta in degrees
*/
float DrivingChassis::distanceToWheelAngle(float distance) {
return 0;
}
/**
* Compute the arch length distance the wheel needs to travel through to rotate the base
* through a given number of degrees.
*
* arc length = 2* Pi* R* (C/360)
*
* C is the central angle of the arc in degrees
* R is the radius of the arc
* Pi is Pi
*
* @param angle is the angle the base should be rotated by
* @return is the linear distance the wheel needs to travel given the this CHassis's wheel track
*/
float DrivingChassis::chassisRotationToWheelDistance(float angle) {
return 0;
}
DrivingChassis::~DrivingChassis() {
// do nothing
}
/**
* DrivingChassis encapsulates a 2 wheel differential steered chassis that drives around
*
* @param left the left motor
* @param right the right motor
* @param wheelTrackMM is the measurment in milimeters of the distance from the left wheel contact point to the right wheels contact point
* @param wheelRadiusMM is the measurment in milimeters of the radius of the wheels
* @param imu The object that is used to access the IMU data
*
*/
DrivingChassis::DrivingChassis(PIDMotor * left, PIDMotor * right,
float wheelTrackMM, float wheelRadiusMM,GetIMU * imu) {
}
/**
* Start a drive forward action
*
* @param mmDistanceFromCurrent is the distance the mobile base should drive forward
* @param msDuration is the time in miliseconds that the drive action should take
*
* @note this function is fast-return and should not block
* @note pidmotorInstance->overrideCurrentPosition(0); can be used to "zero out" the motor to
* allow for relative moves. Otherwise the motor is always in ABSOLUTE mode
*/
void DrivingChassis::driveForward(float mmDistanceFromCurrent, int msDuration) {
}
/**
* Start a turn action
*
* This action rotates the robot around the center line made up by the contact points of the left and right wheels.
* Positive angles should rotate to the left
*
* This rotation is a positive rotation about the Z axis of the robot.
*
* @param degreesToRotateBase the number of degrees to rotate
* @param msDuration is the time in miliseconds that the drive action should take
*
* @note this function is fast-return and should not block
* @note pidmotorInstance->overrideCurrentPosition(0); can be used to "zero out" the motor to
* allow for relative moves. Otherwise the motor is always in ABSOLUTE mode
*/
void DrivingChassis::turnDegrees(float degreesToRotateBase, int msDuration) {
}
/**
* Check to see if the chassis is performing an action
*
* @return false is the chassis is driving, true is the chassis msDuration has elapsed
*
* @note this function is fast-return and should not block
*/
bool DrivingChassis::isChassisDoneDriving() {
return false;
}
/**
* loop()
*
* a fast loop function that will update states of the motors based on the information from the
* imu.
*/
bool DrivingChassis::loop(){
return false;
}